Flutter Impeller
line_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_LINE_GEOMETRY_H_
6
#define FLUTTER_IMPELLER_ENTITY_GEOMETRY_LINE_GEOMETRY_H_
7
8
#include <type_traits>
9
#include "
impeller/entity/geometry/geometry.h
"
10
11
namespace
impeller
{
12
13
class
LineGeometry
final :
public
Geometry
{
14
public
:
15
explicit
LineGeometry
(
Point
p0,
Point
p1,
Scalar
width,
Cap
cap);
16
17
~LineGeometry
() =
default
;
18
19
static
Scalar
ComputePixelHalfWidth
(
const
Matrix
& transform,
Scalar
width);
20
21
// |Geometry|
22
bool
CoversArea
(
const
Matrix
& transform,
const
Rect
& rect)
const override
;
23
24
// |Geometry|
25
bool
IsAxisAlignedRect
()
const override
;
26
27
private
:
28
// Computes the 4 corners of a rectangle that defines the line and
29
// possibly extended endpoints which will be rendered under the given
30
// transform, and returns true if such a rectangle is defined.
31
//
32
// The coordinates will be generated in the original coordinate system
33
// of the line end points and the transform will only be used to determine
34
// the minimum line width.
35
//
36
// For kButt and kSquare end caps the ends should always be exteded as
37
// per that decoration, but for kRound caps the ends might be extended
38
// if the goal is to get a conservative bounds and might not be extended
39
// if the calling code is planning to draw the round caps on the ends.
40
//
41
// @return true if the transform and width were not degenerate
42
bool
ComputeCorners(
Point
corners[4],
43
const
Matrix
& transform,
44
bool
extend_endpoints)
const
;
45
46
Vector2
ComputeAlongVector(
const
Matrix
& transform,
47
bool
allow_zero_length)
const
;
48
49
// |Geometry|
50
GeometryResult
GetPositionBuffer(
const
ContentContext
& renderer,
51
const
Entity
& entity,
52
RenderPass
& pass)
const override
;
53
54
// |Geometry|
55
GeometryVertexType
GetVertexType()
const override
;
56
57
// |Geometry|
58
std::optional<Rect> GetCoverage(
const
Matrix
& transform)
const override
;
59
60
// |Geometry|
61
GeometryResult
GetPositionUVBuffer(
Rect
texture_coverage,
62
Matrix
effect_transform,
63
const
ContentContext
& renderer,
64
const
Entity
& entity,
65
RenderPass
& pass)
const override
;
66
67
Point
p0_;
68
Point
p1_;
69
Scalar
width_;
70
Cap
cap_;
71
72
LineGeometry
(
const
LineGeometry
&) =
delete
;
73
74
LineGeometry
& operator=(
const
LineGeometry
&) =
delete
;
75
};
76
77
static_assert(std::is_trivially_destructible<LineGeometry>::value);
78
79
}
// namespace impeller
80
81
#endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_LINE_GEOMETRY_H_
impeller::Scalar
float Scalar
Definition:
scalar.h:18
impeller::LineGeometry::LineGeometry
LineGeometry(Point p0, Point p1, Scalar width, Cap cap)
Definition:
line_geometry.cc:9
impeller::GeometryVertexType
GeometryVertexType
Definition:
geometry.h:49
impeller::Entity
Definition:
entity.h:21
impeller::LineGeometry::CoversArea
bool CoversArea(const Matrix &transform, const Rect &rect) const override
Determines if this geometry, transformed by the given transform, will completely cover all surface ar...
Definition:
line_geometry.cc:179
impeller::LineGeometry
Definition:
line_geometry.h:13
geometry.h
impeller::GeometryResult
Definition:
geometry.h:20
impeller::LineGeometry::IsAxisAlignedRect
bool IsAxisAlignedRect() const override
Definition:
line_geometry.cc:187
impeller::LineGeometry::ComputePixelHalfWidth
static Scalar ComputePixelHalfWidth(const Matrix &transform, Scalar width)
Definition:
line_geometry.cc:14
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::TPoint< Scalar >
impeller::LineGeometry::~LineGeometry
~LineGeometry()=default
impeller
Definition:
aiks_blur_unittests.cc:20
impeller::ContentContext
Definition:
content_context.h:392
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition:
matrix.h:37
impeller::Cap
Cap
Definition:
path.h:17
impeller
entity
geometry
line_geometry.h
Generated by
1.8.17