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

Issue 2278703002: SkPDF: Glyph validation change (Closed)

Created:
4 years, 4 months ago by hal.canary
Modified:
4 years, 3 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: Glyph validation change Instead of mapping invaid glyphIDs to zero or maxGlyphID, don't draw them at all. Validate glyphs when glyph is written, not ahead of time. Don't allocate array to copy user-provided glyphs. Easy early exit from SkPDFDevice::internalDrawText() GlyphPositioner::flush() called ~GlyphPositioner() SkScopeExit class now exists. Assume SkTypeface* pointers are now never null in more places. precalculate alignmentFactor to clean up code. SkPDFDevice::updateFont must be called with validated glyphID. Skip bad glyphs to make this true. SkPDFDevice::updateFont always succeeds. SkPDFFont::GetFontResource always succeeds (preconditions are asserted). If GetMetrics fails, don't call GetFontResource. SkPDFFont::glyphsToPDFFontEncodingCount() becomes SkPDFFont::countStretch() and is inlined. SkPDFFont::glyphsToPDFFontEncoding now works one Glyph at a time and is inlined. SkPDFFont::noteGlyphUsage() operates one glyph at a time. Add SkScopeExit.h; also a unit test for it. SkPostConfig: Fix SK_UNUSED for Win32. No public API changes. TBR=reed@google.com BUG=625995 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2278703002 Committed: https://skia.googlesource.com/skia/+/4871f2277738fa7e9232d25424c008b36dae4711

Patch Set 1 #

Patch Set 2 : handle error better #

Patch Set 3 : major refactor #

Total comments: 20

Patch Set 4 : reply to bungemena@ #

Patch Set 5 : fix compile #

Total comments: 6

Patch Set 6 : 3 nits #

Total comments: 8

Patch Set 7 : rename, fix win #

Patch Set 8 : unit test for SK_AT_SCOPE_EXIT #

Total comments: 2

Patch Set 9 : fix comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+243 lines, -200 lines) Patch
M include/core/SkPostConfig.h View 1 2 3 4 5 6 1 chunk +5 lines, -1 line 0 comments Download
M src/pdf/SkPDFDevice.h View 1 2 1 chunk +5 lines, -2 lines 0 comments Download
M src/pdf/SkPDFDevice.cpp View 1 2 3 4 5 6 10 chunks +104 lines, -107 lines 0 comments Download
M src/pdf/SkPDFFont.h View 1 2 3 4 5 4 chunks +40 lines, -22 lines 0 comments Download
M src/pdf/SkPDFFont.cpp View 1 2 3 4 5 6 4 chunks +29 lines, -68 lines 0 comments Download
A src/pdf/SkScopeExit.h View 1 2 3 4 5 6 7 8 1 chunk +50 lines, -0 lines 0 comments Download
M tests/CPlusPlusEleven.cpp View 1 2 3 4 5 6 7 2 chunks +10 lines, -0 lines 0 comments Download

Messages

