Flutter Engine
The Flutter Engine
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 1028 of file SkPDFGradientShader.cpp.

1031 {
1032 SkASSERT(shader);
1033 SkASSERT(as_SB(shader)->asGradient() != SkShaderBase::GradientType::kNone);
1034 SkPDFGradientShader::Key key = make_key(shader, canvasTransform, bbox);
1035 bool alpha = gradient_has_alpha(key);
1036 return find_pdf_shader(doc, std::move(key), alpha);
1037}
#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)
Definition: SkShaderBase.h:412

◆ operator!=()

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

Definition at line 71 of file SkPDFGradientShader.h.

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

◆ operator==() [1/2]

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

Definition at line 60 of file SkPDFGradientShader.h.

60 {
61 SkASSERT(u.fInfo.fColors == u.fColors.get());
62 SkASSERT(u.fInfo.fColorOffsets == u.fStops.get());
63 SkASSERT(v.fInfo.fColors == v.fColors.get());
64 SkASSERT(v.fInfo.fColorOffsets == v.fStops.get());
65 return u.fType == v.fType
66 && u.fInfo == v.fInfo
69 && u.fBBox == v.fBBox;
70}
SkShaderBase::GradientType fType
std::unique_ptr< SkScalar[]> fStops
std::unique_ptr< SkColor[]> fColors
SkShaderBase::GradientInfo fInfo
SkColor * fColors
The colors in the gradient.
Definition: SkShaderBase.h:247
SkScalar * fColorOffsets
The unit offset for color transitions.
Definition: SkShaderBase.h:248

◆ operator==() [2/2]

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

Definition at line 48 of file SkPDFGradientShader.h.

48 {
49 return u.fColorCount == v.fColorCount
50 && u.fPoint[0] == v.fPoint[0]
51 && u.fPoint[1] == v.fPoint[1]
52 && u.fRadius[0] == v.fRadius[0]
53 && u.fRadius[1] == v.fRadius[1]
54 && u.fTileMode == v.fTileMode
58}
bool SkPackedArrayEqual(T *u, T *v, size_t n)
Definition: SkPDFUtils.h:39
uint32_t fGradientFlags
see SkGradientShader::Flags
Definition: SkShaderBase.h:252
SkPoint fPoint[2]
Type specific, see above.
Definition: SkShaderBase.h:249
int fColorCount
In-out parameter, specifies passed size.
Definition: SkShaderBase.h:243
SkScalar fRadius[2]
Type specific, see above.
Definition: SkShaderBase.h:250