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

Unified Diff: gm/imageblur.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/hittestpath.cpp ('k') | gm/imagefilters.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imageblur.cpp
diff --git a/gm/imageblur.cpp b/gm/imageblur.cpp
index f6ac0982b7762ba2e57a1f8eb00a608c7efd7871..575f02c095a0aacd4b98c954de0f58452c525e87 100644
--- a/gm/imageblur.cpp
+++ b/gm/imageblur.cpp
@@ -12,27 +12,7 @@
#define WIDTH 500
#define HEIGHT 500
-namespace skiagm {
-
-class ImageBlurGM : public GM {
-public:
- ImageBlurGM(SkScalar sigmaX, SkScalar sigmaY, const char* suffix)
- : fSigmaX(sigmaX), fSigmaY(sigmaY) {
- this->setBGColor(0xFF000000);
- fName.printf("imageblur%s", suffix);
- }
-
-protected:
-
- SkString onShortName() override {
- return fName;
- }
-
- SkISize onISize() override {
- return SkISize::Make(WIDTH, HEIGHT);
- }
-
- void onDraw(SkCanvas* canvas) override {
+void imageblurgm_draw(SkScalar fSigmaX, SkScalar fSigmaY, SkCanvas* canvas) {
SkPaint paint;
paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref();
canvas->saveLayer(nullptr, &paint);
@@ -51,22 +31,10 @@ protected:
SkIntToScalar(y), textPaint);
}
canvas->restore();
- }
-
-private:
- SkScalar fSigmaX;
- SkScalar fSigmaY;
- SkString fName;
-
- typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static GM* MyFactory1(void*) { return new ImageBlurGM(24.0f, 0.0f, ""); }
-static GMRegistry reg1(MyFactory1);
-
-static GM* MyFactory2(void*) { return new ImageBlurGM(80.0f, 80.0f, "_large"); }
-static GMRegistry reg2(MyFactory2);
-
+}
+DEF_SIMPLE_GM_BG(imageblur, canvas, WIDTH, HEIGHT, SK_ColorBLACK) {
+ imageblurgm_draw(24.0f, 0.0f, canvas);
+}
+DEF_SIMPLE_GM_BG(imageblur_large, canvas, WIDTH, HEIGHT, SK_ColorBLACK) {
+ imageblurgm_draw(80.0f, 80.0f, canvas);
}
« no previous file with comments | « gm/hittestpath.cpp ('k') | gm/imagefilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698