Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
impeller::Geometry Class Referenceabstract

#include <geometry.h>

Inheritance diagram for impeller::Geometry:
impeller::CircleGeometry impeller::CoverGeometry impeller::EllipseGeometry impeller::FillPathGeometry impeller::LineGeometry impeller::PointFieldGeometry impeller::RectGeometry impeller::RoundRectGeometry impeller::StrokePathGeometry impeller::VerticesGeometry

Public Member Functions

virtual GeometryResult GetPositionBuffer (const ContentContext &renderer, const Entity &entity, RenderPass &pass) const =0
 
virtual GeometryResult::Mode GetResultMode () const
 
virtual std::optional< RectGetCoverage (const Matrix &transform) const =0
 
virtual bool CoversArea (const Matrix &transform, const Rect &rect) const
 Determines if this geometry, transformed by the given transform, will completely cover all surface area of the given rect. More...
 
virtual bool IsAxisAlignedRect () const
 
virtual bool CanApplyMaskFilter () const
 
virtual Scalar ComputeAlphaCoverage (const Entity &entitys) const
 

Static Public Member Functions

static std::shared_ptr< GeometryMakeFillPath (const Path &path, std::optional< Rect > inner_rect=std::nullopt)
 
static std::shared_ptr< GeometryMakeStrokePath (const Path &path, Scalar stroke_width=0.0, Scalar miter_limit=4.0, Cap stroke_cap=Cap::kButt, Join stroke_join=Join::kMiter)
 
static std::shared_ptr< GeometryMakeCover ()
 
static std::shared_ptr< GeometryMakeRect (const Rect &rect)
 
static std::shared_ptr< GeometryMakeOval (const Rect &rect)
 
static std::shared_ptr< GeometryMakeLine (const Point &p0, const Point &p1, Scalar width, Cap cap)
 
static std::shared_ptr< GeometryMakeCircle (const Point &center, Scalar radius)
 
static std::shared_ptr< GeometryMakeStrokedCircle (const Point &center, Scalar radius, Scalar stroke_width)
 
static std::shared_ptr< GeometryMakeRoundRect (const Rect &rect, const Size &radii)
 
static std::shared_ptr< GeometryMakePointField (std::vector< Point > points, Scalar radius, bool round)
 

Static Protected Member Functions

static GeometryResult ComputePositionGeometry (const ContentContext &renderer, const Tessellator::VertexGenerator &generator, const Entity &entity, RenderPass &pass)
 

Detailed Description

Definition at line 48 of file geometry.h.

Member Function Documentation

◆ CanApplyMaskFilter()

bool impeller::Geometry::CanApplyMaskFilter ( ) const
virtual

Reimplemented in impeller::CoverGeometry.

Definition at line 128 of file geometry.cc.

128 {
129 return true;
130}

◆ ComputeAlphaCoverage()

virtual Scalar impeller::Geometry::ComputeAlphaCoverage ( const Entity entitys) const
inlinevirtual

Reimplemented in impeller::StrokePathGeometry.

Definition at line 110 of file geometry.h.

110 {
111 return 1.0;
112 }

◆ ComputePositionGeometry()

GeometryResult impeller::Geometry::ComputePositionGeometry ( const ContentContext renderer,
const Tessellator::VertexGenerator generator,
const Entity entity,
RenderPass pass 
)
staticprotected

Definition at line 24 of file geometry.cc.

28 {
29 using VT = SolidFillVertexShader::PerVertexData;
30
31 size_t count = generator.GetVertexCount();
32
33 return GeometryResult{
34 .type = generator.GetTriangleType(),
35 .vertex_buffer =
36 {
37 .vertex_buffer = renderer.GetTransientsBuffer().Emplace(
38 count * sizeof(VT), alignof(VT),
39 [&generator](uint8_t* buffer) {
40 auto vertices = reinterpret_cast<VT*>(buffer);
41 generator.GenerateVertices([&vertices](const Point& p) {
42 *vertices++ = {
43 .position = p,
44 };
45 });
46 FML_DCHECK(vertices == reinterpret_cast<VT*>(buffer) +
47 generator.GetVertexCount());
48 }),
49 .vertex_count = count,
50 .index_type = IndexType::kNone,
51 },
52 .transform = entity.GetShaderTransform(pass),
53 };
54}
int count
Definition: FontMgrTest.cpp:50
#define FML_DCHECK(condition)
Definition: logging.h:103
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
@ kNone
Does not use the index buffer.
TPoint< Scalar > Point
Definition: point.h:322

◆ CoversArea()

bool impeller::Geometry::CoversArea ( const Matrix transform,
const Rect rect 
) const
virtual

Determines if this geometry, transformed by the given transform, will completely cover all surface area of the given rect.

This is a conservative estimate useful for certain optimizations.

