Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkRuntimeBlender Class Reference

#include <SkRuntimeBlender.h>

Inheritance diagram for SkRuntimeBlender:
SkBlenderBase SkBlender SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkRuntimeBlender (sk_sp< SkRuntimeEffect > effect, sk_sp< const SkData > uniforms, SkSpan< const SkRuntimeEffect::ChildPtr > children)
 
SkRuntimeEffectasRuntimeEffect () const override
 
BlenderType type () const override
 
bool onAppendStages (const SkStageRec &rec) const override
 
void flatten (SkWriteBuffer &buffer) const override
 
sk_sp< SkRuntimeEffecteffect () const
 
sk_sp< const SkDatauniforms () const
 
SkSpan< const SkRuntimeEffect::ChildPtrchildren () const
 
- Public Member Functions inherited from SkBlenderBase
virtual std::optional< SkBlendModeasBlendMode () const
 
bool affectsTransparentBlack () const
 
bool appendStages (const SkStageRec &rec) const
 
SkFlattenable::Type getFlattenableType () const override
 
- Public Member Functions inherited from SkFlattenable
 SkFlattenable ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () const =0
 
sk_sp< SkDataserialize (const SkSerialProcs *=nullptr) const
 
size_t serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Public Types inherited from SkBlenderBase
enum class  BlenderType { M }
 
- Public Types inherited from SkFlattenable
enum  Type {
  kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type ,
  kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory) (SkReadBuffer &)
 
- Static Public Member Functions inherited from SkBlenderBase
static SkFlattenable::Type GetFlattenableType ()
 
- Static Public Member Functions inherited from SkBlender
static sk_sp< SkBlenderMode (SkBlendMode mode)
 
- Static Public Member Functions inherited from SkFlattenable
static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static void Register (const char name[], Factory)
 
static sk_sp< SkFlattenableDeserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
 

Detailed Description

Definition at line 24 of file SkRuntimeBlender.h.

Constructor & Destructor Documentation

◆ SkRuntimeBlender()

SkRuntimeBlender::SkRuntimeBlender ( sk_sp< SkRuntimeEffect effect,
sk_sp< const SkData uniforms,
SkSpan< const SkRuntimeEffect::ChildPtr children 
)
inline

Definition at line 26 of file SkRuntimeBlender.h.

29 : fEffect(std::move(effect))
30 , fUniforms(std::move(uniforms))
31 , fChildren(children.begin(), children.end()) {}
sk_sp< SkRuntimeEffect > effect() const
SkSpan< const SkRuntimeEffect::ChildPtr > children() const
sk_sp< const SkData > uniforms() const
constexpr T * begin() const
Definition SkSpan_impl.h:90
constexpr T * end() const
Definition SkSpan_impl.h:91

Member Function Documentation

◆ asRuntimeEffect()

SkRuntimeEffect * SkRuntimeBlender::asRuntimeEffect ( ) const
inlineoverridevirtual

Reimplemented from SkBlenderBase.

Definition at line 33 of file SkRuntimeBlender.h.

33{ return fEffect.get(); }
T * get() const
Definition SkRefCnt.h:303

◆ children()

SkSpan< const SkRuntimeEffect::ChildPtr > SkRuntimeBlender::children ( ) const
inline

Definition at line 45 of file SkRuntimeBlender.h.

45{ return fChildren; }

◆ effect()

sk_sp< SkRuntimeEffect > SkRuntimeBlender::effect ( ) const
inline

Definition at line 43 of file SkRuntimeBlender.h.

43{ return fEffect; }

◆ flatten()

void SkRuntimeBlender::flatten ( SkWriteBuffer ) const
overridevirtual

Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()).

DEPRECATED public : will move to protected ... use serialize() instead

Reimplemented from SkFlattenable.

Definition at line 87 of file SkRuntimeBlender.cpp.

87 {
88 buffer.writeString(fEffect->source().c_str());
89 buffer.writeDataAsByteArray(fUniforms.get());
91}
static void WriteChildEffects(SkWriteBuffer &buffer, SkSpan< const SkRuntimeEffect::ChildPtr > children)
const std::string & source() const
static const uint8_t buffer[]

◆ onAppendStages()

bool SkRuntimeBlender::onAppendStages ( const SkStageRec rec) const
overridevirtual

Implements SkBlenderBase.

Definition at line 65 of file SkRuntimeBlender.cpp.

65 {
67 // SkRP has support for many parts of #version 300 already, but for now, we restrict its
68 // usage in runtime effects to just #version 100.
69 return false;
70 }
71 if (const SkSL::RP::Program* program = fEffect->getRPProgram(/*debugTrace=*/nullptr)) {
73 fEffect->uniforms(),
74 fUniforms,
75 /*alwaysCopyIntoAlloc=*/false,
76 rec.fDstCS,
77 rec.fAlloc);
79 matrix.markCTMApplied();
80 RuntimeEffectRPCallbacks callbacks(rec, matrix, fChildren, fEffect->fSampleUsages);
81 bool success = program->appendStages(rec.fPipeline, rec.fAlloc, &callbacks, uniforms);
82 return success;
83 }
84 return false;
85}
static sk_sp< const SkCapabilities > RasterBackend()
static const SkMatrix & I()
static SkSpan< const float > UniformsAsSpan(SkSpan< const SkRuntimeEffect::Uniform > uniforms, sk_sp< const SkData > originalData, bool alwaysCopyIntoAlloc, const SkColorSpace *destColorSpace, SkArenaAlloc *alloc)
static bool CanDraw(const SkCapabilities *, const SkSL::Program *)
SkSpan< const Uniform > uniforms() const
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258
const myers::Point & get(const myers::Segment &)
SkRasterPipeline * fPipeline
SkColorSpace * fDstCS
SkArenaAlloc * fAlloc

◆ type()

BlenderType SkRuntimeBlender::type ( ) const
inlineoverridevirtual

Implements SkBlenderBase.

Definition at line 35 of file SkRuntimeBlender.h.

35{ return BlenderType::kRuntime; }

◆ uniforms()

sk_sp< const SkData > SkRuntimeBlender::uniforms ( ) const
inline

Definition at line 44 of file SkRuntimeBlender.h.

44{ return fUniforms; }

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