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
This commit is contained in:
junov@google.com 2011-09-13 18:15:52 +00:00
parent c27b74174e
commit f3cf9429cc

View File

@ -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: