From 063675ba374cb520fe58bbcdaf5afeea0aa0ad60 Mon Sep 17 00:00:00 2001 From: fmalita Date: Mon, 12 Oct 2015 10:41:48 -0700 Subject: 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 --- gm/gradients_no_texture.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'gm/gradients_no_texture.cpp') diff --git a/gm/gradients_no_texture.cpp b/gm/gradients_no_texture.cpp index 3e73d1b4b3..726a14fd26 100644 --- a/gm/gradients_no_texture.cpp +++ b/gm/gradients_no_texture.cpp @@ -80,13 +80,16 @@ static const GradMaker gGradMakers[] = { class GradientsNoTextureGM : public GM { public: - GradientsNoTextureGM() { + GradientsNoTextureGM(bool dither) : fDither(dither) { this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); } protected: - SkString onShortName() override { return SkString("gradients_no_texture"); } + SkString onShortName() override { + return SkString(fDither ? "gradients_no_texture" : "gradients_no_texture_nodither"); + } + SkISize onISize() override { return SkISize::Make(640, 615); } void onDraw(SkCanvas* canvas) override { @@ -96,6 +99,7 @@ protected: SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) }; SkPaint paint; paint.setAntiAlias(true); + paint.setDither(fDither); canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); static const uint8_t kAlphas[] = { 0xff, 0x40 }; @@ -116,6 +120,8 @@ protected: } private: + bool fDither; + typedef GM INHERITED; }; @@ -205,11 +211,14 @@ class GradientsManyColorsGM : public GM { typedef void (*Proc)(ColorPos*); public: - GradientsManyColorsGM() {} + GradientsManyColorsGM(bool dither) : fDither(dither) {} protected: - SkString onShortName() override { return SkString("gradients_many"); } + SkString onShortName() override { + return SkString(fDither ? "gradients_many" : "gradients_many_nodither"); + } + SkISize onISize() override { return SkISize::Make(850, 100); } void onDraw(SkCanvas* canvas) override { @@ -223,6 +232,7 @@ protected: const SkRect r = SkRect::MakeWH(SkIntToScalar(W), 30); SkPaint paint; + paint.setDither(fDither); canvas->translate(20, 20); @@ -243,10 +253,14 @@ protected: } private: + bool fDither; + typedef GM INHERITED; }; /////////////////////////////////////////////////////////////////////////////// -DEF_GM(return new GradientsNoTextureGM); -DEF_GM(return new GradientsManyColorsGM); +DEF_GM(return new GradientsNoTextureGM(true);) +DEF_GM(return new GradientsNoTextureGM(false);) +DEF_GM(return new GradientsManyColorsGM(true);) +DEF_GM(return new GradientsManyColorsGM(false);) -- cgit v1.2.3