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

Unified Diff: gm/lighting.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/imagefilterstransformed.cpp ('k') | gm/lightingshader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/lighting.cpp
diff --git a/gm/lighting.cpp b/gm/lighting.cpp
index d68e67db16fe44bbe71fcea20329f3cb815eef51..af102d7d03950f712c0a285b9303f7f3dc381ded 100644
--- a/gm/lighting.cpp
+++ b/gm/lighting.cpp
@@ -17,7 +17,7 @@ namespace skiagm {
class ImageLightingGM : public GM {
public:
- ImageLightingGM() : fInitialized(false) {
+ ImageLightingGM() {
this->setBGColor(0xFF000000);
}
@@ -27,19 +27,6 @@ protected:
return SkString("lighting");
}
- void make_bitmap() {
- fBitmap.allocN32Pixels(100, 100);
- SkCanvas canvas(fBitmap);
- canvas.clear(0x00000000);
- SkPaint paint;
- paint.setAntiAlias(true);
- sk_tool_utils::set_portable_typeface(&paint);
- paint.setColor(0xFFFFFFFF);
- paint.setTextSize(SkIntToScalar(96));
- const char* str = "e";
- canvas.drawText(str, strlen(str), SkIntToScalar(20), SkIntToScalar(70), paint);
- }
-
SkISize onISize() override {
return SkISize::Make(WIDTH, HEIGHT);
}
@@ -53,11 +40,11 @@ protected:
canvas->restore();
}
+ void onOnceBeforeDraw() override {
+ fBitmap = sk_tool_utils::create_string_bitmap(100, 100, 0xFFFFFFFF, 20, 70, 96, "e");
+ }
+
void onDraw(SkCanvas* canvas) override {
- if (!fInitialized) {
- make_bitmap();
- fInitialized = true;
- }
canvas->clear(sk_tool_utils::color_to_565(0xFF101010));
SkPaint checkPaint;
checkPaint.setColor(sk_tool_utils::color_to_565(0xFF202020));
@@ -163,9 +150,9 @@ protected:
}
private:
- typedef GM INHERITED;
SkBitmap fBitmap;
- bool fInitialized;
+
+ typedef GM INHERITED;
};
//////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « gm/imagefilterstransformed.cpp ('k') | gm/lightingshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698