Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SkShaderBase::Context Class Referenceabstract

#include <SkShaderBase.h>

Inheritance diagram for SkShaderBase::Context:
SkNoncopyable BitmapProcShaderContext

Public Member Functions

 Context (const SkShaderBase &shader, const ContextRec &)
 
virtual ~Context ()
 
virtual uint32_t getFlags () const
 
virtual void shadeSpan (int x, int y, SkPMColor[], int count)=0
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Protected Member Functions

uint8_t getPaintAlpha () const
 
const SkMatrixgetTotalInverse () const
 

Protected Attributes

const SkShaderBasefShader
 

Detailed Description

Definition at line 297 of file SkShaderBase.h.

Constructor & Destructor Documentation

◆ Context()

SkShaderBase::Context::Context ( const SkShaderBase shader,
const ContextRec rec 
)

Definition at line 108 of file SkShaderBase.cpp.

109 : fShader(shader) {
110 // We should never use a context with perspective.
111 SkASSERT(!rec.fMatrixRec.totalMatrix().hasPerspective());
112
113 // Because the context parameters must be valid at this point, we know that the matrix is
114 // invertible.
115 SkAssertResult(rec.fMatrixRec.totalInverse(&fTotalInverse));
116
117 fPaintAlpha = rec.fPaintAlpha;
118}
#define SkAssertResult(cond)
Definition SkAssert.h:123
#define SkASSERT(cond)
Definition SkAssert.h:116
const SkShaderBase & fShader

◆ ~Context()

SkShaderBase::Context::~Context ( )
virtual

Definition at line 120 of file SkShaderBase.cpp.

120{}

Member Function Documentation

◆ getFlags()

virtual uint32_t SkShaderBase::Context::getFlags ( ) const
inlinevirtual

Called sometimes before drawing with this shader. Return the type of alpha your shader will return. The default implementation returns 0. Your subclass should override if it can (even sometimes) report a non-zero value, since that will enable various blitters to perform faster.

Reimplemented in BitmapProcShaderContext.

Definition at line 310 of file SkShaderBase.h.

310{ return 0; }

◆ getPaintAlpha()

uint8_t SkShaderBase::Context::getPaintAlpha ( ) const
inlineprotected

Definition at line 323 of file SkShaderBase.h.

323{ return fPaintAlpha; }

◆ getTotalInverse()

const SkMatrix & SkShaderBase::Context::getTotalInverse ( ) const
inlineprotected

Definition at line 324 of file SkShaderBase.h.

324{ return fTotalInverse; }

◆ shadeSpan()

virtual void SkShaderBase::Context::shadeSpan ( int  x,
int  y,
SkPMColor  [],
int  count 
)
pure virtual

Called for each span of the object being drawn. Your subclass should set the appropriate colors (with premultiplied alpha) that correspond to the specified device coordinates.

Implemented in BitmapProcShaderContext.

Member Data Documentation

◆ fShader

const SkShaderBase& SkShaderBase::Context::fShader
protected

Definition at line 321 of file SkShaderBase.h.


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