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 Rect& 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 |DlPath| object
53 /// using the |FillPathSourceGeometry| base class and the inherent
54 /// ability for a |DlPath| object to perform path iteration.
56  public:
57  explicit FillPathGeometry(const flutter::DlPath& path,
58  std::optional<Rect> inner_rect = std::nullopt);
59 
60  protected:
61  const PathSource& GetSource() const override;
62 
63  private:
64  const flutter::DlPath path_;
65 };
66 
67 /// @brief A Geometry that produces fillable vertices for the gap between
68 /// a pair of |RoundRect| objects using the |FillPathSourceGeometry|
69 /// base class.
71  public:
72  explicit FillDiffRoundRectGeometry(const RoundRect& outer,
73  const RoundRect& inner);
74 
75  protected:
76  const PathSource& GetSource() const override;
77 
78  private:
79  const DiffRoundRectPathSource source_;
80 };
81 
82 } // namespace impeller
83 
84 #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 |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)
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...
virtual const PathSource & GetSource() const =0
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:29
A 4x4 matrix using column-major storage.
Definition: matrix.h:37