Flutter Engine
The Flutter Engine
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 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

 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) {}
SkRect subset() const
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)
Definition: SkShaderBase.h:412
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
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

◆ 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: