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 
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,
17  Scalar miter_limit,
18  Cap stroke_cap,
19  Join stroke_join);
20 
22 
23  Scalar GetStrokeWidth() const;
24 
25  Scalar GetMiterLimit() const;
26 
27  Cap GetStrokeCap() const;
28 
29  Join GetStrokeJoin() const;
30 
31  private:
32  // |Geometry|
33  GeometryResult GetPositionBuffer(const ContentContext& renderer,
34  const Entity& entity,
35  RenderPass& pass) const override;
36 
37  // |Geometry|
38  GeometryResult GetPositionUVBuffer(Rect texture_coverage,
39  Matrix effect_transform,
40  const ContentContext& renderer,
41  const Entity& entity,
42  RenderPass& pass) const override;
43 
44  // |Geometry|
45  GeometryResult::Mode GetResultMode() const override;
46 
47  // |Geometry|
48  GeometryVertexType GetVertexType() const override;
49 
50  // |Geometry|
51  std::optional<Rect> GetCoverage(const Matrix& transform) const override;
52 
53  // Private for benchmarking and debugging
54  static std::vector<SolidFillVertexShader::PerVertexData>
55  GenerateSolidStrokeVertices(const Path::Polyline& polyline,
57  Scalar miter_limit,
58  Join stroke_join,
59  Cap stroke_cap,
60  Scalar scale);
61 
62  static std::vector<TextureFillVertexShader::PerVertexData>
63  GenerateSolidStrokeVerticesUV(const Path::Polyline& polyline,
65  Scalar miter_limit,
66  Join stroke_join,
67  Cap stroke_cap,
68  Scalar scale,
69  Point texture_origin,
70  Size texture_size,
71  const Matrix& effect_transform);
72 
75 
76  bool SkipRendering() const;
77 
78  Path path_;
79  Scalar stroke_width_;
80  Scalar miter_limit_;
81  Cap stroke_cap_;
82  Join stroke_join_;
83 
84  StrokePathGeometry(const StrokePathGeometry&) = delete;
85 
86  StrokePathGeometry& operator=(const StrokePathGeometry&) = delete;
87 };
88 
89 } // namespace impeller
90 
91 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_STROKE_PATH_GEOMETRY_H_
polyline
const Path::Polyline & polyline
Definition: stroke_path_geometry.cc:292
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::StrokePathGeometry::~StrokePathGeometry
~StrokePathGeometry()
stroke_width
const Scalar stroke_width
Definition: stroke_path_geometry.cc:293
impeller::ImpellerEntityUnitTestAccessor
Definition: geometry_unittests.cc:52
impeller::GeometryVertexType
GeometryVertexType
Definition: geometry.h:49
impeller::GeometryResult::Mode
Mode
Definition: geometry.h:21
impeller::StrokePathGeometry::StrokePathGeometry
StrokePathGeometry(const Path &path, Scalar stroke_width, Scalar miter_limit, Cap stroke_cap, Join stroke_join)
Definition: stroke_path_geometry.cc:549
impeller::StrokePathGeometry
A geometry that is created from a stroked path object.
Definition: stroke_path_geometry.h:13
impeller::Path::Polyline
Definition: path.h:94
impeller::Entity
Definition: entity.h:21
impeller::TSize< Scalar >
impeller::Path
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:51
impeller::StrokePathGeometry::GetMiterLimit
Scalar GetMiterLimit() const
Definition: stroke_path_geometry.cc:566
geometry.h
impeller::GeometryResult
Definition: geometry.h:20
impeller::StrokePathGeometry::GetStrokeCap
Cap GetStrokeCap() const
Definition: stroke_path_geometry.cc:570
impeller::StrokePathGeometry::GetStrokeJoin
Join GetStrokeJoin() const
Definition: stroke_path_geometry.cc:574
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:83
impeller::Join
Join
Definition: path.h:23
impeller::TPoint< Scalar >
scale
const Scalar scale
Definition: stroke_path_geometry.cc:297
impeller
Definition: aiks_blur_unittests.cc:20
impeller::ContentContext
Definition: content_context.h:392
impeller::TRect< Scalar >
impeller::ImpellerBenchmarkAccessor
Definition: geometry_benchmarks.cc:17
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::StrokePathGeometry::GetStrokeWidth
Scalar GetStrokeWidth() const
Definition: stroke_path_geometry.cc:562
impeller::Cap
Cap
Definition: path.h:17