Index: gm/colortypexfermode.cpp |
diff --git a/gm/colortypexfermode.cpp b/gm/colortypexfermode.cpp |
index bf86565648278709a1104f37098c9e1fd51100c8..855d11a1a4edd3b1a8ee8a2ff08ca4962baea403 100644 |
--- a/gm/colortypexfermode.cpp |
+++ b/gm/colortypexfermode.cpp |
@@ -16,17 +16,19 @@ namespace skiagm { |
static uint16_t gData[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; |
class ColorTypeXfermodeGM : public GM { |
- SkBitmap fBG; |
- |
- void onOnceBeforeDraw() override { |
- fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType, |
- kOpaque_SkAlphaType), gData, 4); |
- } |
- |
public: |
const static int W = 64; |
const static int H = 64; |
- ColorTypeXfermodeGM() { |
+ ColorTypeXfermodeGM() |
+ : fColorType(NULL) { |
+ } |
+ |
+ virtual ~ColorTypeXfermodeGM() { |
+ SkSafeUnref(fColorType); |
+ } |
+ |
+protected: |
+ void onOnceBeforeDraw() override { |
const SkColor colors[] = { |
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, |
SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorYELLOW |
@@ -47,13 +49,11 @@ public: |
} |
fColorType = SkNEW_ARGS(SkGTypeface, (orig, paint)); |
orig->unref(); |
- } |
- virtual ~ColorTypeXfermodeGM() { |
- fColorType->unref(); |
+ fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType, |
+ kOpaque_SkAlphaType), gData, 4); |
} |
-protected: |
virtual SkString onShortName() override { |
return SkString("colortype_xfermodes"); |
} |
@@ -157,6 +157,7 @@ protected: |
} |
private: |
+ SkBitmap fBG; |
SkTypeface* fColorType; |
typedef GM INHERITED; |