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

#include <SkLocalMatrixShader.h>

Inheritance diagram for SkLocalMatrixShader:
SkShaderBase SkShader SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkLocalMatrixShader (sk_sp< SkShader > wrapped, const SkMatrix &localMatrix)
 
bool isOpaque () const override
 
bool isConstant () const override
 
GradientType asGradient (GradientInfo *info, SkMatrix *localMatrix) const override
 
ShaderType type () const override
 
sk_sp< SkShadermakeAsALocalMatrixShader (SkMatrix *localMatrix) const override
 
const SkMatrixlocalMatrix () const
 
sk_sp< SkShaderwrappedShader () 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
 

Static Public Member Functions

template<typename T , typename... Args>
static std::enable_if_t< std::is_base_of_v< SkShader, T >, sk_sp< SkShader > > MakeWrapped (const SkMatrix *localMatrix, Args &&... args)
 
- 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)
 

Protected Member Functions

void flatten (SkWriteBuffer &) const override
 
SkImageonIsAImage (SkMatrix *matrix, SkTileMode *mode) const override
 
bool onAsLuminanceColor (SkColor4f *) 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 &)
 

Detailed Description

Definition at line 29 of file SkLocalMatrixShader.h.

Constructor & Destructor Documentation

◆ SkLocalMatrixShader()

SkLocalMatrixShader::SkLocalMatrixShader ( sk_sp< SkShader wrapped,
const SkMatrix localMatrix 
)
inline

Definition at line 41 of file SkLocalMatrixShader.h.

42 : fLocalMatrix(localMatrix), fWrappedShader(std::move(wrapped)) {}
static sk_sp< GrTextureProxy > wrapped(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)
const SkMatrix & localMatrix() const

Member Function Documentation

◆ appendStages()

bool SkLocalMatrixShader::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 65 of file SkLocalMatrixShader.cpp.

66 {
67 return as_SB(fWrappedShader)->appendStages(rec, mRec.concat(fLocalMatrix));
68}
SkShaderBase * as_SB(SkShader *shader)
Definition: SkShaderBase.h:412
virtual bool appendStages(const SkStageRec &, const SkShaders::MatrixRec &) const =0

◆ asGradient()

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

Reimplemented from SkShaderBase.

Definition at line 20 of file SkLocalMatrixShader.cpp.

21 {
22 GradientType type = as_SB(fWrappedShader)->asGradient(info, localMatrix);
25 }
26 return type;
27}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
ShaderType type() const override
virtual GradientType asGradient(GradientInfo *info=nullptr, SkMatrix *localMatrix=nullptr) const
Definition: SkShaderBase.h:255
static SkMatrix ConcatLocalMatrices(const SkMatrix &parentLM, const SkMatrix &childLM)
Definition: SkShaderBase.h:384

◆ flatten()

void SkLocalMatrixShader::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 39 of file SkLocalMatrixShader.cpp.

39 {
40 buffer.writeMatrix(fLocalMatrix);
41 buffer.writeFlattenable(fWrappedShader.get());
42}
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

◆ isConstant()

bool SkLocalMatrixShader::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 16 of file SkLocalMatrixShader.cpp.

16 {
17 return as_SB(fWrappedShader)->isConstant();
18}
virtual bool isConstant() const
Definition: SkShaderBase.h:197

◆ isOpaque()

bool SkLocalMatrixShader::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 44 of file SkLocalMatrixShader.h.

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

◆ localMatrix()

const SkMatrix & SkLocalMatrixShader::localMatrix ( ) const
inline

Definition at line 57 of file SkLocalMatrixShader.h.

57{ return fLocalMatrix; }

◆ makeAsALocalMatrixShader()

sk_sp< SkShader > SkLocalMatrixShader::makeAsALocalMatrixShader ( SkMatrix localMatrix) const
inlineoverridevirtual

DEPRECATED. skbug.com/8941 If this shader can be represented by another shader + a localMatrix, return that shader and the localMatrix. If not, return nullptr and ignore the localMatrix parameter.

Reimplemented from SkShaderBase.

Definition at line 50 of file SkLocalMatrixShader.h.

50 {
51 if (localMatrix) {
52 *localMatrix = fLocalMatrix;
53 }
54 return fWrappedShader;
55 }

◆ MakeWrapped()

template<typename T , typename... Args>
static std::enable_if_t< std::is_base_of_v< SkShader, T >, sk_sp< SkShader > > SkLocalMatrixShader::MakeWrapped ( const SkMatrix localMatrix,
Args &&...  args 
)
inlinestatic

Definition at line 33 of file SkLocalMatrixShader.h.

33 {
34 auto t = sk_make_sp<T>(std::forward<Args>(args)...);
35 if (localMatrix) {
36 return t->makeWithLocalMatrix(*localMatrix);
37 }
38 return t;
39 }
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ onAsLuminanceColor()

bool SkLocalMatrixShader::onAsLuminanceColor ( SkColor4f color) const
overrideprotectedvirtual

Reimplemented from SkShaderBase.

Definition at line 61 of file SkLocalMatrixShader.cpp.

61 {
62 return as_SB(fWrappedShader)->asLuminanceColor(color);
63}
bool asLuminanceColor(SkColor4f *) const
DlColor color

◆ onIsAImage()

SkImage * SkLocalMatrixShader::onIsAImage ( SkMatrix matrix,
SkTileMode mode 
) const
overrideprotected

Definition at line 51 of file SkLocalMatrixShader.cpp.

51 {
52 SkMatrix imageMatrix;
53 SkImage* image = fWrappedShader->isAImage(&imageMatrix, mode);
54 if (image && outMatrix) {
55 *outMatrix = ConcatLocalMatrices(fLocalMatrix, imageMatrix);
56 }
57
58 return image;
59}
SkImage * isAImage(SkMatrix *localMatrix, SkTileMode xy[2]) const
Definition: SkShader.cpp:22
sk_sp< const SkImage > image
Definition: SkRecords.h:269
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

◆ type()

ShaderType SkLocalMatrixShader::type ( ) const
inlineoverridevirtual

Implements SkShaderBase.

Definition at line 48 of file SkLocalMatrixShader.h.

48{ return ShaderType::kLocalMatrix; }

◆ wrappedShader()

sk_sp< SkShader > SkLocalMatrixShader::wrappedShader ( ) const
inline

Definition at line 58 of file SkLocalMatrixShader.h.

58{ return fWrappedShader; }

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