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

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

Issue 870333002: Simplify reference management in SkPDF (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-02-10 (Tuesday) 11:05:24 EST Created 5 years, 10 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/SkPDFCatalog.cpp » ('j') | src/pdf/SkPDFCatalog.cpp » ('J')
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 SkPDFCatalog_DEFINED 10 #ifndef SkPDFCatalog_DEFINED
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 * @param offset The byte offset in the output stream of this object. 42 * @param offset The byte offset in the output stream of this object.
43 */ 43 */
44 void setFileOffset(SkPDFObject* obj, off_t offset); 44 void setFileOffset(SkPDFObject* obj, off_t offset);
45 45
46 /** Output the object number for the passed object. 46 /** Output the object number for the passed object.
47 * @param obj The object of interest. 47 * @param obj The object of interest.
48 * @param stream The writable output stream to send the output to. 48 * @param stream The writable output stream to send the output to.
49 */ 49 */
50 void emitObjectNumber(SkWStream* stream, SkPDFObject* obj); 50 void emitObjectNumber(SkWStream* stream, SkPDFObject* obj);
51 51
52 /** Return the number of bytes that would be emitted for the passed
53 * object's object number.
54 * @param obj The object of interest
55 */
56 size_t getObjectNumberSize(SkPDFObject* obj);
57
58 /** Return the document flags in effect for this catalog/document. 52 /** Return the document flags in effect for this catalog/document.
59 */ 53 */
60 SkPDFDocument::Flags getDocumentFlags() const { return fDocumentFlags; } 54 SkPDFDocument::Flags getDocumentFlags() const { return fDocumentFlags; }
61 55
62 /** Output the cross reference table for objects in the catalog. 56 /** Output the cross reference table for objects in the catalog.
63 * Returns the total number of objects. 57 * Returns the total number of objects.
64 * @param stream The writable output stream to send the output to. 58 * @param stream The writable output stream to send the output to.
65 * @param firstPage If true, include first page objects only, otherwise 59 * @param firstPage If true, include first page objects only, otherwise
66 * include all objects not on the first page. 60 * include all objects not on the first page.
67 */ 61 */
68 int32_t emitXrefTable(SkWStream* stream, bool firstPage); 62 int32_t emitXrefTable(SkWStream* stream, bool firstPage);
69 63
70 /** Set substitute object for the passed object. 64 /** Set substitute object for the passed object.
71 */ 65 */
72 void setSubstitute(SkPDFObject* original, SkPDFObject* substitute); 66 void setSubstitute(SkPDFObject* original, SkPDFObject* substitute);
73 67
74 /** Find and return any substitute object set for the passed object. If 68 /** Find and return any substitute object set for the passed object. If
75 * there is none, return the passed object. 69 * there is none, return the passed object.
76 */ 70 */
77 SkPDFObject* getSubstituteObject(SkPDFObject* object); 71 SkPDFObject* getSubstituteObject(SkPDFObject* object);
78 72
79 /** get the resources of substitute objects.
80 */
81 SkTSet<SkPDFObject*>* getSubstituteList(bool firstPage);
82
83 private: 73 private:
84 struct Rec { 74 struct Rec {
85 Rec(SkPDFObject* object, bool onFirstPage) 75 Rec(SkPDFObject* object, bool onFirstPage)
86 : fObject(object), 76 : fObject(object),
87 fFileOffset(0), 77 fFileOffset(0),
88 fObjNumAssigned(false), 78 fObjNumAssigned(false),
89 fOnFirstPage(onFirstPage) { 79 fOnFirstPage(onFirstPage) {
90 } 80 }
91 SkPDFObject* fObject; 81 SkPDFObject* fObject;
92 off_t fFileOffset; 82 off_t fFileOffset;
(...skipping 19 matching lines...) Expand all
112 102
113 // Number of objects on the first page. 103 // Number of objects on the first page.
114 uint32_t fFirstPageCount; 104 uint32_t fFirstPageCount;
115 // Next object number to assign (on page > 1). 105 // Next object number to assign (on page > 1).
116 uint32_t fNextObjNum; 106 uint32_t fNextObjNum;
117 // Next object number to assign on the first page. 107 // Next object number to assign on the first page.
118 uint32_t fNextFirstPageObjNum; 108 uint32_t fNextFirstPageObjNum;
119 109
120 SkPDFDocument::Flags fDocumentFlags; 110 SkPDFDocument::Flags fDocumentFlags;
121 111
122 int findObjectIndex(SkPDFObject* obj) const; 112 int findObjectIndex(SkPDFObject* obj);
123 113
124 int assignObjNum(SkPDFObject* obj); 114 int assignObjNum(SkPDFObject* obj);
125 }; 115 };
126 116
127 #endif 117 #endif
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFCatalog.cpp » ('j') | src/pdf/SkPDFCatalog.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698