#include <tiled_texture_contents.h>
Public Types | |
using | ColorFilterProc = std::function< std::shared_ptr< ColorFilterContents >(FilterInput::Ref)> |
![]() | |
using | BindFragmentCallback = std::function< bool(RenderPass &pass)> |
using | PipelineBuilderCallback = std::function< PipelineRef(ContentContextOptions)> |
using | CreateGeometryCallback = std::function< GeometryResult(const ContentContext &renderer, const Entity &entity, RenderPass &pass, const Geometry *geom)> |
![]() | |
using | ColorFilterProc = std::function< Color(Color)> |
using | RenderProc = std::function< bool(const ContentContext &renderer, const Entity &entity, RenderPass &pass)> |
using | CoverageProc = std::function< std::optional< Rect >(const Entity &entity)> |
Public Member Functions | |
TiledTextureContents () | |
~TiledTextureContents () override | |
bool | IsOpaque (const Matrix &transform) const override |
Whether this Contents only emits opaque source colors from the fragment stage. This value does not account for any entity properties (e.g. the blend mode), clips/visibility culling, or inherited opacity. More... | |
bool | Render (const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override |
void | SetTexture (std::shared_ptr< Texture > texture) |
void | SetTileModes (Entity::TileMode x_tile_mode, Entity::TileMode y_tile_mode) |
void | SetSamplerDescriptor (const SamplerDescriptor &desc) |
void | SetColorFilter (ColorFilterProc color_filter) |
Set a color filter to apply directly to this tiled texture. More... | |
std::optional< Snapshot > | RenderToSnapshot (const ContentContext &renderer, const Entity &entity, std::optional< Rect > coverage_limit=std::nullopt, const std::optional< SamplerDescriptor > &sampler_descriptor=std::nullopt, bool msaa_enabled=true, int32_t mip_count=1, std::string_view label="Tiled Texture Snapshot") const override |
Render this contents to a snapshot, respecting the entity's transform, path, clip depth, and blend mode. The result texture size is always the size of GetCoverage(entity) . More... | |
![]() | |
ColorSourceContents () | |
~ColorSourceContents () override | |
void | SetGeometry (const Geometry *geometry) |
Set the geometry that this contents will use to render. More... | |
const Geometry * | GetGeometry () const |
Get the geometry that this contents will use to render. More... | |
void | SetEffectTransform (Matrix matrix) |
Set the effect transform for this color source. More... | |
const Matrix & | GetInverseEffectTransform () const |
Set the inverted effect transform for this color source. More... | |
void | SetOpacityFactor (Scalar opacity) |
Set the opacity factor for this color source. More... | |
Scalar | GetOpacityFactor () const |
Get the opacity factor for this color source. More... | |
virtual bool | IsSolidColor () const |
std::optional< Rect > | GetCoverage (const Entity &entity) const override |
Get the area of the render pass that will be affected when this contents is rendered. More... | |
void | SetInheritedOpacity (Scalar opacity) override |
Inherit the provided opacity. More... | |
![]() | |
Contents () | |
virtual | ~Contents () |
void | SetCoverageHint (std::optional< Rect > coverage_hint) |
Hint that specifies the coverage area of this Contents that will actually be used during rendering. This is for optimization purposes only and can not be relied on as a clip. May optionally affect the result of GetCoverage() . More... | |
const std::optional< Rect > & | GetCoverageHint () const |
std::optional< Size > | GetColorSourceSize () const |
Return the color source's intrinsic size, if available. More... | |
void | SetColorSourceSize (Size size) |
virtual std::optional< Color > | AsBackgroundColor (const Entity &entity, ISize target_size) const |
Returns a color if this Contents will flood the given target_size with a color. This output color is the "Source" color that will be used for the Entity's blend operation. More... | |
virtual bool | ApplyColorFilter (const ColorFilterProc &color_filter_proc) |
If possible, applies a color filter to this contents inputs on the CPU. More... | |
Additional Inherited Members | |
![]() | |
template<typename VertexShaderT > | |
static bool | DrawGeometry (const Contents *contents, const Geometry *geometry, const ContentContext &renderer, const Entity &entity, RenderPass &pass, const PipelineBuilderCallback &pipeline_callback, typename VertexShaderT::FrameInfo frame_info, const BindFragmentCallback &bind_fragment_callback, bool force_stencil=false, const CreateGeometryCallback &create_geom_callback=DefaultCreateGeometryCallback) |
![]() | |
static std::shared_ptr< Contents > | MakeAnonymous (RenderProc render_proc, CoverageProc coverage_proc) |
![]() | |
bool | AppliesAlphaForStrokeCoverage (const Matrix &transform) const |
Whether the entity should be treated as non-opaque due to stroke geometry requiring alpha for coverage. More... | |
template<typename VertexShaderT > | |
bool | DrawGeometry (const ContentContext &renderer, const Entity &entity, RenderPass &pass, const PipelineBuilderCallback &pipeline_callback, typename VertexShaderT::FrameInfo frame_info, const BindFragmentCallback &bind_fragment_callback, bool force_stencil=false, const CreateGeometryCallback &create_geom_callback=DefaultCreateGeometryCallback) const |
![]() | |
static GeometryResult | DefaultCreateGeometryCallback (const ContentContext &renderer, const Entity &entity, RenderPass &pass, const Geometry *geom) |
Definition at line 19 of file tiled_texture_contents.h.
using impeller::TiledTextureContents::ColorFilterProc = std::function<std::shared_ptr<ColorFilterContents>(FilterInput::Ref)> |
Definition at line 25 of file tiled_texture_contents.h.
|
default |
|
overridedefault |
|
overridevirtual |
Whether this Contents only emits opaque source colors from the fragment stage. This value does not account for any entity properties (e.g. the blend mode), clips/visibility culling, or inherited opacity.
transform | The current transform matrix of the entity that will render this contents. |
Reimplemented from impeller::Contents.
Definition at line 100 of file tiled_texture_contents.cc.
References impeller::ColorSourceContents::AppliesAlphaForStrokeCoverage(), impeller::ColorSourceContents::GetOpacityFactor(), impeller::Entity::kDecal, and transform.
Referenced by impeller::testing::TEST_P().
|
overridevirtual |
Implements impeller::Contents.
Definition at line 111 of file tiled_texture_contents.cc.
References impeller::Geometry::ComputeAlphaCoverage(), impeller::ContentContext::GetContext(), impeller::ContentContext::GetDeviceCapabilities(), impeller::ColorSourceContents::GetGeometry(), impeller::ColorSourceContents::GetInverseEffectTransform(), impeller::TRect< T >::GetNormalizingTransform(), impeller::ColorSourceContents::GetOpacityFactor(), impeller::ContentContext::GetTiledTexturePipeline(), impeller::Entity::GetTransform(), impeller::ContentContext::GetTransientsBuffer(), impeller::SamplerDescriptor::height_address_mode, impeller::kBase, impeller::kClampToEdge, impeller::kTextureExternalOES, impeller::SamplerDescriptor::mag_filter, impeller::TRect< Scalar >::MakeSize(), impeller::SamplerDescriptor::min_filter, impeller::SamplerDescriptor::mip_filter, impeller::RenderPass::SetCommandLabel(), and impeller::SamplerDescriptor::width_address_mode.
Referenced by impeller::testing::TEST_P().
|
overridevirtual |
Render this contents to a snapshot, respecting the entity's transform, path, clip depth, and blend mode. The result texture size is always the size of GetCoverage(entity)
.
Reimplemented from impeller::Contents.
Definition at line 216 of file tiled_texture_contents.cc.
References impeller::TRect< T >::Contains(), impeller::ColorSourceContents::GetCoverage(), impeller::Geometry::GetCoverage(), impeller::ColorSourceContents::GetGeometry(), impeller::ColorSourceContents::GetInverseEffectTransform(), impeller::ColorSourceContents::GetOpacityFactor(), impeller::Matrix::MakeScale(), impeller::TRect< Scalar >::MakeSize(), impeller::Matrix::MakeTranslation(), impeller::Contents::RenderToSnapshot(), and impeller::Snapshot::texture.
void impeller::TiledTextureContents::SetColorFilter | ( | ColorFilterProc | color_filter | ) |
Set a color filter to apply directly to this tiled texture.
color_filter | When applying a color filter to a tiled texture, we can reduce the size and number of the subpasses required and the shader workload by applying the filter to the untiled image and absorbing the opacity before tiling it into the final location. |
This may not be a performance improvement if the image is tiled into a much smaller size that its original texture size.
Definition at line 55 of file tiled_texture_contents.cc.
void impeller::TiledTextureContents::SetSamplerDescriptor | ( | const SamplerDescriptor & | desc | ) |
Definition at line 51 of file tiled_texture_contents.cc.
void impeller::TiledTextureContents::SetTexture | ( | std::shared_ptr< Texture > | texture | ) |
Definition at line 41 of file tiled_texture_contents.cc.
Referenced by impeller::testing::TEST_P().
void impeller::TiledTextureContents::SetTileModes | ( | Entity::TileMode | x_tile_mode, |
Entity::TileMode | y_tile_mode | ||
) |
Definition at line 45 of file tiled_texture_contents.cc.