Commit Graph

5 Commits

Author SHA1 Message Date
halcanary
7a14b310d6 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
2015-10-01 07:28:13 -07:00
robertphillips
943a462fef Minor code cleanup (left over from prior CL)
This was requested in https://codereview.chromium.org/1309543012/ (Add new GM to directly exercise perspective bitmap drawing)

Review URL: https://codereview.chromium.org/1320673011
2015-09-03 13:32:33 -07:00
caryclark
125960152d make tests portable by using 565 compatible colors
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1262703002
2015-07-29 05:27:47 -07:00
halcanary
a8448bc3df PDF: Correctly embed JPEG images directly into PDF output.
We only embed images with YUV planes.  That should only grab the
subset of color JPEGs supported by PDF.

BUG=skia:3180

Review URL: https://codereview.chromium.org/1025773002
2015-04-17 13:27:24 -07:00
halcanary
1b5c604d9d PDF: Add (low-memory) SkPDFBitmap class
Also: Add SkDeflateWStream and associated unit tests.

SkPDFBitmap is a replacement for SkPDFImage.  As of now, it only
supports 8888 bitmaps (the most common case).

SkPDFBitmap takes very little extra memory (aside from refing the
bitmap's pixels), and its emitObject() does not cache any data.

The SkPDFBitmap::Create function will check the canon for duplicates.
This can reduce the size of the output PDF.

Motivation:  this gives another ~40% decrease in PDF memory overhead

TODO: Support other ColorTypes and scrap SkPDFImage.

BUG=skia:3030

Review URL: https://codereview.chromium.org/918813002
2015-02-18 11:29:57 -08:00