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

Side by Side Diff: include/pdf/SkPDFDevice.h

Issue 18977002: Add SkPDFResourceDict class, refactor existing code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rename SkPDFResourceDict::getResources to getRefResources (fix Clang build) Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « gyp/pdf.gyp ('k') | src/pdf/SkPDFDevice.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 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 #ifndef SkPDFDevice_DEFINED 10 #ifndef SkPDFDevice_DEFINED
(...skipping 10 matching lines...) Expand all
21 #include "SkTScopedPtr.h" 21 #include "SkTScopedPtr.h"
22 22
23 class SkPDFArray; 23 class SkPDFArray;
24 class SkPDFDevice; 24 class SkPDFDevice;
25 class SkPDFDict; 25 class SkPDFDict;
26 class SkPDFFont; 26 class SkPDFFont;
27 class SkPDFFormXObject; 27 class SkPDFFormXObject;
28 class SkPDFGlyphSetMap; 28 class SkPDFGlyphSetMap;
29 class SkPDFGraphicState; 29 class SkPDFGraphicState;
30 class SkPDFObject; 30 class SkPDFObject;
31 class SkPDFResourceDict;
31 class SkPDFShader; 32 class SkPDFShader;
32 class SkPDFStream; 33 class SkPDFStream;
33 template <typename T> class SkTSet; 34 template <typename T> class SkTSet;
34 35
35 // Private classes. 36 // Private classes.
36 struct ContentEntry; 37 struct ContentEntry;
37 struct GraphicStateEntry; 38 struct GraphicStateEntry;
38 struct NamedDestination; 39 struct NamedDestination;
39 40
40 typedef bool (*EncodeToDCTStream)(SkWStream* stream, const SkBitmap& bitmap, con st SkIRect& rect); 41 typedef bool (*EncodeToDCTStream)(SkWStream* stream, const SkBitmap& bitmap, con st SkIRect& rect);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 * if any at all. 141 * if any at all.
141 */ 142 */
142 void setDCTEncoder(EncodeToDCTStream encoder) { 143 void setDCTEncoder(EncodeToDCTStream encoder) {
143 fEncoder = encoder; 144 fEncoder = encoder;
144 } 145 }
145 146
146 // PDF specific methods. 147 // PDF specific methods.
147 148
148 /** Returns the resource dictionary for this device. 149 /** Returns the resource dictionary for this device.
149 */ 150 */
150 SK_API SkPDFDict* getResourceDict(); 151 SK_API SkPDFResourceDict* getResourceDict();
151
152 /** Get the list of resources (PDF objects) used on this page.
153 * This method will add to newResourceObjects any objects that this method
154 * depends on, but not already in knownResourceObjects. This might operate
155 * recursively so if this object depends on another object and that object
156 * depends on two more, all three objects will be added.
157 *
158 * @param knownResourceObjects The set of resources to be ignored.
159 * @param newResourceObjects The set to append dependant resources to.
160 * @param recursive If recursive is true, get the resources of the
161 * device's resources recursively. (Useful for adding
162 * objects to the catalog.)
163 */
164 SK_API void getResources(const SkTSet<SkPDFObject*>& knownResourceObjects,
165 SkTSet<SkPDFObject*>* newResourceObjects,
166 bool recursive) const;
167 152
168 /** Get the fonts used on this device. 153 /** Get the fonts used on this device.
169 */ 154 */
170 SK_API const SkTDArray<SkPDFFont*>& getFontResources() const; 155 SK_API const SkTDArray<SkPDFFont*>& getFontResources() const;
171 156
172 /** Add our named destinations to the supplied dictionary. 157 /** Add our named destinations to the supplied dictionary.
173 * @param dict Dictionary to add destinations to. 158 * @param dict Dictionary to add destinations to.
174 * @param page The PDF object representing the page for this device. 159 * @param page The PDF object representing the page for this device.
175 */ 160 */
176 void appendDestinations(SkPDFDict* dict, SkPDFObject* page); 161 void appendDestinations(SkPDFDict* dict, SkPDFObject* page);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // TODO(vandebo): push most of SkPDFDevice's state into a core object in 201 // TODO(vandebo): push most of SkPDFDevice's state into a core object in
217 // order to get the right access levels without using friend. 202 // order to get the right access levels without using friend.
218 friend class ScopedContentEntry; 203 friend class ScopedContentEntry;
219 204
220 SkISize fPageSize; 205 SkISize fPageSize;
221 SkISize fContentSize; 206 SkISize fContentSize;
222 SkMatrix fInitialTransform; 207 SkMatrix fInitialTransform;
223 SkClipStack fExistingClipStack; 208 SkClipStack fExistingClipStack;
224 SkRegion fExistingClipRegion; 209 SkRegion fExistingClipRegion;
225 SkPDFArray* fAnnotations; 210 SkPDFArray* fAnnotations;
226 SkPDFDict* fResourceDict; 211 SkPDFResourceDict* fResourceDict;
227 SkTDArray<NamedDestination*> fNamedDestinations; 212 SkTDArray<NamedDestination*> fNamedDestinations;
228 213
229 SkTDArray<SkPDFGraphicState*> fGraphicStateResources; 214 SkTDArray<SkPDFGraphicState*> fGraphicStateResources;
230 SkTDArray<SkPDFObject*> fXObjectResources; 215 SkTDArray<SkPDFObject*> fXObjectResources;
231 SkTDArray<SkPDFFont*> fFontResources; 216 SkTDArray<SkPDFFont*> fFontResources;
232 SkTDArray<SkPDFObject*> fShaderResources; 217 SkTDArray<SkPDFObject*> fShaderResources;
233 218
234 SkTScopedPtr<ContentEntry> fContentEntries; 219 SkTScopedPtr<ContentEntry> fContentEntries;
235 ContentEntry* fLastContentEntry; 220 ContentEntry* fLastContentEntry;
236 SkTScopedPtr<ContentEntry> fMarginContentEntries; 221 SkTScopedPtr<ContentEntry> fMarginContentEntries;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 const SkMatrix& matrix); 303 const SkMatrix& matrix);
319 void handleLinkToNamedDest(SkData* nameData, const SkRect& r, 304 void handleLinkToNamedDest(SkData* nameData, const SkRect& r,
320 const SkMatrix& matrix); 305 const SkMatrix& matrix);
321 void defineNamedDestination(SkData* nameData, const SkPoint& point, 306 void defineNamedDestination(SkData* nameData, const SkPoint& point,
322 const SkMatrix& matrix); 307 const SkMatrix& matrix);
323 308
324 typedef SkDevice INHERITED; 309 typedef SkDevice INHERITED;
325 }; 310 };
326 311
327 #endif 312 #endif
OLDNEW
« no previous file with comments | « gyp/pdf.gyp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698