Flutter Impeller
impeller::ContentsFilterInput Class Referencefinal

#include <contents_filter_input.h>

Inheritance diagram for impeller::ContentsFilterInput:
impeller::FilterInput

Public Member Functions

 ~ContentsFilterInput () override
 
std::optional< SnapshotGetSnapshot (std::string_view label, const ContentContext &renderer, const Entity &entity, std::optional< Rect > coverage_limit, int32_t mip_count) const override
 
std::optional< RectGetCoverage (const Entity &entity) const override
 
- Public Member Functions inherited from impeller::FilterInput
virtual ~FilterInput ()
 
std::optional< RectGetLocalCoverage (const Entity &entity) const
 
virtual std::optional< RectGetSourceCoverage (const Matrix &effect_transform, const Rect &output_limit) const
 
virtual Matrix GetLocalTransform (const Entity &entity) const
 Get the local transform of this filter input. This transform is relative to the Entity transform space. More...
 
virtual Matrix GetTransform (const Entity &entity) const
 Get the transform of this FilterInput. This is equivalent to calling entity.GetTransform() * GetLocalTransform(). More...
 
virtual void SetEffectTransform (const Matrix &matrix)
 Sets the effect transform of filter inputs. More...
 
virtual void SetRenderingMode (Entity::RenderingMode rendering_mode)
 Turns on subpass mode for filter inputs. More...
 

Additional Inherited Members

- Public Types inherited from impeller::FilterInput
using Ref = std::shared_ptr< FilterInput >
 
using Vector = std::vector< FilterInput::Ref >
 
using Variant = std::variant< std::shared_ptr< FilterContents >, std::shared_ptr< Contents >, std::shared_ptr< Texture >, Rect >
 
- Static Public Member Functions inherited from impeller::FilterInput
static FilterInput::Ref Make (Variant input, bool msaa_enabled=true)
 
static FilterInput::Ref Make (std::shared_ptr< Texture > input, Matrix local_transform)
 
static FilterInput::Vector Make (std::initializer_list< Variant > inputs)
 

Detailed Description

Definition at line 12 of file contents_filter_input.h.

Constructor & Destructor Documentation

◆ ~ContentsFilterInput()

impeller::ContentsFilterInput::~ContentsFilterInput ( )
overridedefault

Member Function Documentation

◆ GetCoverage()

std::optional< Rect > impeller::ContentsFilterInput::GetCoverage ( const Entity entity) const
overridevirtual

Implements impeller::FilterInput.

Definition at line 40 of file contents_filter_input.cc.

41  {
42  return contents_->GetCoverage(entity);
43 }

◆ GetSnapshot()

std::optional< Snapshot > impeller::ContentsFilterInput::GetSnapshot ( std::string_view  label,
const ContentContext renderer,
const Entity entity,
std::optional< Rect coverage_limit,
int32_t  mip_count 
) const
overridevirtual

Evaluates the filter input and returns a snapshot of the result.

This method renders the input (which could be another filter, contents, or a texture) into a Snapshot object, which contains the resulting texture and its transform relative to the current render target.

Implementations are typically lazy and may cache the result, ensuring that the input is only rendered once even if GetSnapshot is called multiple times.

Parameters
[in]labelA debug label for the rendering operation and the resulting snapshot texture.
[in]rendererThe content context providing rendering resources.
[in]entityThe entity associated with this filter input, providing transform and other contextual information.
[in]coverage_limitAn optional rectangle to limit the area of the input that needs to be rendered. This can be used as an optimization.
[in]mip_countThe number of mip levels to generate for the snapshot texture. Defaults to 1 (no mips).
Returns
A Snapshot containing the rendered texture and its transform, or std::nullopt if the input cannot be rendered or results in an empty output.

Implements impeller::FilterInput.

Definition at line 18 of file contents_filter_input.cc.

23  {
24  if (!coverage_limit.has_value() && entity.GetContents()) {
25  coverage_limit = entity.GetContents()->GetCoverageHint();
26  }
27  if (!snapshot_.has_value()) {
28  snapshot_ = contents_->RenderToSnapshot(renderer, // renderer
29  entity, // entity
30  coverage_limit, // coverage_limit
31  std::nullopt, // sampler_descriptor
32  msaa_enabled_, // msaa_enabled
33  /*mip_count=*/mip_count, //
34  label //
35  );
36  }
37  return snapshot_;
38 }

References impeller::Entity::GetContents().


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