aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/gradients_2pt_conical.cpp
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2015-10-12 10:41:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-12 10:41:48 -0700
commit063675ba374cb520fe58bbcdaf5afeea0aa0ad60 (patch)
tree6e84670d0f050d81d906eb8247387337e31f6601 /gm/gradients_2pt_conical.cpp
parentafa95e270c64c9777647b6c58b796750ced57c39 (diff)
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
Diffstat (limited to 'gm/gradients_2pt_conical.cpp')
-rw-r--r--gm/gradients_2pt_conical.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/gm/gradients_2pt_conical.cpp b/gm/gradients_2pt_conical.cpp
index 1e32426547..39ebb4a1f9 100644
--- a/gm/gradients_2pt_conical.cpp
+++ b/gm/gradients_2pt_conical.cpp
@@ -305,10 +305,12 @@ enum GradCaseType { // these must match the order in gGradCases
class ConicalGradientsGM : public GM {
public:
- ConicalGradientsGM(GradCaseType gradCaseType) {
+ ConicalGradientsGM(GradCaseType gradCaseType, bool dither)
+ : fGradCaseType(gradCaseType)
+ , fDither(dither) {
this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
- fName.printf("gradients_2pt_conical_%s", gGradCases[gradCaseType].fName);
- fGradCaseType = gradCaseType;
+ fName.printf("gradients_2pt_conical_%s%s", gGradCases[gradCaseType].fName,
+ fDither ? "" : "_nodither");
}
protected:
@@ -328,6 +330,7 @@ protected:
SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) };
SkPaint paint;
paint.setAntiAlias(true);
+ paint.setDither(fDither);
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
@@ -360,15 +363,16 @@ private:
GradCaseType fGradCaseType;
SkString fName;
+ bool fDither;
};
///////////////////////////////////////////////////////////////////////////////
-static GM* MyFactory1(void*) { return new ConicalGradientsGM(kInside_GradCaseType); }
-static GMRegistry reg1(MyFactory1);
+DEF_GM( return new ConicalGradientsGM(kInside_GradCaseType, true); )
+DEF_GM( return new ConicalGradientsGM(kOutside_GradCaseType, true); )
+DEF_GM( return new ConicalGradientsGM(kEdge_GradCaseType, true); )
-static GM* MyFactory2(void*) { return new ConicalGradientsGM(kOutside_GradCaseType); }
-static GMRegistry reg2(MyFactory2);
+DEF_GM( return new ConicalGradientsGM(kInside_GradCaseType, false); )
+DEF_GM( return new ConicalGradientsGM(kOutside_GradCaseType, false); )
+DEF_GM( return new ConicalGradientsGM(kEdge_GradCaseType, false); )
-static GM* MyFactory3(void*) { return new ConicalGradientsGM(kEdge_GradCaseType); }
-static GMRegistry reg3(MyFactory3);
}