Index: src/pdf/SkPDFImage.cpp |
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp |
index 6ede7aaf515d54b5155ade6f8b9ee6033eb01cec..fbd37ebd8eba82a4e76ae77c1db7f4e3a52dee6a 100644 |
--- a/src/pdf/SkPDFImage.cpp |
+++ b/src/pdf/SkPDFImage.cpp |
@@ -391,11 +391,17 @@ SkPDFImage::SkPDFImage(SkStream* stream, |
bool isAlpha, |
const SkIRect& srcRect, |
EncodeToDCTStream encoder) |
- : fBitmap(bitmap), |
- fIsAlpha(isAlpha), |
+ : fIsAlpha(isAlpha), |
fSrcRect(srcRect), |
fEncoder(encoder) { |
+ if (bitmap.isImmutable()) { |
+ fBitmap = bitmap; |
+ } else { |
+ bitmap.deepCopyTo(&fBitmap, bitmap.config()); |
+ fBitmap.setImmutable(); |
+ } |
+ |
if (stream != NULL) { |
setData(stream); |
fStreamValid = true; |