OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkPDFCatalog.h" | 10 #include "SkPDFCatalog.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 SkPDFFont* subsetFont = | 40 SkPDFFont* subsetFont = |
41 entry->fFont->getFontSubset(entry->fGlyphSet); | 41 entry->fFont->getFontSubset(entry->fGlyphSet); |
42 if (subsetFont) { | 42 if (subsetFont) { |
43 catalog->setSubstitute(entry->fFont, subsetFont); | 43 catalog->setSubstitute(entry->fFont, subsetFont); |
44 substitutes->push(subsetFont); // Transfer ownership to substitutes | 44 substitutes->push(subsetFont); // Transfer ownership to substitutes |
45 } | 45 } |
46 entry = iterator.next(); | 46 entry = iterator.next(); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 SkPDFDocument::SkPDFDocument(Flags flags) | 50 SkPDFDocument::SkPDFDocument() |
51 : fXRefFileOffset(0), | 51 : fXRefFileOffset(0), |
52 fTrailerDict(NULL) { | 52 fTrailerDict(NULL) { |
53 fCatalog.reset(new SkPDFCatalog(flags)); | 53 fCatalog.reset(SkNEW(SkPDFCatalog)); |
54 fDocCatalog = SkNEW_ARGS(SkPDFDict, ("Catalog")); | 54 fDocCatalog = SkNEW_ARGS(SkPDFDict, ("Catalog")); |
55 fCatalog->addObject(fDocCatalog, true); | 55 fCatalog->addObject(fDocCatalog, true); |
56 fFirstPageResources = NULL; | 56 fFirstPageResources = NULL; |
57 fOtherPageResources = NULL; | 57 fOtherPageResources = NULL; |
58 } | 58 } |
59 | 59 |
60 SkPDFDocument::~SkPDFDocument() { | 60 SkPDFDocument::~SkPDFDocument() { |
61 fPages.safeUnrefAll(); | 61 fPages.safeUnrefAll(); |
62 | 62 |
63 // The page tree has both child and parent pointers, so it creates a | 63 // The page tree has both child and parent pointers, so it creates a |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 fTrailerDict->insertInt("Size", int(objCount)); | 302 fTrailerDict->insertInt("Size", int(objCount)); |
303 fTrailerDict->insert("Root", new SkPDFObjRef(fDocCatalog))->unref(); | 303 fTrailerDict->insert("Root", new SkPDFObjRef(fDocCatalog))->unref(); |
304 } | 304 } |
305 | 305 |
306 stream->writeText("trailer\n"); | 306 stream->writeText("trailer\n"); |
307 fTrailerDict->emitObject(stream, fCatalog.get()); | 307 fTrailerDict->emitObject(stream, fCatalog.get()); |
308 stream->writeText("\nstartxref\n"); | 308 stream->writeText("\nstartxref\n"); |
309 stream->writeBigDecAsText(fXRefFileOffset); | 309 stream->writeBigDecAsText(fXRefFileOffset); |
310 stream->writeText("\n%%EOF"); | 310 stream->writeText("\n%%EOF"); |
311 } | 311 } |
OLD | NEW |