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

Unified Diff: gm/matrixconvolution.cpp

Issue 1320673011: Minor code cleanup (left over from prior CL) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/lightingshader.cpp ('k') | gm/offsetimagefilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;)
}
« no previous file with comments | « gm/lightingshader.cpp ('k') | gm/offsetimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698