38 matrix.setSinCos(-vec.
fY, vec.
fX, pts[0].
fX, pts[0].
fY);
39 matrix.postTranslate(-pts[0].fX, -pts[0].fY);
40 matrix.postScale(
inv,
inv);
51 SkMatrix legacyLocalMatrix, *lmPtr =
nullptr;
52 if (!desc.unflatten(
buffer, &legacyLocalMatrix)) {
56 lmPtr = &legacyLocalMatrix;
59 pts[0] =
buffer.readPoint();
60 pts[1] =
buffer.readPoint();
63 std::move(
desc.fColorSpace),
86 info->fPoint[0] = fStart;
87 info->fPoint[1] = fEnd;
92 return GradientType::kLinear;
109 if (1 == colorCount) {
110 return SkShaders::Color(colors[0], std::move(colorSpace));
112 if (localMatrix && !localMatrix->
invert(
nullptr)) {
123 colors,
pos, colorCount, std::move(colorSpace), mode);
127 colors, std::move(colorSpace),
pos, colorCount, mode, interpolation);
128 return SkLocalMatrixShader::MakeWrapped<SkLinearGradient>(localMatrix, pts, desc);
139 return MakeLinear(pts, converter.fColors4f.begin(),
nullptr,
pos, colorCount, mode,
flags,
static SkM44 inv(const SkM44 &m)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SK_REGISTER_FLATTENABLE(type)
static bool SkIsFinite(T x, Pack... values)
void SkRegisterLinearGradientShaderFlattenable()
static SkMatrix pts_to_unit_matrix(const SkPoint pts[2])
#define SkScalarInvert(x)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
static constexpr SkScalar kDegenerateThreshold
static bool ValidGradient(const SkColor4f colors[], int count, SkTileMode tileMode, const Interpolation &interpolation)
static sk_sp< SkShader > MakeDegenerateGradient(const SkColor4f colors[], const SkScalar pos[], int colorCount, sk_sp< SkColorSpace > colorSpace, SkTileMode mode)
void flatten(SkWriteBuffer &) const override
void commonAsAGradient(GradientInfo *) const
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
SkLinearGradient(const SkPoint pts[2], const Descriptor &)
void flatten(SkWriteBuffer &buffer) const override
void appendGradientStages(SkArenaAlloc *alloc, SkRasterPipeline *tPipeline, SkRasterPipeline *postPipeline) const final
GradientType asGradient(GradientInfo *info, SkMatrix *localMatrix) const override
bool invert(SkMatrix *inverse) const
static const SkMatrix & I()
static sk_sp< SkShader > MakeLinear()
FlutterSemanticsFlag flags
static const uint8_t buffer[]
void scale(float scale, SkPoint *dst) const