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

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

Issue 1034583002: SkPDF refactor skpdfdocument (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkToS32() 2015-03-24 (Tuesday) 16:54:14 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 | « no previous file | src/pdf/SkPDFDocument.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 SkPDFDocument_DEFINED 10 #ifndef SkPDFDocument_DEFINED
(...skipping 23 matching lines...) Expand all
34 34
35 /** Output the PDF to the passed stream. It is an error to call this (it 35 /** Output the PDF to the passed stream. It is an error to call this (it
36 * will return false and not modify stream) if no pages have been added 36 * will return false and not modify stream) if no pages have been added
37 * or there are pages missing (i.e. page 1 and 3 have been added, but not 37 * or there are pages missing (i.e. page 1 and 3 have been added, but not
38 * page 2). 38 * page 2).
39 * 39 *
40 * @param stream The writable output stream to send the PDF to. 40 * @param stream The writable output stream to send the PDF to.
41 */ 41 */
42 bool emitPDF(SkWStream* stream); 42 bool emitPDF(SkWStream* stream);
43 43
44 /** Sets the specific page to the passed PDF device. If the specified
45 * page is already set, this overrides it. Returns true if successful.
46 * Will fail if the document has already been emitted.
47 *
48 * @param pageNumber The position to add the passed device (1 based).
49 * @param pdfDevice The page to add to this document.
50 */
51 bool setPage(int pageNumber, SkPDFDevice* pdfDevice);
52
53 /** Append the passed pdf device to the document as a new page. Returns 44 /** Append the passed pdf device to the document as a new page. Returns
54 * true if successful. Will fail if the document has already been emitted. 45 * true if successful. Will fail if the document has already been emitted.
55 * 46 *
56 * @param pdfDevice The page to add to this document. 47 * @param pdfDevice The page to add to this document.
57 */ 48 */
58 bool appendPage(SkPDFDevice* pdfDevice); 49 bool appendPage(SkPDFDevice* pdfDevice) {
59 50 fPageDevices.push(SkRef(pdfDevice));
60 /** Get the count of unique font types used in the document. 51 return true;
61 * DEPRECATED. 52 }
62 */
63 void getCountOfFontTypes(
64 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 2]) const;
65 53
66 /** Get the count of unique font types used in the document. 54 /** Get the count of unique font types used in the document.
67 */ 55 */
68 void getCountOfFontTypes( 56 void getCountOfFontTypes(
69 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1], 57 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1],
70 int* notSubsettableCount, 58 int* notSubsettableCount,
71 int* notEmbedddableCount) const; 59 int* notEmbedddableCount) const;
72 60
73 private: 61 private:
74 SkAutoTDelete<SkPDFCatalog> fCatalog; 62 SkTDArray<SkPDFDevice*> fPageDevices;
75 int64_t fXRefFileOffset;
76
77 SkTDArray<SkPDFPage*> fPages;
78 SkTDArray<SkPDFDict*> fPageTree;
79 SkPDFDict* fDocCatalog;
80 SkTSet<SkPDFObject*>* fFirstPageResources;
81 SkTSet<SkPDFObject*>* fOtherPageResources;
82 SkTDArray<SkPDFObject*> fSubstitutes;
83
84 SkPDFDict* fTrailerDict;
85
86 /** Output the PDF header to the passed stream.
87 * @param stream The writable output stream to send the header to.
88 */
89 void emitHeader(SkWStream* stream);
90
91 /** Get the size of the header.
92 */
93 size_t headerSize();
94
95 /** Output the PDF footer to the passed stream.
96 * @param stream The writable output stream to send the footer to.
97 * @param objCount The number of objects in the PDF.
98 */
99 void emitFooter(SkWStream* stream, int64_t objCount);
100 }; 63 };
101 64
102 #endif 65 #endif
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698