| 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"
11 #include "impeller/entity/geometry/geometry.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.
19 class FillPathSourceGeometry : public Geometry {
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
47 FillPathSourceGeometry(const FillPathSourceGeometry&) = delete;
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|.
54 class FillPathFromSourceGeometry final : public 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.
68 class FillPathGeometry final : public FillPathSourceGeometry {
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.
83 class FillDiffRoundRectGeometry final : public FillPathSourceGeometry {
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_
impeller::ContentContext
Definition: content_context.h:122
impeller::DiffRoundRectPathSource
Definition: round_rect.h:169
impeller::Entity
Definition: entity.h:26
impeller::FillDiffRoundRectGeometry
A Geometry that produces fillable vertices for the gap between a pair of |RoundRect| objects using th...
Definition: fill_path_geometry.h:83
impeller::FillDiffRoundRectGeometry::GetSource
const PathSource & GetSource() const override
Definition: fill_path_geometry.cc:114
impeller::FillDiffRoundRectGeometry::FillDiffRoundRectGeometry
FillDiffRoundRectGeometry(const RoundRect &outer, const RoundRect &inner)
Definition: fill_path_geometry.cc:110
impeller::FillPathFromSourceGeometry
A Geometry that produces fillable vertices from a |PathSource| object using the |FillPathSourceGeomet...
Definition: fill_path_geometry.h:54
impeller::FillPathFromSourceGeometry::FillPathFromSourceGeometry
FillPathFromSourceGeometry(const PathSource &source)
Definition: fill_path_geometry.cc:95
impeller::FillPathFromSourceGeometry::GetSource
const PathSource & GetSource() const override
Definition: fill_path_geometry.cc:98
impeller::FillPathGeometry
A Geometry that produces fillable vertices from a |DlPath| object using the |FillPathSourceGeometry| ...
Definition: fill_path_geometry.h:68
impeller::FillPathGeometry::FillPathGeometry
FillPathGeometry(const flutter::DlPath &path, std::optional< Rect > inner_rect=std::nullopt)
Definition: fill_path_geometry.cc:102
impeller::FillPathGeometry::GetSource
const PathSource & GetSource() const override
Definition: fill_path_geometry.cc:106
impeller::FillPathSourceGeometry
An abstract Geometry base class that produces fillable vertices for the interior of any |PathSource| ...
Definition: fill_path_geometry.h:19
impeller::FillPathSourceGeometry::FillPathSourceGeometry
FillPathSourceGeometry(std::optional< Rect > inner_rect)
Definition: fill_path_geometry.cc:15
impeller::FillPathSourceGeometry::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: fill_path_geometry.cc:83
impeller::FillPathSourceGeometry::GetSource
virtual const PathSource & GetSource() const =0
impeller::FillPathSourceGeometry::~FillPathSourceGeometry
~FillPathSourceGeometry() override
Definition: fill_path_geometry.cc:18
impeller::Geometry
Definition: geometry.h:50
impeller::PathSource
Definition: path_source.h:55
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:312
geometry.h
impeller
Definition: allocation.cc:12
impeller::DlPath
flutter::DlPath DlPath
Definition: dl_dispatcher.h:29
rect.h
impeller::GeometryResult
Definition: geometry.h:21
impeller::GeometryResult::Mode
Mode
Definition: geometry.h:22
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::RoundRect
Definition: round_rect.h:16
impeller::TRect< Scalar >