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 
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,
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<SolidFillVertexShader::PerVertexData>
48  GenerateSolidStrokeVertices(const Path::Polyline& polyline,
50  Scalar miter_limit,
51  Join stroke_join,
52  Cap stroke_cap,
53  Scalar scale);
54 
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::StrokePathGeometry::~StrokePathGeometry
~StrokePathGeometry() override
polyline
const Path::Polyline & polyline
Definition: stroke_path_geometry.cc:296
impeller::Scalar
float Scalar
Definition: scalar.h:18
geometry.h
stroke_width
const Scalar stroke_width
Definition: stroke_path_geometry.cc:297
impeller::ImpellerEntityUnitTestAccessor
Definition: geometry_unittests.cc:54
impeller::GeometryResult::Mode
Mode
Definition: geometry.h:27
impeller::StrokePathGeometry::StrokePathGeometry
StrokePathGeometry(const Path &path, Scalar stroke_width, Scalar miter_limit, Cap stroke_cap, Join stroke_join)
Definition: stroke_path_geometry.cc:532
matrix.h
impeller::StrokePathGeometry
A geometry that is created from a stroked path object.
Definition: stroke_path_geometry.h:14
impeller::Path::Polyline
Definition: path.h:110
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:213
impeller::StrokePathGeometry::GetMiterLimit
Scalar GetMiterLimit() const
Definition: stroke_path_geometry.cc:549
impeller::StrokePathGeometry::ComputeAlphaCoverage
Scalar ComputeAlphaCoverage(const Matrix &transform) const override
Definition: stroke_path_geometry.cc:561
impeller::GeometryResult
Definition: geometry.h:26
impeller::StrokePathGeometry::GetStrokeCap
Cap GetStrokeCap() const
Definition: stroke_path_geometry.cc:553
impeller::StrokePathGeometry::GetStrokeJoin
Join GetStrokeJoin() const
Definition: stroke_path_geometry.cc:557
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:55
impeller::Join
Join
Definition: path.h:24
scale
const Scalar scale
Definition: stroke_path_geometry.cc:301
impeller
Definition: allocation.cc:12
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:545
impeller::Cap
Cap
Definition: path.h:18