Chromium Code Reviews| Index: src/core/SkPicture.cpp |
| diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp |
| index ae0347cf254dbf791a6acf32b53bd04dfdd90891..39743bd598a4cc292f70ad7900db4eac080bcd2d 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, ©Info)); |
| } 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,12 +423,12 @@ void SkPicture::createHeader(SkPictInfo* info) const { |
| void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { |
| SkPicturePlayback* playback = fPlayback; |
| + SkPictInfo header; |
|
reed1
2014/03/27 20:58:14
not strictly part of this change, but it would be
mtklein
2014/03/27 21:02:48
Done.
|
| + this->createHeader(&header); |
| if (NULL == playback && fRecord) { |
| - playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); |
| + playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord, header)); |
| } |
| - SkPictInfo header; |
| - this->createHeader(&header); |
| stream->write(&header, sizeof(header)); |
| if (playback) { |
| stream->writeBool(true); |
| @@ -439,12 +445,12 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { |
| void SkPicture::flatten(SkWriteBuffer& buffer) const { |
| SkPicturePlayback* playback = fPlayback; |
| + SkPictInfo header; |
| + this->createHeader(&header); |
| if (NULL == playback && fRecord) { |
| - playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); |
| + playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord, header)); |
| } |
| - SkPictInfo header; |
| - this->createHeader(&header); |
| buffer.writeByteArray(&header, sizeof(header)); |
| if (playback) { |
| buffer.writeBool(true); |