Total messages: 60 (42 generated)
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/2278703002/1
4 years, 4 months ago (2016-08-24 20:39:56 UTC) #3
commit-bot: I haz the power
Note for Reviewers: The CQ is waiting for an approval. If you believe that the ...
4 years, 4 months ago (2016-08-24 20:39:57 UTC) #4
hal.canary
PTAL
4 years, 4 months ago (2016-08-24 20:40:04 UTC) #6
commit-bot: I haz the power
Try jobs failed on following builders: Build-Ubuntu-GCC-x86_64-Release-GN-Trybot on master.client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu-GCC-x86_64-Release-GN-Trybot/builds/865)
4 years, 4 months ago (2016-08-24 20:42:46 UTC) #8
hal.canary
take another look
4 years, 3 months ago (2016-08-25 18:39:27 UTC) #24
bungeman-skia
https://codereview.chromium.org/2278703002/diff/80001/src/pdf/SkPDFDevice.cpp File src/pdf/SkPDFDevice.cpp (right): https://codereview.chromium.org/2278703002/diff/80001/src/pdf/SkPDFDevice.cpp#newcode975 src/pdf/SkPDFDevice.cpp:975: ~GlyphPositioner() {this->flush(); } nit: probably want a space between ...
4 years, 3 months ago (2016-08-25 19:28:44 UTC) #25
hal.canary
https://codereview.chromium.org/2278703002/diff/80001/src/pdf/SkPDFDevice.cpp File src/pdf/SkPDFDevice.cpp (right): https://codereview.chromium.org/2278703002/diff/80001/src/pdf/SkPDFDevice.cpp#newcode975 src/pdf/SkPDFDevice.cpp:975: ~GlyphPositioner() {this->flush(); } On 2016/08/25 19:28:43, bungeman-skia wrote: > ...
4 years, 3 months ago (2016-08-26 15:27:04 UTC) #29
bungeman-skia
https://codereview.chromium.org/2278703002/diff/140001/src/pdf/SkPDFDevice.cpp File src/pdf/SkPDFDevice.cpp (right): https://codereview.chromium.org/2278703002/diff/140001/src/pdf/SkPDFDevice.cpp#newcode1070 src/pdf/SkPDFDevice.cpp:1070: SK_MACRO_APPEND_LINE(at_scope_exit_){std::move(fn)} It would be nice for this to look ...
4 years, 3 months ago (2016-08-26 17:47:36 UTC) #36
hal.canary
https://codereview.chromium.org/2278703002/diff/140001/src/pdf/SkPDFDevice.cpp File src/pdf/SkPDFDevice.cpp (right): https://codereview.chromium.org/2278703002/diff/140001/src/pdf/SkPDFDevice.cpp#newcode1070 src/pdf/SkPDFDevice.cpp:1070: SK_MACRO_APPEND_LINE(at_scope_exit_){std::move(fn)} On 2016/08/26 17:47:36, bungeman-skia wrote: > It would ...
4 years, 3 months ago (2016-08-26 18:11:55 UTC) #39
bungeman-skia
https://codereview.chromium.org/2278703002/diff/180001/src/pdf/SkPDFFont.cpp File src/pdf/SkPDFFont.cpp (right): https://codereview.chromium.org/2278703002/diff/180001/src/pdf/SkPDFFont.cpp#newcode159 src/pdf/SkPDFFont.cpp:159: // Cache nullptr to skip this check. use SkSafeUnref. ...
4 years, 3 months ago (2016-08-26 18:24:42 UTC) #43
hal.canary
https://codereview.chromium.org/2278703002/diff/180001/src/pdf/SkPDFFont.cpp File src/pdf/SkPDFFont.cpp (right): https://codereview.chromium.org/2278703002/diff/180001/src/pdf/SkPDFFont.cpp#newcode159 src/pdf/SkPDFFont.cpp:159: // Cache nullptr to skip this check. use SkSafeUnref. ...
4 years, 3 months ago (2016-08-26 19:22:37 UTC) #48
hal.canary
unit test for SK_AT_SCOPE_EXIT added. description updated
4 years, 3 months ago (2016-08-26 19:35:51 UTC) #52
bungeman-skia
https://codereview.chromium.org/2278703002/diff/220001/src/pdf/SkScopeExit.h File src/pdf/SkScopeExit.h (right): https://codereview.chromium.org/2278703002/diff/220001/src/pdf/SkScopeExit.h#newcode14 src/pdf/SkScopeExit.h:14: * sk_at_scope_end(stmt) evaluates stmt when the current scope ends. ...
4 years, 3 months ago (2016-08-26 19:47:05 UTC) #53
hal.canary
On 2016/08/26 19:47:05, bungeman-skia wrote: > https://codereview.chromium.org/2278703002/diff/220001/src/pdf/SkScopeExit.h > File src/pdf/SkScopeExit.h (right): > > https://codereview.chromium.org/2278703002/diff/220001/src/pdf/SkScopeExit.h#newcode14 > ...
4 years, 3 months ago (2016-08-26 19:48:40 UTC) #54
hal.canary
https://codereview.chromium.org/2278703002/diff/220001/src/pdf/SkScopeExit.h File src/pdf/SkScopeExit.h (right): https://codereview.chromium.org/2278703002/diff/220001/src/pdf/SkScopeExit.h#newcode14 src/pdf/SkScopeExit.h:14: * sk_at_scope_end(stmt) evaluates stmt when the current scope ends. ...
4 years, 3 months ago (2016-08-26 19:49:01 UTC) #55
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/2278703002/240001
4 years, 3 months ago (2016-08-26 19:50:05 UTC) #57
bungeman-skia
lgtm
4 years, 3 months ago (2016-08-26 19:52:16 UTC) #58
commit-bot: I haz the power
4 years, 3 months ago (2016-08-26 20:17:49 UTC) #60
Message was sent while issue was closed.
Committed patchset #9 (id:240001) as
https://skia.googlesource.com/skia/+/4871f2277738fa7e9232d25424c008b36dae4711

Powered by Google App Engine
This is Rietveld 408576698