void SkPicture::serialize(SkWStream* stream, SkSerializationHelpers::EncodeBitmap encoder) const { SkPicturePlayback* playback = fPlayback; if (NULL == playback && fRecord) { playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); } SkPictInfo info; info.fVersion = PICTURE_VERSION; info.fWidth = fWidth; info.fHeight = fHeight; info.fFlags = SkPictInfo::kCrossProcess_Flag; #ifdef SK_SCALAR_IS_FLOAT info.fFlags |= SkPictInfo::kScalarIsFloat_Flag; #endif if (8 == sizeof(void*)) { info.fFlags |= SkPictInfo::kPtrIs64Bit_Flag; } stream->write(&info, sizeof(info)); if (playback) { stream->writeBool(true); playback->serialize(stream, encoder); // delete playback if it is a local version (i.e. cons'd up just now) if (playback != fPlayback) { SkDELETE(playback); } } else { stream->writeBool(false); } }
void SkPicture::serialize(SkWStream* stream) const { SkPicturePlayback* playback = fPlayback; if (NULL == playback && fRecord) { playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); } stream->write32(PICTURE_VERSION); stream->write32(fWidth); stream->write32(fHeight); if (playback) { stream->writeBool(true); playback->serialize(stream); // delete playback if it is a local version (i.e. cons'd up just now) if (playback != fPlayback) { SkDELETE(playback); } } else { stream->writeBool(false); } }
void SkPicture::flatten(SkWriteBuffer& buffer) const { SkPicturePlayback* playback = fPlayback; if (NULL == playback && fRecord) { playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); } SkPictInfo header; this->createHeader(&header); buffer.writeByteArray(&header, sizeof(header)); if (playback) { buffer.writeBool(true); playback->flatten(buffer); // delete playback if it is a local version (i.e. cons'd up just now) if (playback != fPlayback) { SkDELETE(playback); } } else { buffer.writeBool(false); } }
void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { SkPicturePlayback* playback = fPlayback; if (NULL == playback && fRecord) { playback = SkNEW_ARGS(SkPicturePlayback, (*fRecord)); } SkPictInfo header; this->createHeader(&header); stream->write(&header, sizeof(header)); if (playback) { stream->writeBool(true); playback->serialize(stream, encoder); // delete playback if it is a local version (i.e. cons'd up just now) if (playback != fPlayback) { SkDELETE(playback); } } else { stream->writeBool(false); } }