Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkPDFGradientShader.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#ifndef SkPDFGradientShader_DEFINED
8#define SkPDFGradientShader_DEFINED
9
11#include "src/pdf/SkPDFTypes.h"
12#include "src/pdf/SkPDFUtils.h"
14
15class SkMatrix;
16class SkPDFDocument;
17struct SkIRect;
18
19namespace SkPDFGradientShader {
20
22 SkShader* shader,
23 const SkMatrix& matrix,
24 const SkIRect& surfaceBBox);
25
36
37struct KeyHash {
38 uint32_t operator()(const Key& k) const { return k.fHash; }
39};
40
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}
52
53inline bool operator==(const Key& u, const Key& v) {
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}
64inline bool operator!=(const Key& u, const Key& v) { return !(u == v); }
65
66} // namespace SkPDFGradientShader
67#endif // SkPDFGradientShader_DEFINED
#define SkASSERT(cond)
Definition SkAssert.h:116
bool SkPackedArrayEqual(T *u, T *v, size_t n)
Definition SkPDFUtils.h:27
bool operator==(const SkShaderBase::GradientInfo &u, const SkShaderBase::GradientInfo &v)
bool operator!=(const Key &u, const Key &v)
SkPDFIndirectReference Make(SkPDFDocument *doc, SkShader *shader, const SkMatrix &matrix, const SkIRect &surfaceBBox)
uint32_t operator()(const Key &k) const
SkShaderBase::GradientType fType
std::unique_ptr< SkScalar[]> fStops
std::unique_ptr< SkColor[]> fColors
SkShaderBase::GradientInfo fInfo
uint32_t fGradientFlags
see SkGradientShader::Flags
SkPoint fPoint[2]
Type specific, see above.
SkColor * fColors
The colors in the gradient.
int fColorCount
In-out parameter, specifies passed size.
SkScalar fRadius[2]
Type specific, see above.
SkScalar * fColorOffsets
The unit offset for color transitions.