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

Unified Diff: gm/composeshader.cpp

Issue 1562093002: Remove work from constructors to facilitate debugging. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use valid width and height. Created 4 years, 11 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/blurroundrect.cpp ('k') | gm/rrects.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/composeshader.cpp
diff --git a/gm/composeshader.cpp b/gm/composeshader.cpp
index b2be9ba28e463b7aba3b22d053406e5d835ef28e..d482bc942097299a368fede0cbb9ec959262eff5 100644
--- a/gm/composeshader.cpp
+++ b/gm/composeshader.cpp
@@ -162,13 +162,14 @@ static SkShader* make_linear_gradient_shader(int length) {
class ComposeShaderBitmapGM : public skiagm::GM {
public:
- ComposeShaderBitmapGM()
- : fColorBitmapShader(nullptr)
- , fAlpha8BitmapShader(nullptr)
- , fLinearGradientShader(nullptr)
- {
+ ComposeShaderBitmapGM() {}
+ ~ComposeShaderBitmapGM() {
+ SkSafeUnref(fColorBitmapShader);
+ SkSafeUnref(fAlpha8BitmapShader);
+ SkSafeUnref(fLinearGradientShader);
}
+protected:
void onOnceBeforeDraw() override {
draw_color_bm(&fColorBitmap, squareLength);
draw_alpha8_bm(&fAlpha8Bitmap, squareLength);
@@ -181,13 +182,6 @@ public:
fLinearGradientShader = make_linear_gradient_shader(squareLength);
}
- ~ComposeShaderBitmapGM() {
- SkSafeUnref(fColorBitmapShader);
- SkSafeUnref(fAlpha8BitmapShader);
- SkSafeUnref(fLinearGradientShader);
- }
-
-protected:
SkString onShortName() override {
return SkString("composeshader_bitmap");
}
@@ -230,6 +224,7 @@ protected:
canvas->translate(0, r.height() + 5);
}
}
+
private:
/** This determines the length and width of the bitmaps used in the SkComposeShaders. Values
* above 20 may cause an SkASSERT to fail in SkSmallAllocator. However, larger values will
@@ -240,9 +235,9 @@ private:
SkBitmap fColorBitmap;
SkBitmap fAlpha8Bitmap;
- SkShader* fColorBitmapShader;
- SkShader* fAlpha8BitmapShader;
- SkShader* fLinearGradientShader;
+ SkShader* fColorBitmapShader{nullptr};
+ SkShader* fAlpha8BitmapShader{nullptr};
+ SkShader* fLinearGradientShader{nullptr};
typedef GM INHERITED;
};
« no previous file with comments | « gm/blurroundrect.cpp ('k') | gm/rrects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698