Flutter Impeller
impeller::Canvas::PathBlurShape Class Reference

Inherits impeller::Canvas::BlurShape.

Public Member Functions

 PathBlurShape (const PathSource &source[[clang::lifetimebound]], std::shared_ptr< ShadowVertices > shadow_vertices, Sigma sigma)
 
Rect GetBounds () const override
 
std::shared_ptr< SolidBlurContentsBuildBlurContent (Sigma sigma) override
 
const GeometryBuildDrawGeometry () override
 

Detailed Description

Definition at line 238 of file canvas.cc.

Constructor & Destructor Documentation

◆ PathBlurShape()

impeller::Canvas::PathBlurShape::PathBlurShape ( const PathSource &source]  [[clang::lifetimebound],
std::shared_ptr< ShadowVertices shadow_vertices,
Sigma  sigma 
)
inline

Construct a PathBlurShape from a path source, a set of shadow vertices (typically produced by ShadowPathGeometry) and the sigma that was used to generate the vertex mesh.

The sigma was already used to generate the shadow vertices, so it is provided here only to make sure it matches the sigma we will see in our BuildBlurContent method.

The source was used to generate the mesh and it might be used again for the SOLID mask operation so we save it here in case the mask rendering code calls our BuildDrawGeometry method. Its lifetime must survive the lifetime of this object, typically because the source object was stack allocated not long before this object is also being stack allocated.

Definition at line 254 of file canvas.cc.

257  : sigma_(sigma),
258  source_(source),
259  shadow_vertices_(std::move(shadow_vertices)) {}

Member Function Documentation

◆ BuildBlurContent()

std::shared_ptr<SolidBlurContents> impeller::Canvas::PathBlurShape::BuildBlurContent ( Sigma  sigma)
inlineoverride

Definition at line 265 of file canvas.cc.

265  {
266  // We have to use the sigma to generate the mesh up front in order to
267  // even know if we can perform the operation, but then the method that
268  // actually uses our contents informs us of the sigma, but it's too
269  // late to make use of it. Instead we remember what sigma we used and
270  // make sure they match.
271  FML_DCHECK(sigma_.sigma == sigma.sigma);
272  return ShadowVerticesContents::Make(shadow_vertices_);
273  }
static std::shared_ptr< ShadowVerticesContents > Make(const std::shared_ptr< ShadowVertices > &geometry)
Scalar sigma
Definition: sigma.h:33

References impeller::ShadowVerticesContents::Make(), and impeller::Sigma::sigma.

◆ BuildDrawGeometry()

const Geometry& impeller::Canvas::PathBlurShape::BuildDrawGeometry ( )
inlineoverride

Definition at line 275 of file canvas.cc.

275  {
276  return source_geometry_.emplace(source_);
277  }

◆ GetBounds()

Rect impeller::Canvas::PathBlurShape::GetBounds ( ) const
inlineoverride

Definition at line 261 of file canvas.cc.

261  {
262  return shadow_vertices_->GetBounds().value_or(Rect());
263  }
TRect< Scalar > Rect
Definition: rect.h:788

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