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