23 SkASSERT(hardStopCount <= colorCount/2);
25 fName.
printf(
"hardstop_scale_num_hard_stops_%03d_colors_%03d_hard_stops",
26 colorCount, hardStopCount);
28 fColorCount = colorCount;
29 fHardStopCount = hardStopCount;
47 constexpr int kNumColorChoices = 4;
48 SkColor color_choices[kNumColorChoices] = {
57 for (
int i = 0;
i < fColorCount;
i++) {
58 colors[
i] = color_choices[
i % kNumColorChoices];
65 for (
int i = 0;
i < fHardStopCount;
i++) {
67 positions[k++] = val / fColorCount;
68 positions[k++] = val / fColorCount;
70 for (
int i = k;
i < fColorCount;
i++) {
71 positions[
i] =
i / (fColorCount - 1.0f);
87 for (
int i = 0;
i < loops;
i++) {
93 static const int kSize = 500;
static const int points[]
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
void onPreDraw(SkCanvas *canvas) override
HardStopGradientBench_ScaleNumHardStops(int colorCount, int hardStopCount)
void onDraw(int loops, SkCanvas *canvas) override
SkISize onGetSize() override
const char * onGetName() override
void drawPaint(const SkPaint &paint)
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)
void setShader(sk_sp< SkShader > shader)
void printf(const char format[],...) SK_PRINTF_LIKE(2
const char * c_str() const
PODArray< SkColor > colors
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkPoint Make(float x, float y)