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

Unified Diff: gm/imagefiltersgraph.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/imagefiltersclipped.cpp ('k') | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefiltersgraph.cpp
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index 66b32e99c340c4f38a306531bbf7238edd5911b1..3f9fe3fa95167192a4909025c7b599f4a3d37021 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -103,23 +103,10 @@ public:
protected:
- virtual SkString onShortName() {
+ SkString onShortName() override {
return SkString("imagefiltersgraph");
}
- void make_bitmap() {
- fBitmap.allocN32Pixels(100, 100);
- SkCanvas canvas(fBitmap);
- canvas.clear(SK_ColorTRANSPARENT);
- SkPaint paint;
- paint.setAntiAlias(true);
- sk_tool_utils::set_portable_typeface(&paint);
- paint.setColor(SK_ColorWHITE);
- paint.setTextSize(SkIntToScalar(96));
- const char* str = "e";
- canvas.drawText(str, strlen(str), SkIntToScalar(20), SkIntToScalar(70), paint);
- }
-
void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, const SkPaint& paint) {
canvas->save();
canvas->clipRect(SkRect::MakeXYWH(0, 0,
@@ -128,13 +115,13 @@ protected:
canvas->restore();
}
- virtual SkISize onISize() { return SkISize::Make(500, 150); }
+ SkISize onISize() override { return SkISize::Make(500, 150); }
- virtual void onOnceBeforeDraw() {
- this->make_bitmap();
+ void onOnceBeforeDraw() override {
+ fBitmap = sk_tool_utils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70, 96, "e");
}
- virtual void onDraw(SkCanvas* canvas) {
+ void onDraw(SkCanvas* canvas) override {
canvas->clear(SK_ColorBLACK);
{
SkAutoTUnref<SkImageFilter> bitmapSource(SkBitmapSource::Create(fBitmap));
@@ -229,5 +216,4 @@ private:
///////////////////////////////////////////////////////////////////////////////
-static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; }
-static skiagm::GMRegistry reg(MyFactory);
+DEF_GM(return new ImageFiltersGraphGM;)
« no previous file with comments | « gm/imagefiltersclipped.cpp ('k') | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698