Flutter Impeller
impeller::ShadowPathGeometry Class Reference

#include <shadow_path_geometry.h>

Public Member Functions

 ShadowPathGeometry (Tessellator &tessellator, const Matrix &matrix, const PathSource &source, Scalar occluder_height)
 
bool CanRender () const
 
bool IsEmpty () const
 Returns true if this shadow has no effect, is not visible. More...
 
const std::shared_ptr< ShadowVertices > & GetShadowVertices () const
 
const std::shared_ptr< ShadowVerticesTakeShadowVertices ()
 

Static Public Member Functions

static std::shared_ptr< ShadowVerticesMakeAmbientShadowVertices (Tessellator &tessellator, const PathSource &source, Scalar occluder_height, const Matrix &matrix)
 

Detailed Description

A class to compute and return the |ShadowVertices| for a path source viewed under a given transform. The |occluder_height| is measured in device pixels. The geometry of the |PathSource| is transformed by the indicated matrix to produce a device space set of vertices, and the shadow mesh is inset and outset by the indicated |occluder_height| without any adjustment for the matrix. The results are un-transformed and returned back iin the |ShadowVertices| in the original coordinate system.

Definition at line 80 of file shadow_path_geometry.h.

Constructor & Destructor Documentation

◆ ShadowPathGeometry()

impeller::ShadowPathGeometry::ShadowPathGeometry ( Tessellator tessellator,
const Matrix matrix,
const PathSource source,
Scalar  occluder_height 
)

Definition at line 1389 of file shadow_path_geometry.cc.

1393  : shadow_vertices_(MakeAmbientShadowVertices(tessellator,
1394  source,
1395  occluder_height,
1396  matrix)) {}
static std::shared_ptr< ShadowVertices > MakeAmbientShadowVertices(Tessellator &tessellator, const PathSource &source, Scalar occluder_height, const Matrix &matrix)

Member Function Documentation

◆ CanRender()

bool impeller::ShadowPathGeometry::CanRender ( ) const

Definition at line 1398 of file shadow_path_geometry.cc.

1398  {
1399  return shadow_vertices_ != nullptr;
1400 }

◆ GetShadowVertices()

const std::shared_ptr< ShadowVertices > & impeller::ShadowPathGeometry::GetShadowVertices ( ) const

Returns a reference to the generated vertices, or null if the algorithm failed to produce a mesh.

Definition at line 1406 of file shadow_path_geometry.cc.

1407  {
1408  return shadow_vertices_;
1409 }

◆ IsEmpty()

bool impeller::ShadowPathGeometry::IsEmpty ( ) const

Returns true if this shadow has no effect, is not visible.

Definition at line 1402 of file shadow_path_geometry.cc.

1402  {
1403  return shadow_vertices_ != nullptr && shadow_vertices_->IsEmpty();
1404 }

◆ MakeAmbientShadowVertices()

std::shared_ptr< ShadowVertices > impeller::ShadowPathGeometry::MakeAmbientShadowVertices ( Tessellator tessellator,
const PathSource source,
Scalar  occluder_height,
const Matrix matrix 
)
static

Constructs a shadow mesh for the given |PathSource| at the given |matrix| and with the indicated device-space |occluder_height|. The tessellator is used to get a cached set of |Trigs| for the radii associated with the mesh around various corners in the path.

Definition at line 1454 of file shadow_path_geometry.cc.

1458  {
1459  Scalar trig_radius = PolygonInfo::GetTrigRadiusForHeight(occluder_height);
1460  Tessellator::Trigs trigs = tessellator.GetTrigsForDeviceRadius(trig_radius);
1461 
1462  PolygonInfo polygon(occluder_height);
1463 
1464  return polygon.CalculateConvexShadowMesh(source, matrix, trigs);
1465 }
float Scalar
Definition: scalar.h:19

References impeller::Tessellator::GetTrigsForDeviceRadius().

Referenced by impeller::BM_ShadowPathVerticesImpeller(), and impeller::testing::TEST().

◆ TakeShadowVertices()

const std::shared_ptr< ShadowVertices > impeller::ShadowPathGeometry::TakeShadowVertices ( )

Takes (returns the only copy of via std::move) the shadow vertices or null if the algorithm failed to produce a mesh.

Definition at line 1411 of file shadow_path_geometry.cc.

1411  {
1412  return std::move(shadow_vertices_);
1413 }

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