| Flutter Impeller |

stroke_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_STROKE_PATH_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_STROKE_PATH_GEOMETRY_H_
7
8 #include "impeller/entity/geometry/geometry.h"
9 #include "impeller/geometry/matrix.h"
10
11 namespace impeller {
12
13 /// @brief A geometry that is created from a stroked path object.
14 class StrokePathGeometry final : public Geometry {
15 public:
16 StrokePathGeometry(const Path& path,
17 Scalar stroke_width,
18 Scalar miter_limit,
19 Cap stroke_cap,
20 Join stroke_join);
21
22 ~StrokePathGeometry() override;
23
24 Scalar GetStrokeWidth() const;
25
26 Scalar GetMiterLimit() const;
27
28 Cap GetStrokeCap() const;
29
30 Join GetStrokeJoin() const;
31
32 Scalar ComputeAlphaCoverage(const Matrix& transform) const override;
33
34 private:
35 // |Geometry|
36 GeometryResult GetPositionBuffer(const ContentContext& renderer,
37 const Entity& entity,
38 RenderPass& pass) const override;
39
40 // |Geometry|
41 GeometryResult::Mode GetResultMode() const override;
42
43 // |Geometry|
44 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
45
46 // Private for benchmarking and debugging
47 static std::vector<Point> GenerateSolidStrokeVertices(
48 const Path::Polyline& polyline,
49 Scalar stroke_width,
50 Scalar miter_limit,
51 Join stroke_join,
52 Cap stroke_cap,
53 Scalar scale);
54
55 friend class ImpellerBenchmarkAccessor;
56 friend class ImpellerEntityUnitTestAccessor;
57
58 bool SkipRendering() const;
59
60 Path path_;
61 Scalar stroke_width_;
62 Scalar miter_limit_;
63 Cap stroke_cap_;
64 Join stroke_join_;
65
66 StrokePathGeometry(const StrokePathGeometry&) = delete;
67
68 StrokePathGeometry& operator=(const StrokePathGeometry&) = delete;
69 };
70
71 } // namespace impeller
72
73 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_STROKE_PATH_GEOMETRY_H_
impeller::ContentContext
Definition: content_context.h:138
impeller::Entity
Definition: entity.h:20
impeller::Geometry
Definition: geometry.h:50
impeller::ImpellerBenchmarkAccessor
Definition: geometry_benchmarks.cc:14
impeller::ImpellerEntityUnitTestAccessor
Definition: geometry_unittests.cc:55
impeller::Path
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:54
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
impeller::StrokePathGeometry
A geometry that is created from a stroked path object.
Definition: stroke_path_geometry.h:14
impeller::StrokePathGeometry::GetStrokeCap
Cap GetStrokeCap() const
Definition: stroke_path_geometry.cc:567
impeller::StrokePathGeometry::~StrokePathGeometry
~StrokePathGeometry() override
impeller::StrokePathGeometry::GetMiterLimit
Scalar GetMiterLimit() const
Definition: stroke_path_geometry.cc:563
impeller::StrokePathGeometry::GetStrokeWidth
Scalar GetStrokeWidth() const
Definition: stroke_path_geometry.cc:559
impeller::StrokePathGeometry::StrokePathGeometry
StrokePathGeometry(const Path &path, Scalar stroke_width, Scalar miter_limit, Cap stroke_cap, Join stroke_join)
Definition: stroke_path_geometry.cc:546
impeller::StrokePathGeometry::ComputeAlphaCoverage
Scalar ComputeAlphaCoverage(const Matrix &transform) const override
Definition: stroke_path_geometry.cc:575
impeller::StrokePathGeometry::GetStrokeJoin
Join GetStrokeJoin() const
Definition: stroke_path_geometry.cc:571
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214
geometry.h
matrix.h
impeller
Definition: allocation.cc:12
impeller::Join
Join
Definition: path.h:26
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::Cap
Cap
Definition: path.h:20
stroke_width
const Scalar stroke_width
Definition: stroke_path_geometry.cc:315
scale
const Scalar scale
Definition: stroke_path_geometry.cc:319
polyline
const Path::Polyline & polyline
Definition: stroke_path_geometry.cc:314
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::Path::Polyline
Definition: path.h:146