Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Unified Diff: src/pdf/SkPDFBitmap.cpp

Issue 1734223003: SkPDF: Let client re-encode JPGs if they want to (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698