| 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 |DlPath| object
53 /// using the |FillPathSourceGeometry| base class and the inherent
54 /// ability for a |DlPath| object to perform path iteration.
55 class FillPathGeometry final : public FillPathSourceGeometry {
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.
70 class FillDiffRoundRectGeometry final : public FillPathSourceGeometry {
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_
impeller::ContentContext
Definition: content_context.h:138
impeller::DiffRoundRectPathSource
Definition: round_rect.h:173
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:70
impeller::FillDiffRoundRectGeometry::GetSource
const PathSource & GetSource() const override
Definition: fill_path_geometry.cc:107
impeller::FillDiffRoundRectGeometry::FillDiffRoundRectGeometry
FillDiffRoundRectGeometry(const RoundRect &outer, const RoundRect &inner)
Definition: fill_path_geometry.cc:103
impeller::FillPathGeometry
A Geometry that produces fillable vertices from a |DlPath| object using the |FillPathSourceGeometry| ...
Definition: fill_path_geometry.h:55
impeller::FillPathGeometry::FillPathGeometry
FillPathGeometry(const flutter::DlPath &path, std::optional< Rect > inner_rect=std::nullopt)
Definition: fill_path_geometry.cc:95
impeller::FillPathGeometry::GetSource
const PathSource & GetSource() const override
Definition: fill_path_geometry.cc:99
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:214
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 >