| Flutter Impeller |

round_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_ROUND_RECT_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_ROUND_RECT_GEOMETRY_H_
7
8 #include "impeller/entity/geometry/geometry.h"
9
10 namespace impeller {
11
12 // Geometry class that can generate vertices (with or without texture
13 // coordinates) for filled ellipses. Generating vertices for a stroked
14 // ellipse would require a lot more work since the line width must be
15 // applied perpendicular to the distorted ellipse shape.
16 class RoundRectGeometry final : public Geometry {
17 public:
18 explicit RoundRectGeometry(const Rect& bounds, const Size& radii);
19
20 ~RoundRectGeometry() = default;
21
22 // |Geometry|
23 bool CoversArea(const Matrix& transform, const Rect& rect) const override;
24
25 // |Geometry|
26 bool IsAxisAlignedRect() const override;
27
28 private:
29 // |Geometry|
30 GeometryResult GetPositionBuffer(const ContentContext& renderer,
31 const Entity& entity,
32 RenderPass& pass) const override;
33
34 // |Geometry|
35 GeometryVertexType GetVertexType() const override;
36
37 // |Geometry|
38 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
39
40 // |Geometry|
41 GeometryResult GetPositionUVBuffer(Rect texture_coverage,
42 Matrix effect_transform,
43 const ContentContext& renderer,
44 const Entity& entity,
45 RenderPass& pass) const override;
46
47 const Rect bounds_;
48 const Size radii_;
49
50 RoundRectGeometry(const RoundRectGeometry&) = delete;
51
52 RoundRectGeometry& operator=(const RoundRectGeometry&) = delete;
53 };
54
55 } // namespace impeller
56
57 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_ROUND_RECT_GEOMETRY_H_
impeller::RoundRectGeometry::IsAxisAlignedRect
bool IsAxisAlignedRect() const override
Definition: round_rect_geometry.cc:79
impeller::RoundRectGeometry::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: round_rect_geometry.cc:46
impeller::RoundRectGeometry::~RoundRectGeometry
~RoundRectGeometry()=default
impeller::GeometryVertexType
GeometryVertexType
Definition: geometry.h:49
impeller::Entity
Definition: entity.h:21
impeller::TSize< Scalar >
geometry.h
impeller::GeometryResult
Definition: geometry.h:20
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
impeller::Geometry
Definition: geometry.h:83
impeller::RoundRectGeometry
Definition: round_rect_geometry.h:16
impeller
Definition: aiks_blur_unittests.cc:20
impeller::ContentContext
Definition: content_context.h:392
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::RoundRectGeometry::RoundRectGeometry
RoundRectGeometry(const Rect &bounds, const Size &radii)
Definition: round_rect_geometry.cc:9