7#ifndef SkTriColorShader_DEFINED
8#define SkTriColorShader_DEFINED
20 SkTriColorShader(
bool isOpaque,
bool usePersp) : fIsOpaque(isOpaque), fUsePersp(usePersp) {}
36 bool isOpaque()
const override {
return fIsOpaque; }
38 Factory getFactory()
const override {
return nullptr; }
39 const char* getTypeName()
const override {
return nullptr; }
45 void setConcat(
const Matrix43
a,
const SkMatrix&
b) {
48 fMat[0] =
a.dot(0,
b.getScaleX(),
b.getSkewY());
49 fMat[1] =
a.dot(1,
b.getScaleX(),
b.getSkewY());
50 fMat[2] =
a.dot(2,
b.getScaleX(),
b.getSkewY());
51 fMat[3] =
a.dot(3,
b.getScaleX(),
b.getSkewY());
53 fMat[4] =
a.dot(0,
b.getSkewX(),
b.getScaleY());
54 fMat[5] =
a.dot(1,
b.getSkewX(),
b.getScaleY());
55 fMat[6] =
a.dot(2,
b.getSkewX(),
b.getScaleY());
56 fMat[7] =
a.dot(3,
b.getSkewX(),
b.getScaleY());
58 fMat[8] =
a.dot(0,
b.getTranslateX(),
b.getTranslateY()) +
a.fMat[8];
59 fMat[9] =
a.dot(1,
b.getTranslateX(),
b.getTranslateY()) +
a.fMat[9];
60 fMat[10] =
a.dot(2,
b.getTranslateX(),
b.getTranslateY()) +
a.fMat[10];
61 fMat[11] =
a.dot(3,
b.getTranslateX(),
b.getTranslateY()) +
a.fMat[11];
65 float dot(
int index,
float x,
float y)
const {
66 return fMat[index + 0] *
x + fMat[index + 4] *
y;
sk_sp< SkFlattenable >(* Factory)(SkReadBuffer &)
SkTriColorShader(bool isOpaque, bool usePersp)
ShaderType type() const override
bool appendStages(const SkStageRec &rec, const SkShaders::MatrixRec &) const override
bool update(const SkMatrix &ctmInv, const SkPoint pts[], const SkPMColor4f colors[], int index0, int index1, int index2)
PODArray< SkColor > colors
SINT T dot(const Vec< N, T > &a, const Vec< N, T > &b)