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

Unified Diff: gm/morphology.cpp

Issue 1819393002: Switch SkMorphologyImageFilter over to new onFilterImage interface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 4 years, 9 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 | « no previous file | include/effects/SkMorphologyImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;)
}
« no previous file with comments | « no previous file | include/effects/SkMorphologyImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698