Index: gm/morphology.cpp |
diff --git a/gm/morphology.cpp b/gm/morphology.cpp |
index 3fb11d82d1970759b5c3635eb0051af5179254fe..c3326f9397ca91cd29e3f4ca325d49d2a109a19b 100644 |
--- a/gm/morphology.cpp |
+++ b/gm/morphology.cpp |
@@ -17,15 +17,14 @@ class MorphologyGM : public GM { |
public: |
MorphologyGM() { |
this->setBGColor(0xFF000000); |
- fOnce = false; |
} |
protected: |
- virtual SkString onShortName() { |
+ SkString onShortName() override { |
return SkString("morphology"); |
} |
- void make_bitmap() { |
+ void onOnceBeforeDraw() override { |
fBitmap.allocN32Pixels(135, 135); |
SkCanvas canvas(fBitmap); |
canvas.clear(0x0); |
@@ -40,7 +39,7 @@ protected: |
canvas.drawText(str2, strlen(str2), 10, 110, paint); |
} |
- virtual SkISize onISize() { |
+ SkISize onISize() override { |
return SkISize::Make(WIDTH, HEIGHT); |
} |
@@ -53,11 +52,7 @@ protected: |
canvas->restore(); |
} |
- virtual void onDraw(SkCanvas* canvas) { |
- if (!fOnce) { |
- make_bitmap(); |
- fOnce = true; |
- } |
+ void onDraw(SkCanvas* canvas) override { |
struct { |
int fWidth, fHeight; |
int fRadiusX, fRadiusY; |
@@ -87,20 +82,19 @@ protected: |
nullptr, |
cr))->unref(); |
} |
- drawClippedBitmap(canvas, paint, i * 140, j * 140); |
+ this->drawClippedBitmap(canvas, paint, i * 140, j * 140); |
} |
} |
} |
private: |
- typedef GM INHERITED; |
SkBitmap fBitmap; |
- bool fOnce; |
+ |
+ typedef GM INHERITED; |
}; |
////////////////////////////////////////////////////////////////////////////// |
-static GM* MyFactory(void*) { return new MorphologyGM; } |
-static GMRegistry reg(MyFactory); |
+DEF_GM(return new MorphologyGM;) |
} |