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

#include <SkRuntimeColorFilter.h>

Inheritance diagram for SkRuntimeColorFilter:
SkColorFilterBase SkColorFilter SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkRuntimeColorFilter (sk_sp< SkRuntimeEffect > effect, sk_sp< const SkData > uniforms, SkSpan< const SkRuntimeEffect::ChildPtr > children)
 
bool appendStages (const SkStageRec &rec, bool) const override
 
bool onIsAlphaUnchanged () const override
 
void flatten (SkWriteBuffer &buffer) const override
 
SkRuntimeEffectasRuntimeEffect () const override
 
SkColorFilterBase::Type type () const override
 
sk_sp< SkRuntimeEffecteffect () const
 
sk_sp< const SkDatauniforms () const
 
SkSpan< const SkRuntimeEffect::ChildPtrchildren () const
 
- Public Member Functions inherited from SkColorFilterBase
virtual bool appendStages (const SkStageRec &rec, bool shaderIsOpaque) const =0
 
virtual bool onIsAlphaUnchanged () const
 
virtual Type type () const =0
 
bool affectsTransparentBlack () const
 
virtual SkRuntimeEffectasRuntimeEffect () const
 
SkFlattenable::Type getFlattenableType () const override
 
virtual SkPMColor4f onFilterColor4f (const SkPMColor4f &color, SkColorSpace *dstCS) const
 
- Public Member Functions inherited from SkColorFilter
bool asAColorMode (SkColor *color, SkBlendMode *mode) const
 
bool asAColorMatrix (float matrix[20]) const
 
bool isAlphaUnchanged () const
 
SkColor filterColor (SkColor) const
 
SkColor4f filterColor4f (const SkColor4f &srcColor, SkColorSpace *srcCS, SkColorSpace *dstCS) const
 
sk_sp< SkColorFiltermakeComposed (sk_sp< SkColorFilter > inner) const
 
sk_sp< SkColorFiltermakeWithWorkingColorSpace (sk_sp< SkColorSpace >) const
 
- Public Member Functions inherited from SkFlattenable
 SkFlattenable ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () const =0
 
virtual void flatten (SkWriteBuffer &) const
 
virtual Type getFlattenableType () 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 SkColorFilterBase
enum class  Type { kNoop , 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 SkColorFilterBase
static SkFlattenable::Type GetFlattenableType ()
 
static sk_sp< SkColorFilterDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
- Static Public Member Functions inherited from SkColorFilter
static sk_sp< SkColorFilterDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
- 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)
 
- Protected Member Functions inherited from SkColorFilterBase
 SkColorFilterBase ()
 
virtual bool onAsAColorMatrix (float[20]) const
 
virtual bool onAsAColorMode (SkColor *color, SkBlendMode *bmode) const
 

Detailed Description

Definition at line 25 of file SkRuntimeColorFilter.h.

Constructor & Destructor Documentation

◆ SkRuntimeColorFilter()

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

Definition at line 42 of file SkRuntimeColorFilter.cpp.

45 : fEffect(std::move(effect))
46 , fUniforms(std::move(uniforms))
47 , fChildren(children.begin(), children.end()) {}
SkSpan< const SkRuntimeEffect::ChildPtr > children() const
sk_sp< SkRuntimeEffect > effect() 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

◆ appendStages()

bool SkRuntimeColorFilter::appendStages ( const SkStageRec rec,
bool   
) const
overridevirtual

Implements SkColorFilterBase.

Definition at line 49 of file SkRuntimeColorFilter.cpp.

49 {
51 // SkRP has support for many parts of #version 300 already, but for now, we restrict its
52 // usage in runtime effects to just #version 100.
53 return false;
54 }
55 if (const SkSL::RP::Program* program = fEffect->getRPProgram(/*debugTrace=*/nullptr)) {
58 fUniforms,
59 /*alwaysCopyIntoAlloc=*/false,
60 rec.fDstCS,
61 rec.fAlloc);
63 matrix.markCTMApplied();
64 RuntimeEffectRPCallbacks callbacks(rec, matrix, fChildren, fEffect->fSampleUsages);
65 bool success = program->appendStages(rec.fPipeline, rec.fAlloc, &callbacks, uniforms);
66 return success;
67 }
68 return false;
69}
static sk_sp< const SkCapabilities > RasterBackend()
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
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
T * get() const
Definition: SkRefCnt.h:303
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
const myers::Point & get(const myers::Segment &)
SkRasterPipeline * fPipeline
Definition: SkEffectPriv.h:21
SkColorSpace * fDstCS
Definition: SkEffectPriv.h:24
SkArenaAlloc * fAlloc
Definition: SkEffectPriv.h:22

◆ asRuntimeEffect()

SkRuntimeEffect * SkRuntimeColorFilter::asRuntimeEffect ( ) const
overridevirtual

Reimplemented from SkColorFilterBase.

Definition at line 81 of file SkRuntimeColorFilter.cpp.

81{ return fEffect.get(); }

◆ children()

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

Definition at line 45 of file SkRuntimeColorFilter.h.

45{ return fChildren; }

◆ effect()

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

Definition at line 43 of file SkRuntimeColorFilter.h.

43{ return fEffect; }

◆ flatten()

void SkRuntimeColorFilter::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 75 of file SkRuntimeColorFilter.cpp.

75 {
76 buffer.writeString(fEffect->source().c_str());
77 buffer.writeDataAsByteArray(fUniforms.get());
79}
static void WriteChildEffects(SkWriteBuffer &buffer, SkSpan< const SkRuntimeEffect::ChildPtr > children)
const std::string & source() const
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ onIsAlphaUnchanged()

bool SkRuntimeColorFilter::onIsAlphaUnchanged ( ) const
overridevirtual

Returns the flags for this filter. Override in subclasses to return custom flags.

Reimplemented from SkColorFilterBase.

Definition at line 71 of file SkRuntimeColorFilter.cpp.

71 {
72 return fEffect->isAlphaUnchanged();
73}

◆ type()

SkColorFilterBase::Type SkRuntimeColorFilter::type ( ) const
inlineoverridevirtual

Implements SkColorFilterBase.

Definition at line 39 of file SkRuntimeColorFilter.h.

39{ return SkColorFilterBase::Type::kRuntime; }

◆ uniforms()

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

Definition at line 44 of file SkRuntimeColorFilter.h.

44{ return fUniforms; }

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