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

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

Issue 1033543002: SKPDF: refactor pdfcatalog and pdfdocument (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-03-25 (Wednesday) 14:17:42 EDT Created 5 years, 9 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/SkPDFDocument.cpp ('k') | src/pdf/SkPDFPage.cpp » ('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 #ifndef SkPDFPage_DEFINED 10 #ifndef SkPDFPage_DEFINED
(...skipping 18 matching lines...) Expand all
29 public: 29 public:
30 /** Create a PDF page with the passed PDF device. The device need not 30 /** Create a PDF page with the passed PDF device. The device need not
31 * have content on it yet. 31 * have content on it yet.
32 * @param content The page content. 32 * @param content The page content.
33 */ 33 */
34 explicit SkPDFPage(const SkPDFDevice* content); 34 explicit SkPDFPage(const SkPDFDevice* content);
35 ~SkPDFPage(); 35 ~SkPDFPage();
36 36
37 /** Before a page and its contents can be sized and emitted, it must 37 /** Before a page and its contents can be sized and emitted, it must
38 * be finalized. No changes to the PDFDevice will be honored after 38 * be finalized. No changes to the PDFDevice will be honored after
39 * finalizePage has been called. This function adds the page content 39 * finalizePage has been called.
40 * to the passed catalog, so it must be called for each document
41 * that the page is part of.
42 * @param catalog The catalog to add page content objects to.
43 * @param firstPage Indicate if this is the first page of a document.
44 * @param newResourceObjects All the resource objects (recursively) used on
45 * the page are added to this array. This gives
46 * the caller a chance to deduplicate resources
47 * across pages.
48 * @param knownResourceObjects The set of resources to be ignored.
49 */ 40 */
50 void finalizePage(SkPDFCatalog* catalog, bool firstPage, 41 void finalizePage();
51 const SkTSet<SkPDFObject*>& knownResourceObjects,
52 SkTSet<SkPDFObject*>* newResourceObjects);
53 42
54 /** Add destinations for this page to the supplied dictionary. 43 /** Add destinations for this page to the supplied dictionary.
55 * @param dict Dictionary to add destinations to. 44 * @param dict Dictionary to add destinations to.
56 */ 45 */
57 void appendDestinations(SkPDFDict* dict); 46 void appendDestinations(SkPDFDict* dict);
58 47
59 /** Generate a page tree for the passed vector of pages. New objects are 48 /** Generate a page tree for the passed vector of pages. New objects are
60 * added to the catalog. The pageTree vector is populated with all of 49 * added to the catalog. The pageTree vector is populated with all of
61 * the 'Pages' dictionaries as well as the 'Page' objects. Page trees 50 * the 'Pages' dictionaries as well as the 'Page' objects. Page trees
62 * have both parent and children links, creating reference cycles, so 51 * have both parent and children links, creating reference cycles, so
63 * it must be torn down explicitly. The first page is not added to 52 * it must be torn down explicitly. The first page is not added to
64 * the pageTree dictionary array so the caller can handle it specially. 53 * the pageTree dictionary array so the caller can handle it specially.
65 * @param pages The ordered vector of page objects. 54 * @param pages The ordered vector of page objects.
66 * @param catalog The catalog to add new objects into.
67 * @param pageTree An output vector with all of the internal and leaf 55 * @param pageTree An output vector with all of the internal and leaf
68 * nodes of the pageTree. 56 * nodes of the pageTree.
69 * @param rootNode An output parameter set to the root node. 57 * @param rootNode An output parameter set to the root node.
70 */ 58 */
71 static void GeneratePageTree(const SkTDArray<SkPDFPage*>& pages, 59 static void GeneratePageTree(const SkTDArray<SkPDFPage*>& pages,
72 SkPDFCatalog* catalog,
73 SkTDArray<SkPDFDict*>* pageTree, 60 SkTDArray<SkPDFDict*>* pageTree,
74 SkPDFDict** rootNode); 61 SkPDFDict** rootNode);
75 62
76 /** Get the fonts used on this page. 63 /** Get the fonts used on this page.
77 */ 64 */
78 const SkTDArray<SkPDFFont*>& getFontResources() const; 65 const SkTDArray<SkPDFFont*>& getFontResources() const;
79 66
80 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font 67 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font
81 * that shows on this page. 68 * that shows on this page.
82 */ 69 */
83 const SkPDFGlyphSetMap& getFontGlyphUsage() const; 70 const SkPDFGlyphSetMap& getFontGlyphUsage() const;
84 71
85 SkPDFObject* getContentStream() const; 72 SkPDFObject* getContentStream() const;
86 73
87 private: 74 private:
88 // Multiple pages may reference the content. 75 // Multiple pages may reference the content.
89 SkAutoTUnref<const SkPDFDevice> fDevice; 76 SkAutoTUnref<const SkPDFDevice> fDevice;
90 77
91 // Once the content is finalized, put it into a stream for output. 78 // Once the content is finalized, put it into a stream for output.
92 SkAutoTUnref<SkPDFStream> fContentStream; 79 SkAutoTUnref<SkPDFStream> fContentStream;
93 typedef SkPDFDict INHERITED; 80 typedef SkPDFDict INHERITED;
94 }; 81 };
95 82
96 #endif 83 #endif
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDocument.cpp ('k') | src/pdf/SkPDFPage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698