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<Point> GenerateSolidStrokeVertices(
48  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_
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:54
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
A geometry that is created from a stroked path object.
StrokePathGeometry(const Path &path, Scalar stroke_width, Scalar miter_limit, Cap stroke_cap, Join stroke_join)
Scalar ComputeAlphaCoverage(const Matrix &transform) const override
Join
Definition: path.h:26
float Scalar
Definition: scalar.h:18
Cap
Definition: path.h:20
const Scalar stroke_width
const Scalar scale
const Path::Polyline & polyline
A 4x4 matrix using column-major storage.
Definition: matrix.h:37