| Flutter Impeller |

rect_geometry.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_ENTITY_GEOMETRY_RECT_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_RECT_GEOMETRY_H_
7
8 #include "impeller/entity/geometry/geometry.h"
9 #include "impeller/geometry/stroke_parameters.h"
10
11 namespace impeller {
12
13 class FillRectGeometry final : public Geometry {
14 public:
15 explicit FillRectGeometry(Rect rect);
16
17 ~FillRectGeometry() override;
18
19 // |Geometry|
20 bool CoversArea(const Matrix& transform, const Rect& rect) const override;
21
22 // |Geometry|
23 bool IsAxisAlignedRect() const override;
24
25 // |Geometry|
26 GeometryResult GetPositionBuffer(const ContentContext& renderer,
27 const Entity& entity,
28 RenderPass& pass) const override;
29
30 // |Geometry|
31 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
32
33 private:
34 Rect rect_;
35 };
36
37 class StrokeRectGeometry final : public Geometry {
38 public:
39 explicit StrokeRectGeometry(const Rect& rect, const StrokeParameters& stroke);
40
41 ~StrokeRectGeometry() override;
42
43 // |Geometry|
44 GeometryResult GetPositionBuffer(const ContentContext& renderer,
45 const Entity& entity,
46 RenderPass& pass) const override;
47
48 // |Geometry|
49 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
50
51 private:
52 const Rect rect_;
53 const Scalar stroke_width_;
54 const Join stroke_join_;
55
56 static Join AdjustStrokeJoin(const StrokeParameters& stroke);
57
58 static Point* AppendRoundCornerJoin(Point* buffer,
59 Point corner,
60 Vector2 offset,
61 const Tessellator::Trigs& trigs);
62 };
63
64 } // namespace impeller
65
66 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_RECT_GEOMETRY_H_
impeller::ContentContext
Definition: content_context.h:138
impeller::Entity
Definition: entity.h:26
impeller::FillRectGeometry
Definition: rect_geometry.h:13
impeller::FillRectGeometry::FillRectGeometry
FillRectGeometry(Rect rect)
Definition: rect_geometry.cc:9
impeller::FillRectGeometry::GetCoverage
std::optional< Rect > GetCoverage(const Matrix &transform) const override
Definition: rect_geometry.cc:31
impeller::FillRectGeometry::CoversArea
bool CoversArea(const Matrix &transform, const Rect &rect) const override
Determines if this geometry, transformed by the given transform, will completely cover all surface ar...
Definition: rect_geometry.cc:36
impeller::FillRectGeometry::IsAxisAlignedRect
bool IsAxisAlignedRect() const override
Definition: rect_geometry.cc:45
impeller::FillRectGeometry::GetPositionBuffer
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: rect_geometry.cc:13
impeller::FillRectGeometry::~FillRectGeometry
~FillRectGeometry() override
impeller::Geometry
Definition: geometry.h:50
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
impeller::StrokeRectGeometry
Definition: rect_geometry.h:37
impeller::StrokeRectGeometry::GetCoverage
std::optional< Rect > GetCoverage(const Matrix &transform) const override
Definition: rect_geometry.cc:205
impeller::StrokeRectGeometry::StrokeRectGeometry
StrokeRectGeometry(const Rect &rect, const StrokeParameters &stroke)
Definition: rect_geometry.cc:49
impeller::StrokeRectGeometry::~StrokeRectGeometry
~StrokeRectGeometry() override
impeller::StrokeRectGeometry::GetPositionBuffer
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: rect_geometry.cc:57
impeller::Tessellator::Trigs
Definition: tessellator.h:48
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214
geometry.h
impeller
Definition: allocation.cc:12
impeller::Join
Join
An enum that describes ways to join two segments of a path.
Definition: stroke_parameters.h:20
impeller::Scalar
float Scalar
Definition: scalar.h:19
stroke_parameters.h
impeller::GeometryResult
Definition: geometry.h:21
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::StrokeParameters
A structure to store all of the parameters related to stroking a path or basic geometry object.
Definition: stroke_parameters.h:28
impeller::TPoint< Scalar >
impeller::TRect< Scalar >