aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/imageblur.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gm/imageblur.cpp')
-rw-r--r--gm/imageblur.cpp46
1 files changed, 7 insertions, 39 deletions
diff --git a/gm/imageblur.cpp b/gm/imageblur.cpp
index f6ac0982b7..575f02c095 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);
}