| 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 #pragma once
6
7 #include "impeller/entity/geometry/geometry.h"
8
9 namespace impeller {
10
11 /// @brief A geometry that is created from a stroked path object.
12 class StrokePathGeometry : public Geometry {
13 public:
14 StrokePathGeometry(const Path& path,
15 Scalar stroke_width,
16 Scalar miter_limit,
17 Cap stroke_cap,
18 Join stroke_join);
19
20 ~StrokePathGeometry();
21
22 Scalar GetStrokeWidth() const;
23
24 Scalar GetMiterLimit() const;
25
26 Cap GetStrokeCap() const;
27
28 Join GetStrokeJoin() const;
29
30 private:
31 using VS = SolidFillVertexShader;
32
33 using CapProc =
34 std::function<void(VertexBufferBuilder<VS::PerVertexData>& vtx_builder,
35 const Point& position,
36 const Point& offset,
37 Scalar scale,
38 bool reverse)>;
39 using JoinProc =
40 std::function<void(VertexBufferBuilder<VS::PerVertexData>& vtx_builder,
41 const Point& position,
42 const Point& start_offset,
43 const Point& end_offset,
44 Scalar miter_limit,
45 Scalar scale)>;
46
47 // |Geometry|
48 GeometryResult GetPositionBuffer(const ContentContext& renderer,
49 const Entity& entity,
50 RenderPass& pass) override;
51
52 // |Geometry|
53 GeometryResult GetPositionUVBuffer(Rect texture_coverage,
54 Matrix effect_transform,
55 const ContentContext& renderer,
56 const Entity& entity,
57 RenderPass& pass) override;
58
59 // |Geometry|
60 GeometryVertexType GetVertexType() const override;
61
62 // |Geometry|
63 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
64
65 bool SkipRendering() const;
66
67 static Scalar CreateBevelAndGetDirection(
68 VertexBufferBuilder<SolidFillVertexShader::PerVertexData>& vtx_builder,
69 const Point& position,
70 const Point& start_offset,
71 const Point& end_offset);
72
73 static VertexBufferBuilder<SolidFillVertexShader::PerVertexData>
74 CreateSolidStrokeVertices(const Path& path,
75 Scalar stroke_width,
76 Scalar scaled_miter_limit,
77 const JoinProc& join_proc,
78 const CapProc& cap_proc,
79 Scalar scale);
80
81 static StrokePathGeometry::JoinProc GetJoinProc(Join stroke_join);
82
83 static StrokePathGeometry::CapProc GetCapProc(Cap stroke_cap);
84
85 Path path_;
86 Scalar stroke_width_;
87 Scalar miter_limit_;
88 Cap stroke_cap_;
89 Join stroke_join_;
90
91 FML_DISALLOW_COPY_AND_ASSIGN(StrokePathGeometry);
92 };
93
94 } // namespace impeller
impeller::Scalar
float Scalar
Definition: scalar.h:15
impeller::StrokePathGeometry::~StrokePathGeometry
~StrokePathGeometry()
impeller::GeometryVertexType
GeometryVertexType
Definition: geometry.h:25
impeller::StrokePathGeometry::StrokePathGeometry
StrokePathGeometry(const Path &path, Scalar stroke_width, Scalar miter_limit, Cap stroke_cap, Join stroke_join)
Definition: stroke_path_geometry.cc:11
impeller::StrokePathGeometry
A geometry that is created from a stroked path object.
Definition: stroke_path_geometry.h:12
impeller::Entity
Definition: entity.h:21
impeller::Path
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:54
impeller::VertexBufferBuilder
Definition: vertex_buffer_builder.h:23
impeller::StrokePathGeometry::GetMiterLimit
Scalar GetMiterLimit() const
Definition: stroke_path_geometry.cc:28
geometry.h
impeller::GeometryResult
Definition: geometry.h:18
impeller::StrokePathGeometry::GetStrokeCap
Cap GetStrokeCap() const
Definition: stroke_path_geometry.cc:32
impeller::StrokePathGeometry::GetStrokeJoin
Join GetStrokeJoin() const
Definition: stroke_path_geometry.cc:36
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:27
impeller::Geometry
Definition: geometry.h:54
impeller::Join
Join
Definition: path.h:23
impeller::TPoint< Scalar >
impeller
Definition: aiks_context.cc:10
impeller::ContentContext
Definition: content_context.h:344
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:36
impeller::StrokePathGeometry::GetStrokeWidth
Scalar GetStrokeWidth() const
Definition: stroke_path_geometry.cc:24
impeller::Cap
Cap
Definition: path.h:17