Index: src/pdf/SkPDFBitmap.cpp |
diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp |
index 4e49db518d802896ed069a75fe4f3f66d9bd0bb2..e067ed1c0bb776ed66fe7f0ada974e7477d0b3a5 100644 |
--- a/src/pdf/SkPDFBitmap.cpp |
+++ b/src/pdf/SkPDFBitmap.cpp |
@@ -472,7 +472,12 @@ SkPDFObject* SkPDFCreateBitmapObject(const SkImage* image, |
SkPixelSerializer* pixelSerializer) { |
SkAutoTUnref<SkData> data(image->refEncoded()); |
SkJFIFInfo info; |
- if (data && SkIsJFIF(data, &info)) { |
+ if (data && SkIsJFIF(data, &info) && |
+ (!pixelSerializer || |
+ pixelSerializer->useEncodedData(data->data(), data->size()))) { |
+ // If there is a SkPixelSerializer, give it a chance to |
+ // re-encode the JPEG with more compression by returning false |
+ // from useEncodedData. |
bool yuv = info.fType == SkJFIFInfo::kYCbCr; |
if (info.fSize == image->dimensions()) { // Sanity check. |
// hold on to data, not image. |