Encode images with DCTDecode (JPEG) in PDFs if it makes sense. Fallback to FlateDecode (zip) if it makes sense. Otherewise include uncompressed stream.
This change will reduce the size of PDFs to 50% (in the case of the existing SKPs, we reduce the total size of PDFs from 105MB to 50MB)
Review URL: https://codereview.appspot.com/7068055
git-svn-id: http://skia.googlecode.com/svn/trunk@8835 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFImage.h b/src/pdf/SkPDFImage.h
index d41466f..31f8940 100644
--- a/src/pdf/SkPDFImage.h
+++ b/src/pdf/SkPDFImage.h
@@ -10,7 +10,8 @@
#ifndef SkPDFImage_DEFINED
#define SkPDFImage_DEFINED
-#include "SkPDFStream.h"
+#include "SkPDFDevice.h"
+#include "SkPDFImageStream.h"
#include "SkPDFTypes.h"
#include "SkRefCnt.h"
@@ -26,7 +27,7 @@
// We could play the same trick here as is done in SkPDFGraphicState, storing
// a copy of the Bitmap object (not the pixels), the pixel generation number,
// and settings used from the paint to canonicalize image objects.
-class SkPDFImage : public SkPDFStream {
+class SkPDFImage : public SkPDFImageStream {
public:
/** Create a new Image XObject to represent the passed bitmap.
* @param bitmap The image to encode.
@@ -36,7 +37,8 @@
* the given parameters.
*/
static SkPDFImage* CreateImage(const SkBitmap& bitmap,
- const SkIRect& srcRect);
+ const SkIRect& srcRect,
+ EncodeToDCTStream encoder);
virtual ~SkPDFImage();
@@ -63,7 +65,7 @@
* @param paint Used to calculate alpha, masks, etc.
*/
SkPDFImage(SkStream* imageData, const SkBitmap& bitmap,
- const SkIRect& srcRect, bool alpha);
+ const SkIRect& srcRect, bool alpha, EncodeToDCTStream encoder);
};
#endif