History log of /external/skia/src/pdf/SkPDFCanon.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cee13425b5cd862189d1e5d7cf8f258bccae5f5d 18-Aug-2016 halcanary <halcanary@google.com> SkPDF: cache metrics once.

Motivation: drawText can look up unicode mapping at draw time to see
if ActualText should be used after crrev.com/2084533004 lands.

For each SkTypeface, only call getAdvancedTypefaceMetrics() once per
document. Cache the result in the SkPDFCanon, indexed by SkFontID.
Also cache PDF FontDescriptors in the canon, also indexed by SkFontID
(Type1 fonts only).

Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map
that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(),
SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match.

SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics.
Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset()
get metrics from canon.

SkPDFFont multybite bool is now a function of type.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002

CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Release-GDI-Trybot,Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Debug-GDI-Trybot

Review-Url: https://codereview.chromium.org/2253993002
/external/skia/src/pdf/SkPDFCanon.h
671fec43e51533b9969502c072cd29d88ebef6ea 18-Aug-2016 robertphillips <robertphillips@google.com> Revert of SkPDF: cache metrics once. (patchset #4 id:60001 of https://codereview.chromium.org/2253993002/ )

Reason for revert:
because

Original issue's description:
> SkPDF: cache metrics once.
>
> Motivation: drawText can look up unicode mapping at draw time to see
> if ActualText should be used after crrev.com/2084533004 lands.
>
> For each SkTypeface, only call getAdvancedTypefaceMetrics() once per
> document. Cache the result in the SkPDFCanon, indexed by SkFontID.
> Also cache PDF FontDescriptors in the canon, also indexed by SkFontID
> (Type1 fonts only).
>
> Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map
> that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(),
> SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match.
>
> SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics.
> Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset()
> get metrics from canon.
>
> SkPDFFont multybite bool is now a function of type.
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002
>
> Committed: https://skia.googlesource.com/skia/+/0a61270f4ba85d10659fb63a86817b435ec04c94

TBR=bungeman@google.com,halcanary@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/2251813006
/external/skia/src/pdf/SkPDFCanon.h
0a61270f4ba85d10659fb63a86817b435ec04c94 17-Aug-2016 halcanary <halcanary@google.com> SkPDF: cache metrics once.

Motivation: drawText can look up unicode mapping at draw time to see
if ActualText should be used after crrev.com/2084533004 lands.

For each SkTypeface, only call getAdvancedTypefaceMetrics() once per
document. Cache the result in the SkPDFCanon, indexed by SkFontID.
Also cache PDF FontDescriptors in the canon, also indexed by SkFontID
(Type1 fonts only).

Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map
that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(),
SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match.

SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics.
Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset()
get metrics from canon.

SkPDFFont multybite bool is now a function of type.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002

Review-Url: https://codereview.chromium.org/2253993002
/external/skia/src/pdf/SkPDFCanon.h
dabd4f0b799318cb6e90b69ae1ec0ed0b6d32f60 03-Aug-2016 halcanary <halcanary@google.com> SkPDF: PDFShader code modernized.

Motivation: reduce code complexity.

SkCanon stores SkPDFShader::State next to SkDFObject, not inside.

many places use sk_sp<T> rather than T* to represent ownership.

SkPDFShader::State no longer holds bitmap.

SkPDFShader::State gets move constructor, no longer heap-allocated.

Classes removed:
SkPDFFunctionShader
SkPDFAlphaFunctionShader
SkPDFImageShader

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2193973002

Review-Url: https://codereview.chromium.org/2193973002
/external/skia/src/pdf/SkPDFCanon.h
b8d6af169bf631dcb68ba5a796436434ff78be65 29-Jun-2016 martina.kollarova <martina.kollarova@intel.com> Remove unnecessary includes in src/pdf/

Use forward declaration more.

BUG=None
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2110033002

Review-Url: https://codereview.chromium.org/2110033002
/external/skia/src/pdf/SkPDFCanon.h
4b6566644f704cf9e30c71fa547c9b5915752792 27-Apr-2016 halcanary <halcanary@google.com> SkDocument/PDF: new API

has a pdf/a switch.
sets metadata in factory.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1916093002

Review URL: https://codereview.chromium.org/1916093002
/external/skia/src/pdf/SkPDFCanon.h
a50151dcb5a0b8bfdef383e363e519c91d2d2c7a 25-Mar-2016 halcanary <halcanary@google.com> SkPDF: draw{Image,Bitmap} always serializes early

Before this change, the PDFCanon held a map from BitmapKeys
to SkImages for de-duping bitmaps. Even if the PDFDocument
serialized images early, the Canon still held a ref to that
image inside the map. With this change, the Canon holds a
single map from BitmapKeys to PDFObjects. Now, Images are
only held by the PDFObject, which the document serializes
and drops early.

This change also:

- Moves SkBitmapKey into its own header (for possible
reuse); it now can operate with images as well as
bitmaps.

- Creates SkImageBitmap, which wraps a pointer to a bitmap
or an image and abstracts out some common tasks so that
drawBitmap and drawImage behave the same.

- Modifies SkPDFCreateBitmapObject to take and return a
sk_sp<T>, not a T*.

- Refactors SkPDFDevice::internalDrawImage to use bitmaps
or images (via a SkImageBitmap).

- Turns on pre-serialization of all images.

BUG=skia:5087

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1829693002

Review URL: https://codereview.chromium.org/1829693002
/external/skia/src/pdf/SkPDFCanon.h
1437c1eea8f40f7a43bfe6e80a8d3f6cd61a3643 14-Mar-2016 halcanary <halcanary@google.com> SkPDF: remove all globally references SkPDFObjects

Move these singletons into SkPDFCanon (there is still a single object
per document; output PDF size will not change).

Motivation: After this change, all indirectly-referenced SkPDFObjects
are serialized exactly once. The next CL will add a memory saving
feature: a method to purge an object's resources immediately after
serialization. After that, further changes wil allow some objects to be
serialized *before* SkDocument::close(), leading to potentially very
large memory savings.

BUG=skia:5087
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1788263002

Review URL: https://codereview.chromium.org/1788263002
/external/skia/src/pdf/SkPDFCanon.h
48810a023705ffac466adb93efdb3861cf2e197a 07-Mar-2016 halcanary <halcanary@google.com> SkPDF: s/SkAutoTUnref/sk_sp/g

Review URL: https://codereview.chromium.org/1771073002
/external/skia/src/pdf/SkPDFCanon.h
fcad44bbb1e0384620e7b738a0f5904c940a6861 06-Mar-2016 halcanary <halcanary@google.com> SkPDF: AutoTUnref<T> changes in use

::detach() -> ::release()
::operator T*() -> ::get()

This makes all use of AutoTUnref work the same as sk_sp.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1772493002

Review URL: https://codereview.chromium.org/1772493002
/external/skia/src/pdf/SkPDFCanon.h
712fdf7603c62820b21174da9b0a2071c174936b 10-Dec-2015 halcanary <halcanary@google.com> SkDocument::setDCTEncoder() for old versions of webkit

Review URL: https://codereview.chromium.org/1505763003
/external/skia/src/pdf/SkPDFCanon.h
c8d1dd48c01f562cfffe64da0e5cee5ed2713541 15-Oct-2015 mtklein <mtklein@chromium.org> SkTHash: hash from fnptr to functor type

Passing &SkGoodHash to SkTHashMap and SkTHashSet doesn't guarantee that it's actually instantiated. Using a functor does.

BUG=skia:

Review URL: https://codereview.chromium.org/1405053002
/external/skia/src/pdf/SkPDFCanon.h
66a82f3872abf4ebb98b3915b2a9ecc73ad352c5 12-Oct-2015 halcanary <halcanary@google.com> SkPDF: fall back on paths for unembeddable fonts.

Add GM, SkPDFFont::CanEmbedTypeface

BUG=skia:3866

Review URL: https://codereview.chromium.org/1401763002
/external/skia/src/pdf/SkPDFCanon.h
7a14b310d6c618fa2151d93a43b29f9599adc32a 01-Oct-2015 halcanary <halcanary@google.com> 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
/external/skia/src/pdf/SkPDFCanon.h
96fcdcc219d2a0d3579719b84b28bede76efba64 27-Aug-2015 halcanary <halcanary@google.com> Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
/external/skia/src/pdf/SkPDFCanon.h
be27a118c277af23377d38e9b3bfd3fcc276114f 01-Apr-2015 halcanary <halcanary@google.com> SkPDF: SkPDFGraphicState Lookup hashtabled

In Release, running `dm --src skp --config pdf`, I get a
speedup of about 1.2%.

SkPDFGraphicState class:
- Holds the subset of SkPaint that maps to a PDF Graphics
State
- These fields are easily comparable, making hashtable
comparisons easy.

SkPDFCanon:
- findGraphicState() takes a SkPDFGraphicState, not a SkPaint
- fGraphicStateRecords is a SkHashSet, not a SkTDArray

SkPDFGraphicState:
- mode_for_pdf() replaces logic inside equivalent(), but is
only called once per lookup.
- emitObject() no longer modifies the SkPDFGraphicState to
cache the SkPDFDict stucture. (Since it is de-duped,
this get no speedup).
- Static Functions that don't use the canon return a plain
SkPDFDict now. No need for fPopulated.

SkTHash.h
- SkHashSet::forall added

SkPDFDevice; SkPDFShader
- Updated for new SkPDFGraphicState interface.

BUG=skia:3585

Review URL: https://codereview.chromium.org/1046293002
/external/skia/src/pdf/SkPDFCanon.h
2e3f9d8a9309686eeb4c76ccfde5800da87a68b3 27-Feb-2015 halcanary <halcanary@google.com> PDF: Canon now owns a reference to all interned objects

Add SkPDFCanon::reset function to unref all objects.

No longer possible to remove object from canon

Motivation: this doesn't change these object's lifetime, (they will
still be fully unrefed when SkDocument::close() is called, but we no
longer have to remove them from the array when their destructor is
called.

Review URL: https://codereview.chromium.org/966863002
/external/skia/src/pdf/SkPDFCanon.h
792c80f5a7b66e75d42664ccb298f31962c6654c 20-Feb-2015 halcanary <halcanary@google.com> PDF: Now threadsafe!

The PDF canvas is now just as threadsafe as any other Skia canvas.

DM updated to thread PDF tests.

SkDocument_PDF now owns SkPDFCanon, and pointers to that canon are
passed around to all classes that need access to the canon.

BUG=skia:2683

Review URL: https://codereview.chromium.org/944643002
/external/skia/src/pdf/SkPDFCanon.h
a1f1ee98a1f6d0770f6243270ca2f0e6c92efaba 20-Feb-2015 halcanary <halcanary@google.com> PDF : New factory function for SkPDFDevice

SkPDFDevice now has factory function that matches what callers need.

Review URL: https://codereview.chromium.org/941023005
/external/skia/src/pdf/SkPDFCanon.h
1b5c604d9d344537941b11b136348edfc39f236c 18-Feb-2015 halcanary <halcanary@google.com> 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
/external/skia/src/pdf/SkPDFCanon.h
530ea8e24bc88f2d7973c35a703f18c1dafb56dc 23-Jan-2015 halcanary <halcanary@google.com> More changes to SkPDFShader to eliminate multiple inheritance!

Review URL: https://codereview.chromium.org/873543002
/external/skia/src/pdf/SkPDFCanon.h
fb62b3d423fa34c672df42f47017dbef087d19e9 21-Jan-2015 halcanary <halcanary@google.com> SkPDFCanon

SkPDFCanon's fields and methods will eventually become part of
SkPDFDocument/SkDocument_PDF. For now, it exists as a singleton to
preflight that transition. This replaces three global arrays in
SkPDFFont, SkPDFShader, and SkPDFGraphicsContext. This code is still
thread-unsafe (http://skbug.com/2683), but moving this functionality
into SkPDFDocument will fix that.

This CL does not change pdf output from either GMs or SKPs.

This change also simplifies some code around the SkPDFCanon methods.

BUG=skia:2683

Review URL: https://codereview.chromium.org/842253003
/external/skia/src/pdf/SkPDFCanon.h