Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Unified Diff: samplecode/SampleTiling.cpp

Issue 214953003: split SkPictureRecorder out of SkPicture (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: update to ToT (again) Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SamplePicture.cpp ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleTiling.cpp
===================================================================
--- samplecode/SampleTiling.cpp (revision 14159)
+++ samplecode/SampleTiling.cpp (working copy)
@@ -62,21 +62,19 @@
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 @@
SkScalar y = SkIntToScalar(24);
SkScalar x = SkIntToScalar(10);
+ SkPictureRecorder recorder;
SkCanvas* textCanvas = NULL;
if (fTextPicture->width() == 0) {
bungeman-chromium 2014/04/15 21:07:08 fTextPicture is still uninitialized here!
- 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 @@
}
}
+ fTextPicture.reset(recorder.endRecording());
+
canvas->drawPicture(*fTextPicture);
}
« no previous file with comments | « samplecode/SamplePicture.cpp ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698