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

Side by Side Diff: src/pdf/SkPDFPage.cpp

Issue 846023003: In SkPDFDocument::emitPDF(), stop pre-calculating file offsets. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit: space between functions Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFPage.h ('k') | src/pdf/SkPDFStream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 The Android Open Source Project 3 * Copyright 2010 The Android Open Source Project
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 "SkData.h" 10 #include "SkData.h"
(...skipping 28 matching lines...) Expand all
39 SkAutoTUnref<SkData> content(fDevice->copyContentToData()); 39 SkAutoTUnref<SkData> content(fDevice->copyContentToData());
40 fContentStream.reset(new SkPDFStream(content.get())); 40 fContentStream.reset(new SkPDFStream(content.get()));
41 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref(); 41 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref();
42 } 42 }
43 catalog->addObject(fContentStream.get(), firstPage); 43 catalog->addObject(fContentStream.get(), firstPage);
44 resourceDict->getReferencedResources(knownResourceObjects, 44 resourceDict->getReferencedResources(knownResourceObjects,
45 newResourceObjects, 45 newResourceObjects,
46 true); 46 true);
47 } 47 }
48 48
49 off_t SkPDFPage::getPageSize(SkPDFCatalog* catalog, off_t fileOffset) {
50 SkASSERT(fContentStream.get() != NULL);
51 catalog->setFileOffset(fContentStream.get(), fileOffset);
52 return SkToOffT(fContentStream->getOutputSize(catalog, true));
53 }
54
55 void SkPDFPage::emitPage(SkWStream* stream, SkPDFCatalog* catalog) {
56 SkASSERT(fContentStream.get() != NULL);
57 fContentStream->emitIndirectObject(stream, catalog);
58 }
59
60 // static 49 // static
61 void SkPDFPage::GeneratePageTree(const SkTDArray<SkPDFPage*>& pages, 50 void SkPDFPage::GeneratePageTree(const SkTDArray<SkPDFPage*>& pages,
62 SkPDFCatalog* catalog, 51 SkPDFCatalog* catalog,
63 SkTDArray<SkPDFDict*>* pageTree, 52 SkTDArray<SkPDFDict*>* pageTree,
64 SkPDFDict** rootNode) { 53 SkPDFDict** rootNode) {
65 // PDF wants a tree describing all the pages in the document. We arbitrary 54 // PDF wants a tree describing all the pages in the document. We arbitrary
66 // choose 8 (kNodeSize) as the number of allowed children. The internal 55 // choose 8 (kNodeSize) as the number of allowed children. The internal
67 // nodes have type "Pages" with an array of children, a parent pointer, and 56 // nodes have type "Pages" with an array of children, a parent pointer, and
68 // the number of leaves below the node as "Count." The leaves are passed 57 // the number of leaves below the node as "Count." The leaves are passed
69 // into the method, have type "Page" and need a parent pointer. This method 58 // into the method, have type "Page" and need a parent pointer. This method
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return fDevice->getFontResources(); 138 return fDevice->getFontResources();
150 } 139 }
151 140
152 const SkPDFGlyphSetMap& SkPDFPage::getFontGlyphUsage() const { 141 const SkPDFGlyphSetMap& SkPDFPage::getFontGlyphUsage() const {
153 return fDevice->getFontGlyphUsage(); 142 return fDevice->getFontGlyphUsage();
154 } 143 }
155 144
156 void SkPDFPage::appendDestinations(SkPDFDict* dict) { 145 void SkPDFPage::appendDestinations(SkPDFDict* dict) {
157 fDevice->appendDestinations(dict, this); 146 fDevice->appendDestinations(dict, this);
158 } 147 }
148
149 SkPDFObject* SkPDFPage::getContentStream() const {
150 return fContentStream.get();
151 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFPage.h ('k') | src/pdf/SkPDFStream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698