20 if (fColorStops.empty()) {
24 std::vector<SkColor4f>
colors;
25 std::vector<SkScalar> positions;
26 colors.reserve(fColorStops.size());
27 positions.reserve(fColorStops.size());
30 for (
const auto& stop : fColorStops) {
31 colors.push_back(stop.fColor);
32 position =
SkTPin(stop.fPosition, position, 1.0f);
33 positions.push_back(position);
41 const std::vector<SkScalar >& positions)
const {
44 const SkPoint pts[] = { fStartPoint, fEndPoint };
50 const std::vector<SkScalar >& positions)
const {
53 return (fStartRadius <= 0 && fStartCenter == fEndCenter)
55 colors.data(),
nullptr, positions.data(),
58 fEndCenter, fEndRadius,
59 colors.data(),
nullptr, positions.data(),
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
constexpr int SkToInt(S x)
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
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)
virtual sk_sp< SkShader > onMakeShader(const std::vector< SkColor4f > &colors, const std::vector< SkScalar > &positions) const =0
sk_sp< SkShader > onRevalidateShader() final
sk_sp< SkShader > onMakeShader(const std::vector< SkColor4f > &, const std::vector< SkScalar > &) const override
sk_sp< SkShader > onMakeShader(const std::vector< SkColor4f > &, const std::vector< SkScalar > &) const override
PODArray< SkColor > colors