diff options
author | halcanary <halcanary@google.com> | 2015-10-01 07:28:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-01 07:28:13 -0700 |
commit | 7a14b310d6c618fa2151d93a43b29f9599adc32a (patch) | |
tree | 0df57a285df727f8f892155ea4017eb7072c39ef /src/pdf/SkPDFBitmap.h | |
parent | 7bdd70ab9162980f3173c98c48234f9f345665a3 (diff) |
SkPDF: Implement drawImage*() properly
drawImage calls now properly embeds the original jpeg.
NOTE: drawBitmap*() calls no longer embed JPEG files when
possible (this is in advance of eliminating bitmaps backed
by encoded data). Chromium has already moved from
drawBitmap to drawImage.
Comparisons:
control:
total PDF drawImage/drawBitmap calls: 8010
total PDF jpeg images: 0
total PDF regular images: 3581
experiament:
total PDF drawImage/drawBitmap calls: 8014
total PDF jpeg images: 271
total PDF regular images: 3311
total PDF regular images: 3582 (271 + 3311)
When comparing rendered output there were perceptual
differences in the following four GMs: colorcube, emboss,
colormatrix, and tablecolorfilter. All of these differences
were improvements (that is, closer to the 8888 rendering)
due fixing a bug with colorfilters and forgetting to call
notifyPixelsChanged.
No SKPs had perceptual differences.
Total PDF size dropped from 133964 kB to 126276 kB, a 5.7%
improvement (mostly due to restoring use of JPG images in
SKPs).
BUG=skia:4370
Review URL: https://codereview.chromium.org/1372783003
Diffstat (limited to 'src/pdf/SkPDFBitmap.h')
-rw-r--r-- | src/pdf/SkPDFBitmap.h | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/pdf/SkPDFBitmap.h b/src/pdf/SkPDFBitmap.h index 58d91bec88..d931331431 100644 --- a/src/pdf/SkPDFBitmap.h +++ b/src/pdf/SkPDFBitmap.h @@ -8,33 +8,14 @@ #define SkPDFBitmap_DEFINED #include "SkPDFTypes.h" -#include "SkBitmap.h" -class SkPDFCanon; +class SkImage; /** - * SkPDFBitmap wraps a SkBitmap and serializes it as an image Xobject. + * SkPDFBitmap wraps a SkImage and serializes it as an image Xobject. * It is designed to use a minimal amout of memory, aside from refing - * the bitmap's pixels, and its emitObject() does not cache any data. - * - * If !bitmap.isImmutable(), then a copy of the bitmap must be made; - * there is no way around this. - * - * The SkPDFBitmap::Create function will check the canon for duplicates. + * the image, and its emitObject() does not cache any data. */ -class SkPDFBitmap : public SkPDFObject { -public: - // Returns nullptr on unsupported bitmap; - static SkPDFBitmap* Create(SkPDFCanon*, const SkBitmap&); - bool equals(const SkBitmap& other) const { - return fBitmap.getGenerationID() == other.getGenerationID() && - fBitmap.pixelRefOrigin() == other.pixelRefOrigin() && - fBitmap.dimensions() == other.dimensions(); - } - -protected: - const SkBitmap fBitmap; - SkPDFBitmap(const SkBitmap& bm) : fBitmap(bm) {} -}; +SkPDFObject* SkPDFCreateBitmapObject(const SkImage*); #endif // SkPDFBitmap_DEFINED |