aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/composeshader.cpp
diff options
context:
space:
mode:
authorGravatar herb <herb@google.com>2016-01-08 13:48:43 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-08 13:48:43 -0800
commitb10fe4941b08172378d3d1928959122f106ced37 (patch)
tree259dbbf6382f4c58e5ea9bff2993c834102172eb /gm/composeshader.cpp
parentcdee009886babe6df7743a9b5b3e2cc0a5f21adf (diff)
Remove work from constructors to facilitate debugging.
Diffstat (limited to 'gm/composeshader.cpp')
-rw-r--r--gm/composeshader.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/gm/composeshader.cpp b/gm/composeshader.cpp
index b2be9ba28e..d482bc9420 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;
};