SkPDF: cache metrics once.
authorhalcanary <halcanary@google.com>
Thu, 18 Aug 2016 16:52:48 +0000 (09:52 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 18 Aug 2016 16:52:48 +0000 (09:52 -0700)
commitcee13425b5cd862189d1e5d7cf8f258bccae5f5d
treec09f3eef817ed91d8c5efdcfa09053203c1cb00e
parent7c1235457f7ef69d3bde48306e9be528718da7e6
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
src/pdf/SkPDFCanon.cpp
src/pdf/SkPDFCanon.h
src/pdf/SkPDFDocument.cpp
src/pdf/SkPDFFont.cpp
src/pdf/SkPDFFont.h