aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleTiling.cpp
diff options
context:
space:
mode:
authorGravatar junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-09-13 18:15:52 +0000
committerGravatar junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-09-13 18:15:52 +0000
commitf3cf9429cc8f483bc5287ca09206a0fc81d98729 (patch)
treec8e28e376bf1289b8e3043991cdd11be700933f1 /samplecode/SampleTiling.cpp
parentc27b74174e6a734db3cf1b5a5354eab8f3d27c1c (diff)
SampleApp: fixing bad ref counting on non dynamically allocated object
REVIEW=http://codereview.appspot.com/4969079/ git-svn-id: http://skia.googlecode.com/svn/trunk@2259 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleTiling.cpp')
-rw-r--r--samplecode/SampleTiling.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/samplecode/SampleTiling.cpp b/samplecode/SampleTiling.cpp
index a18a16e661..d72544bafb 100644
--- a/samplecode/SampleTiling.cpp
+++ b/samplecode/SampleTiling.cpp
@@ -63,17 +63,22 @@ static const int gWidth = 32;
static const int gHeight = 32;
class TilingView : public SampleView {
- SkPicture fTextPicture;
+ SkPicture* fTextPicture;
SkBlurDrawLooper fLooper;
public:
TilingView()
: fLooper(SkIntToScalar(1), SkIntToScalar(2), SkIntToScalar(2),
0x88000000) {
+ fTextPicture = new SkPicture();
for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); i++) {
makebm(&fTexture[i], gConfigs[i], gWidth, gHeight);
}
}
+ ~TilingView() {
+ fTextPicture->unref();
+ }
+
SkBitmap fTexture[SK_ARRAY_COUNT(gConfigs)];
protected:
@@ -101,8 +106,8 @@ protected:
SkScalar x = SkIntToScalar(10);
SkCanvas* textCanvas = NULL;
- if (fTextPicture.width() == 0) {
- textCanvas = fTextPicture.beginRecording(1000, 1000);
+ if (fTextPicture->width() == 0) {
+ textCanvas = fTextPicture->beginRecording(1000, 1000);
}
if (textCanvas) {
@@ -155,7 +160,7 @@ protected:
}
}
- canvas->drawPicture(fTextPicture);
+ canvas->drawPicture(*fTextPicture);
}
private: