Index: src/effects/SkBitmapSource.cpp |
diff --git a/src/effects/SkBitmapSource.cpp b/src/effects/SkBitmapSource.cpp |
index 6834e9e32e9b5ff46ab6e4c5c0f672c464a35ead..79f6e92c1d80512629ccdb6aa379b95b3ba4db83 100644 |
--- a/src/effects/SkBitmapSource.cpp |
+++ b/src/effects/SkBitmapSource.cpp |
@@ -21,15 +21,17 @@ SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap) |
} |
SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect) |
- : INHERITED(0, 0), |
- fBitmap(bitmap), |
- fSrcRect(srcRect), |
- fDstRect(dstRect) { |
-} |
+ : INHERITED(0, 0) |
+ , fBitmap(bitmap) |
+ , fSrcRect(srcRect) |
+ , fDstRect(dstRect) {} |
-SkBitmapSource::SkBitmapSource(SkReadBuffer& buffer) |
- : INHERITED(0, buffer) { |
- fBitmap.unflatten(buffer); |
+SkBitmapSource::SkBitmapSource(SkReadBuffer& buffer) : INHERITED(0, buffer) { |
+ if (buffer.isVersionLT(SkReadBuffer::kNoMoreBitmapFlatten_Version)) { |
+ fBitmap.unflatten(buffer); |
+ } else { |
+ buffer.readBitmap(&fBitmap); |
+ } |
buffer.readRect(&fSrcRect); |
buffer.readRect(&fDstRect); |
buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect(fDstRect)); |
@@ -37,7 +39,7 @@ SkBitmapSource::SkBitmapSource(SkReadBuffer& buffer) |
void SkBitmapSource::flatten(SkWriteBuffer& buffer) const { |
this->INHERITED::flatten(buffer); |
- fBitmap.flatten(buffer); |
+ buffer.writeBitmap(fBitmap); |
buffer.writeRect(fSrcRect); |
buffer.writeRect(fDstRect); |
} |