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

Unified Diff: samplecode/SampleApp.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
Index: samplecode/SampleApp.cpp
===================================================================
--- samplecode/SampleApp.cpp (revision 14159)
+++ samplecode/SampleApp.cpp (working copy)
@@ -834,8 +834,6 @@
fclose(f);
#endif
- fPicture = NULL;
-
fDeviceType = kRaster_DeviceType;
#if DEFAULT_TO_GPU
@@ -990,7 +988,6 @@
}
SampleWindow::~SampleWindow() {
- delete fPicture;
delete fPdfCanvas;
fTypeface->unref();
@@ -1379,8 +1376,7 @@
pdfDevice->unref();
canvas = fPdfCanvas;
} else if (kPicture_DeviceType == fDeviceType) {
- fPicture = new SkPicture;
- canvas = fPicture->beginRecording(9999, 9999);
+ canvas = fRecorder.beginRecording(9999, 9999);
} else {
#if SK_SUPPORT_GPU
if (kNullGPU_DeviceType != fDeviceType)
@@ -1459,16 +1455,16 @@
}
if (kPicture_DeviceType == fDeviceType) {
+ SkAutoTUnref<SkPicture> picture(fRecorder.endRecording());
+
if (true) {
- SkPicture* pict = new SkPicture(*fPicture);
- fPicture->unref();
+ SkPicture* pict = new SkPicture(*picture);
this->installDrawFilter(orig);
orig->drawPicture(*pict);
pict->unref();
} else if (true) {
SkDynamicMemoryWStream ostream;
- fPicture->serialize(&ostream);
- fPicture->unref();
+ picture->serialize(&ostream);
SkAutoDataUnref data(ostream.copyToData());
SkMemoryStream istream(data->data(), data->size());
@@ -1477,10 +1473,8 @@
orig->drawPicture(*pict.get());
}
} else {
- fPicture->draw(orig);
- fPicture->unref();
+ picture->draw(orig);
}
- fPicture = NULL;
}
// Do this after presentGL and other finishing, rather than in afterChild

Powered by Google App Engine
This is Rietveld 408576698