26 contents->SetTexture(snapshot.
texture);
28 contents->SetSourceRect(texture_rect);
29 contents->SetOpacity(snapshot.
opacity);
71 return contents_->GetCoverage(*
this);
75 const std::optional<Rect>& current_clip_coverage)
const {
79 return contents_->GetClipCoverage(*
this, current_clip_coverage);
83#ifdef IMPELLER_CONTENT_CULLING
84 return contents_->ShouldRender(*
this, clip_coverage);
91 contents_ = std::move(contents);
99 clip_depth_ = clip_depth;
116 blend_mode_ = blend_mode;
131 return contents_->CanInheritOpacity(*
this);
141 contents_->SetInheritedOpacity(alpha);
146 return contents_->AsBackgroundColor(*
this, target_size);
157 switch (blend_mode) {
179 if (!contents_->GetCoverageHint().has_value()) {
180 contents_->SetCoverageHint(
184 return contents_->Render(
renderer, *
this, parent_pass);
static unsigned clamp(SkFixed fx, int max)
bool CanInheritOpacity() const
void SetTransform(const Matrix &transform)
Set the global transform matrix for this Entity.
static Entity FromSnapshot(const Snapshot &snapshot, BlendMode blend_mode=BlendMode::kSourceOver)
Create an entity that can be used to render a given snapshot.
std::optional< Rect > GetCoverage() const
bool SetInheritedOpacity(Scalar alpha)
const std::shared_ptr< Contents > & GetContents() const
Matrix GetShaderTransform(const RenderPass &pass) const
Get the vertex shader transform used for drawing this Entity.
void SetClipDepth(uint32_t clip_depth)
BlendMode GetBlendMode() const
void SetContents(std::shared_ptr< Contents > contents)
void SetBlendMode(BlendMode blend_mode)
static constexpr Scalar kDepthEpsilon
bool Render(const ContentContext &renderer, RenderPass &parent_pass) const
Scalar DeriveTextScale() const
std::optional< Color > AsBackgroundColor(ISize target_size) const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
uint32_t GetClipDepth() const
bool ShouldRender(const std::optional< Rect > &clip_coverage) const
static bool IsBlendModeDestructive(BlendMode blend_mode)
Returns true if the blend mode is "destructive", meaning that even fully transparent source colors wo...
Contents::ClipCoverage GetClipCoverage(const std::optional< Rect > ¤t_clip_coverage) const
float GetShaderClipDepth() const
Render passes encode render commands directed as one specific render target into an underlying comman...
const Matrix & GetOrthographicTransform() const
ISize GetRenderTargetSize() const
static std::shared_ptr< TextureContents > MakeRect(Rect destination)
A common case factory that marks the texture contents as having a destination rectangle....
static float min(float r, float g, float b)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeTranslation(const Vector3 &t)
constexpr Scalar GetMaxBasisLengthXY() const
static constexpr Matrix MakeScale(const Vector3 &s)
Represents a texture and its intended draw transform/sampler configuration.
Matrix transform
The transform that should be applied to this texture for rendering.
std::shared_ptr< Texture > texture
SamplerDescriptor sampler_descriptor
static constexpr TRect MakeSize(const TSize< U > &size)