aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleTiling.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-13 19:09:42 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-13 19:09:42 +0000
commit84b18c7e3e042bf206e1ace3d1b6ea5bb929fe51 (patch)
tree7b46e74e6212283d9efe62a7b6feaad2c009972b /samplecode/SampleTiling.cpp
parentc202ea7cc69476a20ad898d6c76bcdbcb18adf74 (diff)
split SkPictureRecorder out of SkPicture
Diffstat (limited to 'samplecode/SampleTiling.cpp')
-rw-r--r--samplecode/SampleTiling.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/samplecode/SampleTiling.cpp b/samplecode/SampleTiling.cpp
index 9ffccebf1a..faa8d80144 100644
--- a/samplecode/SampleTiling.cpp
+++ b/samplecode/SampleTiling.cpp
@@ -62,21 +62,19 @@ static const int gWidth = 32;
static const int gHeight = 32;
class TilingView : public SampleView {
- SkPicture* fTextPicture;
- SkBlurDrawLooper fLooper;
+ SkAutoTUnref<SkPicture> fTextPicture;
+ SkBlurDrawLooper fLooper;
public:
TilingView()
: fLooper(0x88000000,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(1)),
SkIntToScalar(2), SkIntToScalar(2)) {
- fTextPicture = new SkPicture();
for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) {
makebm(&fTexture[i], gColorTypes[i], gWidth, gHeight);
}
}
- ~TilingView() {
- fTextPicture->unref();
+ virtual ~TilingView() {
}
SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)];
@@ -105,12 +103,13 @@ protected:
SkScalar y = SkIntToScalar(24);
SkScalar x = SkIntToScalar(10);
+ SkPictureRecorder recorder;
SkCanvas* textCanvas = NULL;
if (fTextPicture->width() == 0) {
- textCanvas = fTextPicture->beginRecording(1000, 1000);
+ textCanvas = recorder.beginRecording(1000, 1000);
}
- if (textCanvas) {
+ if (NULL != textCanvas) {
for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
SkPaint p;
@@ -160,6 +159,8 @@ protected:
}
}
+ fTextPicture.reset(recorder.endRecording());
+
canvas->drawPicture(*fTextPicture);
}