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

Unified Diff: src/pdf/SkPDFDocument.cpp

Issue 15028012: [PDF] Only output the Dests dictionary if it isn't epmpty (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | 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 062263dce33436e7cf54a86368988242089cb236..0633d308285d116ef121e5bd754927639aaf2337 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -112,9 +112,7 @@ bool SkPDFDocument::emitPDF(SkWStream* stream) {
fDocCatalog->insert("OutputIntent", intentArray.get());
*/
- SkPDFDict* dests = SkNEW(SkPDFDict); // fPageResources owns reference
- fCatalog->addObject(dests, true /* onFirstPage */);
- fFirstPageResources->add(dests);
+ SkAutoTUnref<SkPDFDict> dests(SkNEW(SkPDFDict));
bool firstPage = true;
/* The references returned in newResources are transfered to
@@ -151,7 +149,12 @@ bool SkPDFDocument::emitPDF(SkWStream* stream) {
fPages[i]->appendDestinations(dests);
}
- fDocCatalog->insert("Dests", SkNEW_ARGS(SkPDFObjRef, (dests)))->unref();
+ if (dests->size() > 0) {
+ SkPDFDict* raw_dests = dests.get();
+ fFirstPageResources->add(dests.detach()); // Transfer ownership.
+ fCatalog->addObject(raw_dests, true /* onFirstPage */);
+ fDocCatalog->insert("Dests", SkNEW_ARGS(SkPDFObjRef, (raw_dests)))->unref();
+ }
// Build font subsetting info before proceeding.
perform_font_subsetting(fCatalog.get(), fPages, &fSubstitutes);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698