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

Unified Diff: src/pdf/SkPDFDocument.cpp

Issue 2112943002: SkPDF: Glyph Useage Map improvements (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFDocument.h ('k') | src/pdf/SkPDFFont.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDocument.cpp
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index c56d1ca9d45f9fc675d0ddf145f9e46cd03af9fc..221f240ba07c19fd221198623d95066cbb28650f 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -270,7 +270,6 @@ void SkPDFDocument::onEndPage() {
fCanvas->flush();
fCanvas.reset(nullptr);
SkASSERT(fPageDevice);
- fGlyphUsage.merge(fPageDevice->getFontGlyphUsage());
auto page = sk_make_sp<SkPDFDict>("Page");
page->insertObject("Resources", fPageDevice->makeResourceDict());
page->insertObject("MediaBox", fPageDevice->copyMediaBox());
@@ -293,6 +292,7 @@ void SkPDFDocument::onAbort() {
fPages.reset();
fCanon.reset();
renew(&fObjectSerializer);
+ renew(&fGlyphUsage);
}
#ifdef SK_SUPPORT_LEGACY_DOCUMENT_API
@@ -356,6 +356,7 @@ bool SkPDFDocument::onClose(SkWStream* stream) {
fPages.reset();
fCanon.reset();
renew(&fObjectSerializer);
+ renew(&fGlyphUsage);
return false;
}
auto docCatalog = sk_make_sp<SkPDFDict>("Catalog");
@@ -377,7 +378,7 @@ bool SkPDFDocument::onClose(SkWStream* stream) {
// Build font subsetting info before calling addObjectRecursively().
for (const auto& entry : fGlyphUsage) {
sk_sp<SkPDFFont> subsetFont(
- entry.fFont->getFontSubset(entry.fGlyphSet));
+ entry.fFont->getFontSubset(&entry.fGlyphSet));
if (subsetFont) {
fObjectSerializer.fSubstituteMap.setSubstitute(
entry.fFont, subsetFont.get());
@@ -389,6 +390,7 @@ bool SkPDFDocument::onClose(SkWStream* stream) {
fObjectSerializer.serializeFooter(this->getStream(), docCatalog, fID);
fCanon.reset();
renew(&fObjectSerializer);
+ renew(&fGlyphUsage);
return true;
}
« no previous file with comments | « src/pdf/SkPDFDocument.h ('k') | src/pdf/SkPDFFont.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698