Returns
true if the transformed geometry is guaranteed to cover the given rect. May return false in many undetected cases where the transformed geometry does in fact cover the rect.

Reimplemented in impeller::CircleGeometry, impeller::CoverGeometry, impeller::EllipseGeometry, impeller::FillPathGeometry, impeller::LineGeometry, impeller::RectGeometry, and impeller::RoundRectGeometry.

Definition at line 120 of file geometry.cc.

120 {
121 return false;
122}

◆ GetCoverage()

virtual std::optional< Rect > impeller::Geometry::GetCoverage ( const Matrix transform) const
pure virtual

◆ GetPositionBuffer()

virtual GeometryResult impeller::Geometry::GetPositionBuffer ( const ContentContext renderer,
const Entity entity,
RenderPass pass 
) const
pure virtual

◆ GetResultMode()

GeometryResult::Mode impeller::Geometry::GetResultMode ( ) const
virtual

Definition at line 56 of file geometry.cc.

56 {
58}
@ kNormal
The geometry has no overlapping triangles.

◆ IsAxisAlignedRect()

bool impeller::Geometry::IsAxisAlignedRect ( ) const
virtual

Reimplemented in impeller::CircleGeometry, impeller::EllipseGeometry, impeller::LineGeometry, impeller::RectGeometry, and impeller::RoundRectGeometry.

Definition at line 124 of file geometry.cc.

124 {
125 return false;
126}

◆ MakeCircle()

std::shared_ptr< Geometry > impeller::Geometry::MakeCircle ( const Point center,
Scalar  radius 
)
static

Definition at line 104 of file geometry.cc.

105 {
106 return std::make_shared<CircleGeometry>(center, radius);
107}

◆ MakeCover()

std::shared_ptr< Geometry > impeller::Geometry::MakeCover ( )
static

Definition at line 85 of file geometry.cc.

85 {
86 return std::make_shared<CoverGeometry>();
87}

◆ MakeFillPath()

std::shared_ptr< Geometry > impeller::Geometry::MakeFillPath ( const Path path,
std::optional< Rect inner_rect = std::nullopt 
)
static

Definition at line 60 of file geometry.cc.

62 {
63 return std::make_shared<FillPathGeometry>(path, inner_rect);
64}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ MakeLine()

std::shared_ptr< Geometry > impeller::Geometry::MakeLine ( const Point p0,
const Point p1,
Scalar  width,
Cap  cap 
)
static

Definition at line 97 of file geometry.cc.

100 {
101 return std::make_shared<LineGeometry>(p0, p1, width, cap);
102}
int32_t width

◆ MakeOval()

std::shared_ptr< Geometry > impeller::Geometry::MakeOval ( const Rect rect)
static

Definition at line 93 of file geometry.cc.

93 {
94 return std::make_shared<EllipseGeometry>(rect);
95}
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ MakePointField()

std::shared_ptr< Geometry > impeller::Geometry::MakePointField ( std::vector< Point points,
Scalar  radius,
bool  round 
)
static

Definition at line 66 of file geometry.cc.

68 {
69 return std::make_shared<PointFieldGeometry>(std::move(points), radius, round);
70}
static void round(SkPoint *p)
static const int points[]

◆ MakeRect()

std::shared_ptr< Geometry > impeller::Geometry::MakeRect ( const Rect rect)
static

Definition at line 89 of file geometry.cc.

89 {
90 return std::make_shared<RectGeometry>(rect);
91}

◆ MakeRoundRect()

std::shared_ptr< Geometry > impeller::Geometry::MakeRoundRect ( const Rect rect,
const Size radii 
)
static

Definition at line 115 of file geometry.cc.

116 {
117 return std::make_shared<RoundRectGeometry>(rect, radii);
118}

◆ MakeStrokedCircle()

std::shared_ptr< Geometry > impeller::Geometry::MakeStrokedCircle ( const Point center,
Scalar  radius,
Scalar  stroke_width 
)
static

Definition at line 109 of file geometry.cc.

111 {
112 return std::make_shared<CircleGeometry>(center, radius, stroke_width);
113}
const Scalar stroke_width

◆ MakeStrokePath()

std::shared_ptr< Geometry > impeller::Geometry::MakeStrokePath ( const Path path,
Scalar  stroke_width = 0.0,
Scalar  miter_limit = 4.0,
Cap  stroke_cap = Cap::kButt,
Join  stroke_join = Join::kMiter 
)
static

Definition at line 72 of file geometry.cc.

76 {
77 // Skia behaves like this.
78 if (miter_limit < 0) {
79 miter_limit = 4.0;
80 }
81 return std::make_shared<StrokePathGeometry>(path, stroke_width, miter_limit,
82 stroke_cap, stroke_join);
83}

The documentation for this class was generated from the following files: