Remove SK_SUPPORT_LEGACY_GRADIENT_DITHERING from Skia proper
Migrating the flag to embedder defines (Chromium already guarded).
Also augment gradient-focused GMs to generate both dithered/undithered
results.
BUG=skia:4436
R=reed@google.com,robertphillips@google.com
Review URL: https://codereview.chromium.org/1400813006
diff --git a/gm/shallowgradient.cpp b/gm/shallowgradient.cpp
index b2a34f3..764b1a5 100644
--- a/gm/shallowgradient.cpp
+++ b/gm/shallowgradient.cpp
@@ -37,7 +37,9 @@
class ShallowGradientGM : public skiagm::GM {
public:
- ShallowGradientGM(MakeShaderProc proc, const char name[]) : fProc(proc) {
+ ShallowGradientGM(MakeShaderProc proc, const char name[], bool dither)
+ : fProc(proc)
+ , fDither(dither) {
fName.printf("shallow_gradient_%s", name);
}
@@ -61,19 +63,26 @@
SkPaint paint;
paint.setShader(fProc(colors, colorCount, size))->unref();
+ paint.setDither(fDither);
canvas->drawRect(r, paint);
}
private:
MakeShaderProc fProc;
SkString fName;
+ bool fDither;
typedef skiagm::GM INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
-DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); )
-DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); )
-DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); )
-DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); )
+DEF_GM( return new ShallowGradientGM(shader_linear, "linear", true); )
+DEF_GM( return new ShallowGradientGM(shader_radial, "radial", true); )
+DEF_GM( return new ShallowGradientGM(shader_conical, "conical", true); )
+DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep", true); )
+
+DEF_GM( return new ShallowGradientGM(shader_linear, "linear_nodither", false); )
+DEF_GM( return new ShallowGradientGM(shader_radial, "radial_nodither", false); )
+DEF_GM( return new ShallowGradientGM(shader_conical, "conical_nodither", false); )
+DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep_nodither", false); )