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 
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|
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|
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_
std::optional< Rect > GetCoverage(const Matrix &transform) const override
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...
bool IsAxisAlignedRect() const override
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
std::optional< Rect > GetCoverage(const Matrix &transform) const override
StrokeRectGeometry(const Rect &rect, const StrokeParameters &stroke)
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Join
An enum that describes ways to join two segments of a path.
float Scalar
Definition: scalar.h:19
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
A structure to store all of the parameters related to stroking a path or basic geometry object.