Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
SkCoordClampShader Class Referencefinal

#include <SkCoordClampShader.h>

Inheritance diagram for SkCoordClampShader:
SkShaderBase SkShader SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkCoordClampShader (sk_sp< SkShader > shader, const SkRect &subset)
 
ShaderType type () const override
 
sk_sp< SkShadershader () const
 
SkRect subset () const
 
- Public Member Functions inherited from SkShaderBase
 ~SkShaderBase () override
 
sk_sp< SkShadermakeInvertAlpha () const
 
sk_sp< SkShadermakeWithCTM (const SkMatrix &) const
 
virtual bool isConstant () const
 
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 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
 
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

 SkCoordClampShader (SkReadBuffer &)
 
void flatten (SkWriteBuffer &) const override
 
bool appendStages (const SkStageRec &, 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

Definition at line 23 of file SkCoordClampShader.h.

Constructor & Destructor Documentation

◆ SkCoordClampShader() [1/2]

SkCoordClampShader::SkCoordClampShader ( sk_sp< SkShader shader,
const SkRect subset 
)
inline

Definition at line 25 of file SkCoordClampShader.h.

26 : fShader(std::move(shader)), fSubset(subset) {}
sk_sp< SkShader > shader() const

◆ SkCoordClampShader() [2/2]

SkCoordClampShader::SkCoordClampShader ( SkReadBuffer )
protected

Member Function Documentation

◆ appendStages()

bool SkCoordClampShader::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 37 of file SkCoordClampShader.cpp.

38 {
39 std::optional<SkShaders::MatrixRec> childMRec = mRec.apply(rec);
40 if (!childMRec.has_value()) {
41 return false;
42 }
43 // Strictly speaking, childMRec's total matrix is not valid. It is only valid inside the subset
44 // rectangle. However, we don't mark it as such because we want the "total matrix is valid"
45 // behavior in SkImageShader for filtering.
46 auto clampCtx = rec.fAlloc->make<SkRasterPipeline_CoordClampCtx>();
47 *clampCtx = {fSubset.fLeft, fSubset.fTop, fSubset.fRight, fSubset.fBottom};
48 rec.fPipeline->append(SkRasterPipelineOp::clamp_x_and_y, clampCtx);
49 return as_SB(fShader)->appendStages(rec, *childMRec);
50}
SkShaderBase * as_SB(SkShader *shader)
virtual bool appendStages(const SkStageRec &, const SkShaders::MatrixRec &) const =0
SkScalar fBottom
larger y-axis bounds
Definition extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition extension.cpp:15

◆ flatten()

void SkCoordClampShader::flatten ( SkWriteBuffer ) const
overrideprotectedvirtual

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 32 of file SkCoordClampShader.cpp.

32 {
33 buffer.writeFlattenable(fShader.get());
34 buffer.writeRect(fSubset);
35}
T * get() const
Definition SkRefCnt.h:303
static const uint8_t buffer[]

◆ shader()

sk_sp< SkShader > SkCoordClampShader::shader ( ) const
inline

Definition at line 30 of file SkCoordClampShader.h.

30{ return fShader; }

◆ subset()

SkRect SkCoordClampShader::subset ( ) const
inline

Definition at line 31 of file SkCoordClampShader.h.

31{ return fSubset; }

◆ type()

ShaderType SkCoordClampShader::type ( ) const
inlineoverridevirtual

Implements SkShaderBase.

Definition at line 28 of file SkCoordClampShader.h.

28{ return ShaderType::kCoordClamp; }

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