Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Issue 2253993002: SkPDF: cache metrics once. (Closed)

Created:
4 years, 4 months ago by hal.canary
Modified:
4 years, 4 months ago
Reviewers:
bungeman-skia
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

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 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 Committed: https://skia.googlesource.com/skia/+/cee13425b5cd862189d1e5d7cf8f258bccae5f5d

Patch Set 1 #

Total comments: 14

Patch Set 2 : 2016-08-17 (Wednesday) 14:22:07 EDT #

Total comments: 4

Patch Set 3 : 2016-08-17 (Wednesday) 15:29:42 EDT #

Total comments: 8

Patch Set 4 : 2016-08-17 (Wednesday) 16:14:00 EDT #

Patch Set 5 : metrics can be null 2016-08-18 (Thursday) 10:59:37 EDT #

Total comments: 4

Patch Set 6 : 2016-08-18 (Thursday) 11:37:09 EDT #

Unified diffs Side-by-side diffs Delta from patch set Stats (+218 lines, -420 lines) Patch
M src/pdf/SkPDFCanon.h View 1 2 4 chunks +5 lines, -17 lines 0 comments Download
M src/pdf/SkPDFCanon.cpp View 1 2 3 4 1 chunk +13 lines, -40 lines 0 comments Download
M src/pdf/SkPDFDocument.cpp View 2 chunks +1 line, -41 lines 0 comments Download
M src/pdf/SkPDFFont.h View 5 chunks +20 lines, -54 lines 0 comments Download
M src/pdf/SkPDFFont.cpp View 1 2 3 4 5 16 chunks +179 lines, -268 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 54 (37 generated)
hal.canary
4 years, 4 months ago (2016-08-17 18:01:50 UTC) #5
bungeman-skia
https://codereview.chromium.org/2253993002/diff/1/src/pdf/SkPDFCanon.cpp File src/pdf/SkPDFCanon.cpp (left): https://codereview.chromium.org/2253993002/diff/1/src/pdf/SkPDFCanon.cpp#oldcode31 src/pdf/SkPDFCanon.cpp:31: fPDFBitmapMap.reset(); Not clear why this reset is being removed ...
4 years, 4 months ago (2016-08-17 18:56:04 UTC) #11
bungeman-skia
https://codereview.chromium.org/2253993002/diff/20001/src/pdf/SkPDFCanon.cpp File src/pdf/SkPDFCanon.cpp (right): https://codereview.chromium.org/2253993002/diff/20001/src/pdf/SkPDFCanon.cpp#newcode16 src/pdf/SkPDFCanon.cpp:16: template <typename K, typename V> struct KVUnrefer { This ...
4 years, 4 months ago (2016-08-17 19:03:07 UTC) #14
hal.canary
https://codereview.chromium.org/2253993002/diff/1/src/pdf/SkPDFCanon.cpp File src/pdf/SkPDFCanon.cpp (left): https://codereview.chromium.org/2253993002/diff/1/src/pdf/SkPDFCanon.cpp#oldcode31 src/pdf/SkPDFCanon.cpp:31: fPDFBitmapMap.reset(); On 2016/08/17 18:56:04, bungeman-skia wrote: > Not clear ...
4 years, 4 months ago (2016-08-17 19:29:49 UTC) #15
bungeman-skia
lgtm with nits https://codereview.chromium.org/2253993002/diff/40001/src/pdf/SkPDFFont.cpp File src/pdf/SkPDFFont.cpp (right): https://codereview.chromium.org/2253993002/diff/40001/src/pdf/SkPDFFont.cpp#newcode274 src/pdf/SkPDFFont.cpp:274: SkTypeface::kToUnicode_PerGlyphInfo, nullptr, 0)); It's really strange ...
4 years, 4 months ago (2016-08-17 19:53:51 UTC) #18
hal.canary
https://codereview.chromium.org/2253993002/diff/40001/src/pdf/SkPDFFont.cpp File src/pdf/SkPDFFont.cpp (right): https://codereview.chromium.org/2253993002/diff/40001/src/pdf/SkPDFFont.cpp#newcode274 src/pdf/SkPDFFont.cpp:274: SkTypeface::kToUnicode_PerGlyphInfo, nullptr, 0)); On 2016/08/17 19:53:51, bungeman-skia wrote: > ...
4 years, 4 months ago (2016-08-17 20:14:07 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2253993002/60001
4 years, 4 months ago (2016-08-17 21:20:51 UTC) #28
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://skia.googlesource.com/skia/+/0a61270f4ba85d10659fb63a86817b435ec04c94
4 years, 4 months ago (2016-08-17 21:21:45 UTC) #30
mtklein
On 2016/08/17 21:21:45, commit-bot: I haz the power wrote: > Committed patchset #4 (id:60001) as ...
4 years, 4 months ago (2016-08-17 23:26:36 UTC) #31
robertphillips
A revert of this CL (patchset #4 id:60001) has been created in https://codereview.chromium.org/2251813006/ by robertphillips@google.com. ...
4 years, 4 months ago (2016-08-17 23:28:17 UTC) #32
robertphillips
On 2016/08/17 23:28:17, robertphillips wrote: > A revert of this CL (patchset #4 id:60001) has ...
4 years, 4 months ago (2016-08-17 23:32:05 UTC) #33
hal.canary
bungeman@, take a look at newest diff
4 years, 4 months ago (2016-08-18 15:03:59 UTC) #40
bungeman-skia
https://codereview.chromium.org/2253993002/diff/80001/src/pdf/SkPDFFont.cpp File src/pdf/SkPDFFont.cpp (right): https://codereview.chromium.org/2253993002/diff/80001/src/pdf/SkPDFFont.cpp#newcode277 src/pdf/SkPDFFont.cpp:277: SkDebugf("SkPDF: SkTypeface:getAdvancedTypefaceMetrics() returned null."); This should be SkDEBUGF so ...
4 years, 4 months ago (2016-08-18 15:17:28 UTC) #41
hal.canary
https://codereview.chromium.org/2253993002/diff/80001/src/pdf/SkPDFFont.cpp File src/pdf/SkPDFFont.cpp (right): https://codereview.chromium.org/2253993002/diff/80001/src/pdf/SkPDFFont.cpp#newcode277 src/pdf/SkPDFFont.cpp:277: SkDebugf("SkPDF: SkTypeface:getAdvancedTypefaceMetrics() returned null."); On 2016/08/18 15:17:28, bungeman-skia wrote: ...
4 years, 4 months ago (2016-08-18 15:37:35 UTC) #44
bungeman-skia
generally still lgtm
4 years, 4 months ago (2016-08-18 15:47:35 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2253993002/100001
4 years, 4 months ago (2016-08-18 16:51:51 UTC) #52
commit-bot: I haz the power
4 years, 4 months ago (2016-08-18 16:52:52 UTC) #54
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://skia.googlesource.com/skia/+/cee13425b5cd862189d1e5d7cf8f258bccae5f5d

Powered by Google App Engine
This is Rietveld 408576698