Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions
SkPDFGradientShader Namespace Reference

Classes

struct  Key
 
struct  KeyHash
 

Functions

SkPDFIndirectReference Make (SkPDFDocument *doc, SkShader *shader, const SkMatrix &matrix, const SkIRect &surfaceBBox)
 
bool operator== (const SkShaderBase::GradientInfo &u, const SkShaderBase::GradientInfo &v)
 
bool operator== (const Key &u, const Key &v)
 
bool operator!= (const Key &u, const Key &v)
 

Function Documentation

◆ Make()

SkPDFIndirectReference SkPDFGradientShader::Make ( SkPDFDocument doc,
SkShader shader,
const SkMatrix matrix,
const SkIRect surfaceBBox 
)

Definition at line 1004 of file SkPDFGradientShader.cpp.

1007 {
1008 SkASSERT(shader);
1009 SkASSERT(as_SB(shader)->asGradient() != SkShaderBase::GradientType::kNone);
1010 SkPDFGradientShader::Key key = make_key(shader, canvasTransform, bbox);
1011 bool alpha = gradient_has_alpha(key);
1012 return find_pdf_shader(doc, std::move(key), alpha);
1013}
#define SkASSERT(cond)
Definition SkAssert.h:116
static SkPDFIndirectReference find_pdf_shader(SkPDFDocument *doc, SkPDFGradientShader::Key key, bool keyHasAlpha)
static bool gradient_has_alpha(const SkPDFGradientShader::Key &key)
static SkPDFGradientShader::Key make_key(const SkShader *shader, const SkMatrix &canvasTransform, const SkIRect &bbox)
SkShaderBase * as_SB(SkShader *shader)

◆ operator!=()

bool SkPDFGradientShader::operator!= ( const Key u,
const Key v 
)
inline

Definition at line 64 of file SkPDFGradientShader.h.

64{ return !(u == v); }

◆ operator==() [1/2]

bool SkPDFGradientShader::operator== ( const Key u,
const Key v 
)
inline

Definition at line 53 of file SkPDFGradientShader.h.

53 {
54 SkASSERT(u.fInfo.fColors == u.fColors.get());
55 SkASSERT(u.fInfo.fColorOffsets == u.fStops.get());
56 SkASSERT(v.fInfo.fColors == v.fColors.get());
57 SkASSERT(v.fInfo.fColorOffsets == v.fStops.get());
58 return u.fType == v.fType
59 && u.fInfo == v.fInfo
62 && u.fBBox == v.fBBox;
63}
SkShaderBase::GradientType fType
std::unique_ptr< SkScalar[]> fStops
std::unique_ptr< SkColor[]> fColors
SkShaderBase::GradientInfo fInfo
SkColor * fColors
The colors in the gradient.
SkScalar * fColorOffsets
The unit offset for color transitions.

◆ operator==() [2/2]

bool SkPDFGradientShader::operator== ( const SkShaderBase::GradientInfo u,
const SkShaderBase::GradientInfo v 
)
inline

Definition at line 41 of file SkPDFGradientShader.h.

41 {
42 return u.fColorCount == v.fColorCount
43 && u.fPoint[0] == v.fPoint[0]
44 && u.fPoint[1] == v.fPoint[1]
45 && u.fRadius[0] == v.fRadius[0]
46 && u.fRadius[1] == v.fRadius[1]
47 && u.fTileMode == v.fTileMode
51}
bool SkPackedArrayEqual(T *u, T *v, size_t n)
Definition SkPDFUtils.h:27
uint32_t fGradientFlags
see SkGradientShader::Flags
SkPoint fPoint[2]
Type specific, see above.
int fColorCount
In-out parameter, specifies passed size.
SkScalar fRadius[2]
Type specific, see above.