Index: gm/matrixconvolution.cpp |
diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp |
index 1e6a49d4b6b480c80a07bce7afb33cfc29b9c9dc..6d16f8dfa74df4f5e92a93c176f8e527a1375f67 100644 |
--- a/gm/matrixconvolution.cpp |
+++ b/gm/matrixconvolution.cpp |
@@ -14,17 +14,17 @@ namespace skiagm { |
class MatrixConvolutionGM : public GM { |
public: |
- MatrixConvolutionGM() : fInitialized(false) { |
+ MatrixConvolutionGM() { |
this->setBGColor(0x00000000); |
} |
protected: |
- virtual SkString onShortName() { |
+ SkString onShortName() override { |
return SkString("matrixconvolution"); |
} |
- void make_bitmap() { |
+ void makeBitmap() { |
fBitmap.allocN32Pixels(80, 80); |
SkCanvas canvas(fBitmap); |
canvas.clear(0x00000000); |
@@ -43,7 +43,7 @@ protected: |
canvas.drawText(str, strlen(str), SkIntToScalar(-10), SkIntToScalar(80), paint); |
} |
- virtual SkISize onISize() { |
+ SkISize onISize() override { |
return SkISize::Make(500, 300); |
} |
@@ -79,11 +79,11 @@ protected: |
typedef SkMatrixConvolutionImageFilter MCIF; |
- virtual void onDraw(SkCanvas* canvas) { |
- if (!fInitialized) { |
- make_bitmap(); |
- fInitialized = true; |
- } |
+ void onOnceBeforeDraw() override { |
+ this->makeBitmap(); |
+ } |
+ |
+ void onDraw(SkCanvas* canvas) override { |
canvas->clear(SK_ColorBLACK); |
SkIPoint kernelOffset = SkIPoint::Make(1, 0); |
for (int x = 10; x < 310; x += 100) { |
@@ -104,14 +104,13 @@ protected: |
} |
private: |
- typedef GM INHERITED; |
SkBitmap fBitmap; |
- bool fInitialized; |
+ |
+ typedef GM INHERITED; |
}; |
////////////////////////////////////////////////////////////////////////////// |
-static GM* MyFactory(void*) { return new MatrixConvolutionGM; } |
-static GMRegistry reg(MyFactory); |
+DEF_GM(return new MatrixConvolutionGM;) |
} |