Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
RuntimeEffectRPCallbacks Class Reference

#include <SkRuntimeEffectPriv.h>

Inheritance diagram for RuntimeEffectRPCallbacks:
SkSL::RP::Callbacks

Public Member Functions

 RuntimeEffectRPCallbacks (const SkStageRec &s, const SkShaders::MatrixRec &m, SkSpan< const SkRuntimeEffect::ChildPtr > c, SkSpan< const SkSL::SampleUsage > u)
 
bool appendShader (int index) override
 
bool appendColorFilter (int index) override
 
bool appendBlender (int index) override
 
void toLinearSrgb (const void *color) override
 
void fromLinearSrgb (const void *color) override
 
- Public Member Functions inherited from SkSL::RP::Callbacks
virtual ~Callbacks ()=default
 
virtual bool appendShader (int index)=0
 
virtual bool appendColorFilter (int index)=0
 
virtual bool appendBlender (int index)=0
 
virtual void toLinearSrgb (const void *color)=0
 
virtual void fromLinearSrgb (const void *color)=0
 

Detailed Description

Definition at line 182 of file SkRuntimeEffectPriv.h.

Constructor & Destructor Documentation

◆ RuntimeEffectRPCallbacks()

RuntimeEffectRPCallbacks::RuntimeEffectRPCallbacks ( const SkStageRec s,
const SkShaders::MatrixRec m,
SkSpan< const SkRuntimeEffect::ChildPtr c,
SkSpan< const SkSL::SampleUsage u 
)
inline

Definition at line 187 of file SkRuntimeEffectPriv.h.

191 : fStage{s.fPipeline,
192 s.fAlloc,
193 s.fDstColorType,
194 s.fDstCS,
196 s.fSurfaceProps}
197 , fMatrix(m)
198 , fChildren(c)
199 , fSampleUsages(u) {}
struct MyStruct s
constexpr SkColor4f kTransparent
Definition: SkColor.h:434

Member Function Documentation

◆ appendBlender()

bool RuntimeEffectRPCallbacks::appendBlender ( int  index)
overridevirtual

Implements SkSL::RP::Callbacks.

Definition at line 306 of file SkRuntimeEffect.cpp.

306 {
307 if (SkBlender* blender = fChildren[index].blender()) {
308 return as_BB(blender)->appendStages(fStage);
309 }
310 // Return a source-over blend when a null blender is evaluated.
311 fStage.fPipeline->append(SkRasterPipelineOp::srcover);
312 return true;
313}
SkBlenderBase * as_BB(SkBlender *blend)
Definition: SkBlenderBase.h:69
bool appendStages(const SkStageRec &rec) const
Definition: SkBlenderBase.h:49
void append(SkRasterPipelineOp, void *=nullptr)
SkRasterPipeline * fPipeline
Definition: SkEffectPriv.h:21

◆ appendColorFilter()

bool RuntimeEffectRPCallbacks::appendColorFilter ( int  index)
overridevirtual

Implements SkSL::RP::Callbacks.

Definition at line 299 of file SkRuntimeEffect.cpp.

299 {
300 if (SkColorFilter* colorFilter = fChildren[index].colorFilter()) {
301 return as_CFB(colorFilter)->appendStages(fStage, /*shaderIsOpaque=*/false);
302 }
303 // Return the original color as-is when a null child color filter is evaluated.
304 return true;
305}
static SkColorFilterBase * as_CFB(SkColorFilter *filter)
virtual bool appendStages(const SkStageRec &rec, bool shaderIsOpaque) const =0

◆ appendShader()

bool RuntimeEffectRPCallbacks::appendShader ( int  index)
overridevirtual

Implements SkSL::RP::Callbacks.

Definition at line 284 of file SkRuntimeEffect.cpp.

284 {
285 if (SkShader* shader = fChildren[index].shader()) {
286 if (fSampleUsages[index].isPassThrough()) {
287 // Given a passthrough sample, the total-matrix is still as valid as before.
288 return as_SB(shader)->appendStages(fStage, fMatrix);
289 }
290 // For a non-passthrough sample, we need to explicitly mark the total-matrix as invalid.
291 SkShaders::MatrixRec nonPassthroughMatrix = fMatrix;
292 nonPassthroughMatrix.markTotalMatrixInvalid();
293 return as_SB(shader)->appendStages(fStage, nonPassthroughMatrix);
294 }
295 // Return transparent black when a null shader is evaluated.
297 return true;
298}
SkShaderBase * as_SB(SkShader *shader)
Definition: SkShaderBase.h:412
void appendConstantColor(SkArenaAlloc *, const float rgba[4])
virtual bool appendStages(const SkStageRec &, const SkShaders::MatrixRec &) const =0
SkArenaAlloc * fAlloc
Definition: SkEffectPriv.h:22

◆ fromLinearSrgb()

void RuntimeEffectRPCallbacks::fromLinearSrgb ( const void *  color)
overridevirtual

Implements SkSL::RP::Callbacks.

Definition at line 328 of file SkRuntimeEffect.cpp.

328 {
329 if (fStage.fDstCS) {
332 if (xform.flags.mask()) {
333 // We have a non-identity colorspace transform; apply it.
334 this->applyColorSpaceXform(xform, color);
335 }
336 }
337}
kUnpremul_SkAlphaType
SkColorSpace * sk_srgb_linear_singleton()
DlColor color
SkColorSpace * fDstCS
Definition: SkEffectPriv.h:24

◆ toLinearSrgb()

void RuntimeEffectRPCallbacks::toLinearSrgb ( const void *  color)
overridevirtual

Implements SkSL::RP::Callbacks.

Definition at line 317 of file SkRuntimeEffect.cpp.

317 {
318 if (fStage.fDstCS) {
321 if (xform.flags.mask()) {
322 // We have a non-identity colorspace transform; apply it.
323 this->applyColorSpaceXform(xform, color);
324 }
325 }
326}

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