Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: gm/blurs.cpp

Issue 1333553002: GM: replace boilerplate with macros (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-09-09 (Wednesday) 11:01:10 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/blurrect.cpp ('k') | gm/clipdrawdraw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/blurs.cpp
diff --git a/gm/blurs.cpp b/gm/blurs.cpp
index d52a656963e4b1896ec8fd3ddbb4287e33103f71..8f2137eeabc651ca587bd941241a865a9489e1a7 100644
--- a/gm/blurs.cpp
+++ b/gm/blurs.cpp
@@ -10,23 +10,7 @@
#include "SkBlurMaskFilter.h"
#include "SkPath.h"
-class BlursGM : public skiagm::GM {
-public:
- BlursGM() {
- this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
- }
-
-protected:
-
- SkString onShortName() override {
- return SkString("blurs");
- }
-
- SkISize onISize() override {
- return SkISize::Make(700, 500);
- }
-
- void onDraw(SkCanvas* canvas) override {
+DEF_SIMPLE_GM_BG(blurs, canvas, 700, 500, sk_tool_utils::color_to_565(0xFFDDDDDD)) {
SkBlurStyle NONE = SkBlurStyle(-999);
static const struct {
SkBlurStyle fStyle;
@@ -85,12 +69,7 @@ protected:
flags = SkBlurMaskFilter::kHighQuality_BlurFlag;
canvas->translate(SkIntToScalar(350), SkIntToScalar(0));
}
- }
-
-private:
- typedef skiagm::GM INHERITED;
-};
-DEF_GM( return new BlursGM; )
+}
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -100,17 +79,7 @@ DEF_GM( return new BlursGM; )
// in particular, we want to notice that the 2nd rect draws slightly differently, since it
// is translated a fractional amount.
//
-class Blur2RectsGM : public skiagm::GM {
-public:
- SkString onShortName() override {
- return SkString("blur2rects");
- }
-
- SkISize onISize() override {
- return SkISize::Make(700, 500);
- }
-
- void onDraw(SkCanvas* canvas) override {
+DEF_SIMPLE_GM(blur2rects, canvas, 700, 500) {
SkPaint paint;
paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
@@ -128,21 +97,9 @@ public:
SkScalar dx = SkScalarRoundToScalar(path.getBounds().width()) + 14 + 0.25f;
canvas->translate(dx, 0);
canvas->drawPath(path, paint);
- }
-};
-DEF_GM( return new Blur2RectsGM; )
-
-class Blur2RectsNonNinePatchGM : public skiagm::GM {
-public:
- SkString onShortName() override {
- return SkString("blur2rectsnonninepatch");
- }
-
- SkISize onISize() override {
- return SkISize::Make(700, 500);
- }
+}
- void onDraw(SkCanvas* canvas) override {
+DEF_SIMPLE_GM(blur2rectsnonninepatch, canvas, 700, 500) {
SkPaint paint;
paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
4.3f))->unref();
@@ -162,6 +119,4 @@ public:
canvas->translate(-dx, 0);
canvas->translate(-30, -150);
canvas->drawPath(path, paint);
- }
-};
-DEF_GM( return new Blur2RectsNonNinePatchGM; )
+}
« no previous file with comments | « gm/blurrect.cpp ('k') | gm/clipdrawdraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698