Flutter Impeller
fill_path_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_FILL_PATH_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_FILL_PATH_GEOMETRY_H_
7 
8 #include <optional>
9 
10 #include "flutter/display_list/geometry/dl_path.h"
12 #include "impeller/geometry/rect.h"
13 
14 namespace impeller {
15 
16 /// @brief An abstract Geometry base class that produces fillable vertices for
17 /// the interior of any |PathSource| provided by the type-specific
18 /// subclass.
20  public:
21  ~FillPathSourceGeometry() override;
22 
23  // |Geometry|
24  bool CoversArea(const Matrix& transform, const IRect& rect) const override;
25 
26  protected:
27  explicit FillPathSourceGeometry(std::optional<Rect> inner_rect);
28 
29  /// The PathSource object that will be iterated to produce the filled
30  /// vertices.
31  virtual const PathSource& GetSource() const = 0;
32 
33  private:
34  // |Geometry|
35  GeometryResult GetPositionBuffer(const ContentContext& renderer,
36  const Entity& entity,
37  RenderPass& pass) const override;
38 
39  // |Geometry|
40  std::optional<Rect> GetCoverage(const Matrix& transform) const override;
41 
42  // |Geometry|
43  GeometryResult::Mode GetResultMode() const override;
44 
45  std::optional<Rect> inner_rect_;
46 
48 
49  FillPathSourceGeometry& operator=(const FillPathSourceGeometry&) = delete;
50 };
51 
52 /// @brief A Geometry that produces fillable vertices from a |PathSource| object
53 /// using the |FillPathSourceGeometry|.
55  public:
56  explicit FillPathFromSourceGeometry(const PathSource& source);
57 
58  protected:
59  const PathSource& GetSource() const override;
60 
61  private:
62  const PathSource& source_;
63 };
64 
65 /// @brief A Geometry that produces fillable vertices from a |DlPath| object
66 /// using the |FillPathSourceGeometry| base class and the inherent
67 /// ability for a |DlPath| object to perform path iteration.
69  public:
70  explicit FillPathGeometry(const flutter::DlPath& path,
71  std::optional<Rect> inner_rect = std::nullopt);
72 
73  protected:
74  const PathSource& GetSource() const override;
75 
76  private:
77  const flutter::DlPath path_;
78 };
79 
80 /// @brief A Geometry that produces fillable vertices for the gap between
81 /// a pair of |RoundRect| objects using the |FillPathSourceGeometry|
82 /// base class.
84  public:
85  explicit FillDiffRoundRectGeometry(const RoundRect& outer,
86  const RoundRect& inner);
87 
88  protected:
89  const PathSource& GetSource() const override;
90 
91  private:
92  const DiffRoundRectPathSource source_;
93 };
94 
95 } // namespace impeller
96 
97 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_FILL_PATH_GEOMETRY_H_
A Geometry that produces fillable vertices for the gap between a pair of |RoundRect| objects using th...
const PathSource & GetSource() const override
FillDiffRoundRectGeometry(const RoundRect &outer, const RoundRect &inner)
A Geometry that produces fillable vertices from a |PathSource| object using the |FillPathSourceGeomet...
FillPathFromSourceGeometry(const PathSource &source)
const PathSource & GetSource() const override
A Geometry that produces fillable vertices from a |DlPath| object using the |FillPathSourceGeometry| ...
FillPathGeometry(const flutter::DlPath &path, std::optional< Rect > inner_rect=std::nullopt)
const PathSource & GetSource() const override
An abstract Geometry base class that produces fillable vertices for the interior of any |PathSource| ...
FillPathSourceGeometry(std::optional< Rect > inner_rect)
virtual const PathSource & GetSource() const =0
bool CoversArea(const Matrix &transform, const IRect &rect) const override
Determines if this geometry, transformed by the given transform, will completely cover all of the pix...
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
flutter::DlPath DlPath
Definition: dl_dispatcher.h:34
A 4x4 matrix using column-major storage.
Definition: matrix.h:37