41 , fTScale(1 / (t1 - t0)) {
49 info->fPoint[0] = fCenter;
54 return GradientType::kSweep;
63 SkMatrix legacyLocalMatrix, *lmPtr =
nullptr;
64 if (!
desc.unflatten(
buffer, &legacyLocalMatrix)) {
68 lmPtr = &legacyLocalMatrix;
78 std::move(
desc.fColorSpace),
90 buffer.writePoint(fCenter);
91 buffer.writeScalar(fTBias);
92 buffer.writeScalar(fTScale);
97 p->append(SkRasterPipelineOp::xy_to_unit_angle);
114 if (1 == colorCount) {
115 return SkShaders::Color(colors[0], std::move(colorSpace));
117 if (!
SkIsFinite(startAngle, endAngle) || startAngle > endAngle) {
120 if (localMatrix && !localMatrix->
invert(
nullptr)) {
131 static constexpr SkScalar clampPos[3] = {0, 1, 1};
132 SkColor4f reColors[3] = {colors[0], colors[0], colors[colorCount - 1]};
133 return MakeSweep(cx, cy, reColors, std::move(colorSpace), clampPos, 3, mode, 0,
134 endAngle, interpolation, localMatrix);
137 colors,
pos, colorCount, std::move(colorSpace), mode);
141 if (startAngle <= 0 && endAngle >= 360) {
147 colors, std::move(colorSpace),
pos, colorCount, mode, interpolation);
149 const SkScalar t0 = startAngle / 360,
152 return SkLocalMatrixShader::MakeWrapped<SkSweepGradient>(localMatrix,
168 return MakeSweep(cx, cy, converter.fColors4f.begin(),
nullptr,
pos, colorCount,
169 mode, startAngle, endAngle,
flags, localMatrix);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SK_REGISTER_FLATTENABLE(type)
static bool SkIsFinite(T x, Pack... values)
static constexpr float sk_ieee_float_divide(float numer, float denom)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
static std::tuple< SkScalar, SkScalar > angles_from_t_coeff(SkScalar tBias, SkScalar tScale)
void SkRegisterSweepGradientShaderFlattenable()
static SkScalar center(float pos0, float pos1)
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 > MakeSweep(SkScalar cx, SkScalar cy, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, uint32_t flags, const SkMatrix *localMatrix)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
bool invert(SkMatrix *inverse) const
static const SkMatrix & I()
void flatten(SkWriteBuffer &buffer) const override
GradientType asGradient(GradientInfo *info, SkMatrix *localMatrix) const override
SkSweepGradient(const SkPoint ¢er, SkScalar t0, SkScalar t1, const Descriptor &)
const SkPoint & center() const
void appendGradientStages(SkArenaAlloc *alloc, SkRasterPipeline *tPipeline, SkRasterPipeline *postPipeline) const override
FlutterSemanticsFlag flags
static const uint8_t buffer[]
static constexpr SkPoint Make(float x, float y)
constexpr float y() const
constexpr float x() const