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

Unified Diff: gm/showmiplevels.cpp

Issue 2285813002: Move work from ctor to onOnceBeforeDraw in ShowMipLevel GMs (Closed)
Patch Set: Clean up Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/showmiplevels.cpp
diff --git a/gm/showmiplevels.cpp b/gm/showmiplevels.cpp
index 9f074344cfc0826a7dfc0551fc146e4c96d9766b..05395bd118996d4fc69cad0b93ff2c2334c05f40 100644
--- a/gm/showmiplevels.cpp
+++ b/gm/showmiplevels.cpp
@@ -105,12 +105,7 @@ public:
}
}
- ShowMipLevels(int N) : fN(N) {
- fBM[0] = sk_tool_utils::create_checkerboard_bitmap(N, N, SK_ColorBLACK, SK_ColorWHITE, 2);
- fBM[1] = make_bitmap(N, N);
- fBM[2] = make_bitmap2(N, N);
- fBM[3] = make_bitmap3(N, N);
- }
+ ShowMipLevels(int N) : fN(N) { }
protected:
@@ -198,6 +193,13 @@ protected:
}
}
+ void onOnceBeforeDraw() override {
+ fBM[0] = sk_tool_utils::create_checkerboard_bitmap(fN, fN, SK_ColorBLACK, SK_ColorWHITE, 2);
+ fBM[1] = make_bitmap(fN, fN);
+ fBM[2] = make_bitmap2(fN, fN);
+ fBM[3] = make_bitmap3(fN, fN);
+ }
+
void onDraw(SkCanvas* canvas) override {
canvas->translate(4, 4);
for (const auto& bm : fBM) {
@@ -222,12 +224,7 @@ class ShowMipLevels2 : public skiagm::GM {
SkBitmap fBM[4];
public:
- ShowMipLevels2(int w, int h) : fW(w), fH(h) {
- fBM[0] = sk_tool_utils::create_checkerboard_bitmap(w, h, SHOW_MIP_COLOR, SK_ColorWHITE, 2);
- fBM[1] = make_bitmap(w, h);
- fBM[2] = make_bitmap2(w, h);
- fBM[3] = make_bitmap3(w, h);
- }
+ ShowMipLevels2(int w, int h) : fW(w), fH(h) { }
protected:
@@ -292,6 +289,14 @@ protected:
}
}
+ void onOnceBeforeDraw() override {
+ fBM[0] = sk_tool_utils::create_checkerboard_bitmap(fW, fH,
+ SHOW_MIP_COLOR, SK_ColorWHITE, 2);
+ fBM[1] = make_bitmap(fW, fH);
+ fBM[2] = make_bitmap2(fW, fH);
+ fBM[3] = make_bitmap3(fW, fH);
+ }
+
void onDraw(SkCanvas* canvas) override {
canvas->translate(4, 4);
for (const auto& bm : fBM) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698