#include <entity.h>
Public Types | |
enum | RenderingMode { RenderingMode::kDirect, RenderingMode::kSubpass } |
enum | TileMode { TileMode::kClamp, TileMode::kRepeat, TileMode::kMirror, TileMode::kDecal } |
enum | ClipOperation { ClipOperation::kDifference, ClipOperation::kIntersect } |
Public Member Functions | |
Entity () | |
~Entity () | |
Entity (Entity &&) | |
const Matrix & | GetTransform () const |
Get the global transform matrix for this Entity. More... | |
Matrix | GetShaderTransform (const RenderPass &pass) const |
Get the vertex shader transform used for drawing this Entity. More... | |
void | SetTransform (const Matrix &transform) |
Set the global transform matrix for this Entity. More... | |
std::optional< Rect > | GetCoverage () const |
Contents::ClipCoverage | GetClipCoverage (const std::optional< Rect > ¤t_clip_coverage) const |
bool | ShouldRender (const std::optional< Rect > &clip_coverage) const |
void | SetContents (std::shared_ptr< Contents > contents) |
const std::shared_ptr< Contents > & | GetContents () const |
void | SetClipDepth (uint32_t clip_depth) |
void | IncrementStencilDepth (uint32_t increment) |
uint32_t | GetClipDepth () const |
void | SetNewClipDepth (uint32_t clip_depth) |
uint32_t | GetNewClipDepth () const |
float | GetShaderClipDepth () const |
void | SetBlendMode (BlendMode blend_mode) |
BlendMode | GetBlendMode () const |
bool | Render (const ContentContext &renderer, RenderPass &parent_pass) const |
bool | CanInheritOpacity () const |
bool | SetInheritedOpacity (Scalar alpha) |
std::optional< Color > | AsBackgroundColor (ISize target_size) const |
Scalar | DeriveTextScale () const |
Capture & | GetCapture () const |
void | SetCapture (Capture capture) const |
Entity | Clone () const |
Static Public Member Functions | |
static Entity | FromSnapshot (const Snapshot &snapshot, BlendMode blend_mode=BlendMode::kSourceOver, uint32_t clip_depth=0) |
Create an entity that can be used to render a given snapshot. More... | |
static Matrix | GetShaderTransform (Scalar clip_depth, const RenderPass &pass, const Matrix &transform) |
Static utility that computes the vertex shader transform used for drawing an Entity with a given the clip depth and RenderPass size. More... | |
static float | GetShaderClipDepth (uint32_t clip_depth) |
static bool | IsBlendModeDestructive (BlendMode blend_mode) |
Returns true if the blend mode is "destructive", meaning that even fully transparent source colors would result in the destination getting changed. More... | |
Static Public Attributes | |
static constexpr BlendMode | kLastPipelineBlendMode = BlendMode::kModulate |
static constexpr BlendMode | kLastAdvancedBlendMode = BlendMode::kLuminosity |
static constexpr Scalar | kDepthEpsilon = 1.0f / 262144.0 |
|
strong |
|
strong |
Enumerator | |
---|---|
kDirect | In direct mode, the Entity's transform is used as the current local-to-screen transform matrix. |
kSubpass | In subpass mode, the Entity passed through the filter is in screen space rather than local space, and so some filters (namely, MatrixFilterContents) need to interpret the given EffectTransform as the current transform matrix. |
Definition at line 28 of file entity.h.
|
strong |
An enum to define how to repeat, fold, or omit colors outside of the typically defined range of the source of the colors (such as the bounds of an image or the defining geometry of a gradient).
Definition at line 42 of file entity.h.
|
default |
Referenced by Clone().
|
default |
|
default |
bool impeller::Entity::CanInheritOpacity | ( | ) | const |
Definition at line 138 of file entity.cc.
References impeller::kSource, and impeller::kSourceOver.
Referenced by impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass(), and SetInheritedOpacity().
Entity impeller::Entity::Clone | ( | ) | const |
Definition at line 210 of file entity.cc.
References Entity().
Referenced by impeller::FilterContents::GetCoverage(), impeller::FilterContents::GetEntity(), impeller::FilterInput::GetLocalCoverage(), impeller::EntityPassClipStack::RecordEntity(), and impeller::testing::TEST_P().
Scalar impeller::Entity::DeriveTextScale | ( | ) | const |
Definition at line 202 of file entity.cc.
References impeller::Matrix::GetMaxBasisLengthXY(), and GetTransform().
|
static |
Create an entity that can be used to render a given snapshot.
Definition at line 22 of file entity.cc.
References impeller::TextureContents::MakeRect(), impeller::TRect< Scalar >::MakeSize(), impeller::Snapshot::opacity, impeller::Snapshot::sampler_descriptor, SetBlendMode(), SetClipDepth(), SetContents(), SetTransform(), impeller::Snapshot::texture, and impeller::Snapshot::transform.
Referenced by impeller::AdvancedBlend(), and impeller::PipelineBlend().
BlendMode impeller::Entity::GetBlendMode | ( | ) | const |
Definition at line 134 of file entity.cc.
Referenced by impeller::EntityPass::AddEntity(), impeller::AdvancedBlend(), impeller::OptionsFromPassAndEntity(), impeller::PipelineBlend(), impeller::SolidRRectBlurContents::Render(), and impeller::testing::TEST_P().
Capture & impeller::Entity::GetCapture | ( | ) | const |
Definition at line 206 of file entity.cc.
Referenced by impeller::EntityPassClipStack::ApplyClipState(), impeller::SolidColorContents::Render(), and impeller::TextureContents::Render().
Contents::ClipCoverage impeller::Entity::GetClipCoverage | ( | const std::optional< Rect > & | current_clip_coverage | ) | const |
uint32_t impeller::Entity::GetClipDepth | ( | ) | const |
Definition at line 105 of file entity.cc.
Referenced by impeller::AdvancedBlend(), impeller::EntityPassClipStack::ApplyClipState(), impeller::PipelineBlend(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::VerticesColorContents::Render(), impeller::TextureContents::Render(), impeller::AtlasContents::Render(), impeller::ClipRestoreContents::Render(), impeller::VerticesUVContents::Render(), impeller::AtlasTextureContents::Render(), and impeller::AtlasColorContents::Render().
const std::shared_ptr< Contents > & impeller::Entity::GetContents | ( | ) | const |
Definition at line 97 of file entity.cc.
Referenced by impeller::EntityPass::AddEntity(), impeller::AdvancedBlend(), impeller::EntityPassClipStack::ApplyClipState(), impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass(), impeller::testing::GetCoverageOfFirstEntity(), impeller::ContentsFilterInput::GetSnapshot(), impeller::PipelineBlend(), impeller::EntityPass::Render(), and impeller::testing::TEST_P().
std::optional< Rect > impeller::Entity::GetCoverage | ( | ) | const |
Definition at line 69 of file entity.cc.
Referenced by impeller::EntityPassClipStack::ApplyClipState(), and impeller::testing::TEST_P().
uint32_t impeller::Entity::GetNewClipDepth | ( | ) | const |
Definition at line 113 of file entity.cc.
Referenced by impeller::GetShaderClipDepth(), and impeller::FilterContents::Render().
Scalar impeller::Entity::GetShaderClipDepth | ( | ) | const |
Definition at line 117 of file entity.cc.
Referenced by impeller::GetShaderClipDepth(), GetShaderTransform(), impeller::SolidRRectBlurContents::Render(), and impeller::TextContents::Render().
|
static |
Matrix impeller::Entity::GetShaderTransform | ( | const RenderPass & | pass | ) | const |
Get the vertex shader transform used for drawing this Entity.
Definition at line 53 of file entity.cc.
References GetShaderClipDepth().
Referenced by impeller::Geometry::ComputePositionGeometry(), impeller::Geometry::ComputePositionUVGeometry(), impeller::ComputeUVGeometryForRect(), impeller::RectGeometry::GetPositionBuffer(), impeller::VerticesGeometry::GetPositionBuffer(), impeller::VerticesGeometry::GetPositionColorBuffer(), impeller::VerticesGeometry::GetPositionUVBuffer(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::TextureContents::Render(), impeller::AtlasContents::Render(), impeller::AtlasTextureContents::Render(), and impeller::AtlasColorContents::Render().
|
static |
Static utility that computes the vertex shader transform used for drawing an Entity with a given the clip depth and RenderPass size.
Definition at line 57 of file entity.cc.
References impeller::RenderPass::GetOrthographicTransform(), kDepthEpsilon, impeller::Matrix::MakeScale(), and impeller::Matrix::MakeTranslation().
const Matrix & impeller::Entity::GetTransform | ( | ) | const |
Get the global transform matrix for this Entity.
Definition at line 49 of file entity.cc.
Referenced by impeller::SolidColorContents::AsBackgroundColor(), DeriveTextScale(), impeller::ClipContents::GetClipCoverage(), impeller::SolidRRectBlurContents::GetCoverage(), impeller::SolidColorContents::GetCoverage(), impeller::VerticesContents::GetCoverage(), impeller::TextContents::GetCoverage(), impeller::TextureContents::GetCoverage(), impeller::AtlasContents::GetCoverage(), impeller::ColorSourceContents::GetCoverage(), impeller::AtlasTextureContents::GetCoverage(), impeller::FilterContents::GetCoverage(), impeller::AtlasColorContents::GetCoverage(), impeller::FilterContents::GetEntity(), impeller::GaussianBlurFilterContents::GetFilterCoverage(), impeller::FilterContentsFilterInput::GetLocalTransform(), impeller::FilterContentsFilterInput::GetTransform(), impeller::FilterInput::GetTransform(), impeller::SceneContents::Render(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::TextureContents::RenderToSnapshot(), impeller::Contents::RenderToSnapshot(), and impeller::testing::TEST_P().
void impeller::Entity::IncrementStencilDepth | ( | uint32_t | increment | ) |
|
static |
Returns true if the blend mode is "destructive", meaning that even fully transparent source colors would result in the destination getting changed.
This is useful for determining if EntityPass textures can be shrinkwrapped to their Entities' coverage; they can be shrinkwrapped if all of the contained Entities have non-destructive blends.
Definition at line 171 of file entity.cc.
References impeller::kClear, impeller::kDestinationATop, impeller::kDestinationIn, impeller::kDestinationOut, impeller::kModulate, impeller::kSource, impeller::kSourceIn, impeller::kSourceOut, and impeller::kXor.
Referenced by impeller::EntityPass::SetBlendMode().
bool impeller::Entity::Render | ( | const ContentContext & | renderer, |
RenderPass & | parent_pass | ||
) | const |
Definition at line 188 of file entity.cc.
References impeller::RenderPass::GetRenderTargetSize(), and impeller::TRect< Scalar >::MakeSize().
Referenced by impeller::EntityPlayground::OpenPlaygroundHere(), impeller::PipelineBlend(), impeller::EntityPass::Render(), and impeller::testing::TEST_P().
void impeller::Entity::SetBlendMode | ( | BlendMode | blend_mode | ) |
Definition at line 130 of file entity.cc.
Referenced by impeller::EntityPass::AddEntity(), impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), FromSnapshot(), impeller::DlImageImpeller::MakeFromYUVTextures(), impeller::PipelineBlend(), impeller::EntityPass::Render(), impeller::Contents::RenderToSnapshot(), and impeller::testing::TEST_P().
void impeller::Entity::SetCapture | ( | Capture | capture | ) | const |
void impeller::Entity::SetClipDepth | ( | uint32_t | clip_depth | ) |
Definition at line 101 of file entity.cc.
Referenced by impeller::EntityPassClipStack::ApplyClipState(), impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), FromSnapshot(), and impeller::testing::TEST().
void impeller::Entity::SetContents | ( | std::shared_ptr< Contents > | contents | ) |
Definition at line 93 of file entity.cc.
Referenced by impeller::testing::CreatePassWithRectPath(), impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), FromSnapshot(), impeller::PipelineBlend(), impeller::EntityPass::Render(), and impeller::testing::TEST_P().
bool impeller::Entity::SetInheritedOpacity | ( | Scalar | alpha | ) |
Definition at line 149 of file entity.cc.
References CanInheritOpacity(), impeller::kSource, and impeller::kSourceOver.
void impeller::Entity::SetNewClipDepth | ( | uint32_t | clip_depth | ) |
Definition at line 109 of file entity.cc.
Referenced by impeller::EntityPass::PopClips().
void impeller::Entity::SetTransform | ( | const Matrix & | transform | ) |
Set the global transform matrix for this Entity.
Definition at line 65 of file entity.cc.
Referenced by impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), FromSnapshot(), impeller::FilterContents::GetCoverage(), impeller::EntityPass::GetElementsCoverage(), impeller::FilterContents::GetEntity(), impeller::FilterInput::GetLocalCoverage(), impeller::Contents::RenderToSnapshot(), impeller::testing::TEST(), and impeller::testing::TEST_P().
bool impeller::Entity::ShouldRender | ( | const std::optional< Rect > & | clip_coverage | ) | const |
|
staticconstexpr |
Definition at line 26 of file entity.h.
Referenced by GetShaderClipDepth(), and GetShaderTransform().
|
staticconstexpr |
Definition at line 24 of file entity.h.
Referenced by impeller::testing::GetBlendModeSelection(), impeller::ColorFilterContents::MakeBlend(), and impeller::BlendFilterContents::SetBlendMode().
|
staticconstexpr |
Definition at line 23 of file entity.h.
Referenced by impeller::EntityPass::AddEntity(), impeller::EntityPass::AddSubpass(), impeller::ContentContextOptions::ApplyToPipelineDescriptor(), impeller::ColorFilterContents::MakeBlend(), impeller::BlendFilterContents::SetBlendMode(), and impeller::testing::TEST_P().