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

Unified Diff: src/core/SkPicture.cpp

Issue 214413008: Thread picture version through to SkReadBuffer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: debugger too Created 6 years, 9 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 | « include/core/SkReadBuffer.h ('k') | src/core/SkPicturePlayback.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicture.cpp
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index ae0347cf254dbf791a6acf32b53bd04dfdd90891..5914ba46cd08efb64104197267eb7fc538617077 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -138,8 +138,10 @@ SkPicture::SkPicture(const SkPicture& src)
if (src.fPlayback) {
fPlayback = SkNEW_ARGS(SkPicturePlayback, (*src.fPlayback));
} else if (src.fRecord) {
+ SkPictInfo info;
+ this->createHeader(&info);
// here we do a fake src.endRecording()
- fPlayback = SkNEW_ARGS(SkPicturePlayback, (*src.fRecord));
+ fPlayback = SkNEW_ARGS(SkPicturePlayback, (*src.fRecord, info));
} else {
fPlayback = NULL;
}
@@ -173,6 +175,8 @@ SkPicture* SkPicture::clone() const {
void SkPicture::clone(SkPicture* pictures, int count) const {
SkPictCopyInfo copyInfo;
+ SkPictInfo info;
+ this->createHeader(&info);
for (int i = 0; i < count; i++) {
SkPicture* clone = &pictures[i];
@@ -190,7 +194,7 @@ void SkPicture::clone(SkPicture* pictures, int count) const {
clone->fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fPlayback, &copyInfo));
} else if (fRecord) {
// here we do a fake src.endRecording()
- clone->fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fRecord, true));
+ clone->fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fRecord, info, true));
} else {
clone->fPlayback = NULL;
}
@@ -261,7 +265,9 @@ void SkPicture::endRecording() {
if (NULL == fPlayback) {
if (NULL != fRecord) {
fRecord->endRecording();
- fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fRecord));
+ SkPictInfo info;
+ this->createHeader(&info);
+ fPlayback = SkNEW_ARGS(SkPicturePlayback, (*fRecord, info));
SkSafeSetNull(fRecord);
}
}
@@ -384,7 +390,7 @@ SkPicture* SkPicture::CreateFromBuffer(SkReadBuffer& buffer) {
SkPicturePlayback* playback;
// Check to see if there is a playback to recreate.
if (buffer.readBool()) {
- playback = SkPicturePlayback::CreateFromBuffer(buffer);
+ playback = SkPicturePlayback::CreateFromBuffer(buffer, info);
if (NULL == playback) {
return NULL;
}
@@ -417,13 +423,13 @@ void SkPicture::createHeader(SkPictInfo* info) const {
void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const {
SkPicturePlayback* playback = fPlayback;
+ SkPictInfo info;
+ this->createHeader(&info);
if (NULL == playback && fRecord) {
- playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord));
+ playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord, info));
}
- SkPictInfo header;
- this->createHeader(&header);
- stream->write(&header, sizeof(header));
+ stream->write(&info, sizeof(info));
if (playback) {
stream->writeBool(true);
playback->serialize(stream, encoder);
@@ -439,13 +445,13 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const {
void SkPicture::flatten(SkWriteBuffer& buffer) const {
SkPicturePlayback* playback = fPlayback;
+ SkPictInfo info;
+ this->createHeader(&info);
if (NULL == playback && fRecord) {
- playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord));
+ playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord, info));
}
- SkPictInfo header;
- this->createHeader(&header);
- buffer.writeByteArray(&header, sizeof(header));
+ buffer.writeByteArray(&info, sizeof(info));
if (playback) {
buffer.writeBool(true);
playback->flatten(buffer);
« no previous file with comments | « include/core/SkReadBuffer.h ('k') | src/core/SkPicturePlayback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698