Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkCTMShader Class Referencefinal

#include <SkLocalMatrixShader.h>

Inheritance diagram for SkCTMShader:
SkShaderBase SkShader SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkCTMShader (sk_sp< SkShader > proxy, const SkMatrix &ctm)
 
bool isOpaque () const override
 
bool isConstant () const override
 
GradientType asGradient (GradientInfo *info, SkMatrix *localMatrix) const override
 
ShaderType type () const override
 
const SkMatrixctm () const
 
sk_sp< SkShaderproxyShader () const
 
- Public Member Functions inherited from SkShaderBase
 ~SkShaderBase () override
 
sk_sp< SkShadermakeInvertAlpha () const
 
sk_sp< SkShadermakeWithCTM (const SkMatrix &) const
 
virtual bool isConstant () const
 
virtual ShaderType type () const =0
 
virtual GradientType asGradient (GradientInfo *info=nullptr, SkMatrix *localMatrix=nullptr) const
 
ContextmakeContext (const ContextRec &, SkArenaAlloc *) const
 
bool asLuminanceColor (SkColor4f *) const
 
bool appendRootStages (const SkStageRec &rec, const SkMatrix &ctm) const
 
virtual bool appendStages (const SkStageRec &, const SkShaders::MatrixRec &) const =0
 
virtual SkImageonIsAImage (SkMatrix *, SkTileMode[2]) const
 
virtual SkRuntimeEffectasRuntimeEffect () const
 
Type getFlattenableType () const override
 
virtual sk_sp< SkShadermakeAsALocalMatrixShader (SkMatrix *localMatrix) const
 
- Public Member Functions inherited from SkShader
virtual bool isOpaque () const
 
SkImageisAImage (SkMatrix *localMatrix, SkTileMode xy[2]) const
 
bool isAImage () const
 
sk_sp< SkShadermakeWithLocalMatrix (const SkMatrix &) const
 
sk_sp< SkShadermakeWithColorFilter (sk_sp< SkColorFilter >) const
 
sk_sp< SkShadermakeWithWorkingColorSpace (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
 

Protected Member Functions

void flatten (SkWriteBuffer &) const override
 
bool appendStages (const SkStageRec &rec, const SkShaders::MatrixRec &) const override
 
- Protected Member Functions inherited from SkShaderBase
 SkShaderBase ()
 
void flatten (SkWriteBuffer &) const override
 
virtual bool onAsLuminanceColor (SkColor4f *) const
 

Additional Inherited Members

- Public Types inherited from SkShaderBase
enum class  ShaderType { M }
 
enum class  GradientType { kNone , M }
 
enum  Flags { kOpaqueAlpha_Flag = 1 << 0 }
 
- 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 SkShaderBase
static Type GetFlattenableType ()
 
static sk_sp< SkShaderBaseDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
static void RegisterFlattenables ()
 
static SkMatrix ConcatLocalMatrices (const SkMatrix &parentLM, const SkMatrix &childLM)
 
- 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

Replaces the CTM when used. Created to support clipShaders, which have to be evaluated using the CTM that was present at the time they were specified (which may be different from the CTM at the time something is drawn through the clip.

Definition at line 85 of file SkLocalMatrixShader.h.

Constructor & Destructor Documentation

◆ SkCTMShader()

SkCTMShader::SkCTMShader ( sk_sp< SkShader proxy,
const SkMatrix ctm 
)

Definition at line 72 of file SkLocalMatrixShader.cpp.

73 : fProxyShader(std::move(proxy)), fCTM(ctm) {}
const SkMatrix & ctm() const

Member Function Documentation

◆ appendStages()

bool SkCTMShader::appendStages ( const SkStageRec ,
const SkShaders::MatrixRec  
) const
overrideprotectedvirtual

Adds stages to implement this shader. To ensure that the correct input coords are present in r,g MatrixRec::apply() must be called (unless the shader doesn't require it's input coords). The default impl creates shadercontext and calls that (not very efficient).

Implements SkShaderBase.

Definition at line 84 of file SkLocalMatrixShader.cpp.

84 {
85 return as_SB(fProxyShader)->appendRootStages(rec, fCTM);
86}
SkShaderBase * as_SB(SkShader *shader)
Definition: SkShaderBase.h:412
bool appendRootStages(const SkStageRec &rec, const SkMatrix &ctm) const

◆ asGradient()

SkShaderBase::GradientType SkCTMShader::asGradient ( GradientInfo info,
SkMatrix localMatrix 
) const
overridevirtual

Reimplemented from SkShaderBase.

Definition at line 79 of file SkLocalMatrixShader.cpp.

80 {
81 return as_SB(fProxyShader)->asGradient(info, localMatrix);
82}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
virtual GradientType asGradient(GradientInfo *info=nullptr, SkMatrix *localMatrix=nullptr) const
Definition: SkShaderBase.h:255

◆ ctm()

const SkMatrix & SkCTMShader::ctm ( ) const
inline

Definition at line 96 of file SkLocalMatrixShader.h.

96{ return fCTM; }

◆ flatten()

void SkCTMShader::flatten ( SkWriteBuffer ) const
inlineoverrideprotectedvirtual

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 100 of file SkLocalMatrixShader.h.

100{ SkASSERT(false); }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ isConstant()

bool SkCTMShader::isConstant ( ) const
overridevirtual

Returns true if the shader is guaranteed to produce only a single color. Subclasses can override this to allow loop-hoisting optimization.

Reimplemented from SkShaderBase.

Definition at line 75 of file SkLocalMatrixShader.cpp.

75 {
76 return as_SB(fProxyShader)->isConstant();
77}
virtual bool isConstant() const
Definition: SkShaderBase.h:197

◆ isOpaque()

bool SkCTMShader::isOpaque ( ) const
inlineoverridevirtual

Returns true if the shader is guaranteed to produce only opaque colors, subject to the SkPaint using the shader to apply an opaque alpha value. Subclasses should override this to allow some optimizations.

Reimplemented from SkShader.

Definition at line 89 of file SkLocalMatrixShader.h.

89{ return fProxyShader->isOpaque(); }
virtual bool isOpaque() const
Definition: SkShader.h:44

◆ proxyShader()

sk_sp< SkShader > SkCTMShader::proxyShader ( ) const
inline

Definition at line 97 of file SkLocalMatrixShader.h.

97{ return fProxyShader; }

◆ type()

ShaderType SkCTMShader::type ( ) const
inlineoverridevirtual

Implements SkShaderBase.

Definition at line 94 of file SkLocalMatrixShader.h.

94{ return ShaderType::kCTM; }

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