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; |
}; |