OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #ifndef SkPDFTypes_DEFINED | 9 #ifndef SkPDFTypes_DEFINED |
10 #define SkPDFTypes_DEFINED | 10 #define SkPDFTypes_DEFINED |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 | 34 |
35 /** Subclasses must implement this method to print the object to the | 35 /** Subclasses must implement this method to print the object to the |
36 * PDF file. | 36 * PDF file. |
37 * @param catalog The object catalog to use. | 37 * @param catalog The object catalog to use. |
38 * @param stream The writable output stream to send the output to. | 38 * @param stream The writable output stream to send the output to. |
39 */ | 39 */ |
40 // TODO(halcanary): make this method const | 40 // TODO(halcanary): make this method const |
41 virtual void emitObject(SkWStream* stream, | 41 virtual void emitObject(SkWStream* stream, |
42 const SkPDFObjNumMap& objNumMap, | 42 const SkPDFObjNumMap& objNumMap, |
43 const SkPDFSubstituteMap& substitutes) = 0; | 43 const SkPDFSubstituteMap& substitutes) const = 0; |
44 | 44 |
45 /** | 45 /** |
46 * Adds all transitive dependencies of this object to the | 46 * Adds all transitive dependencies of this object to the |
47 * catalog. Implementations should respect the catalog's object | 47 * catalog. Implementations should respect the catalog's object |
48 * substitution map. | 48 * substitution map. |
49 */ | 49 */ |
50 virtual void addResources(SkPDFObjNumMap* catalog, | 50 virtual void addResources(SkPDFObjNumMap* catalog, |
51 const SkPDFSubstituteMap& substitutes) const {} | 51 const SkPDFSubstituteMap& substitutes) const {} |
52 | 52 |
53 private: | 53 private: |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 static const int kMaxLen = 8191; | 193 static const int kMaxLen = 8191; |
194 | 194 |
195 /** Create a PDF array. Maximum length is 8191. | 195 /** Create a PDF array. Maximum length is 8191. |
196 */ | 196 */ |
197 SkPDFArray(); | 197 SkPDFArray(); |
198 virtual ~SkPDFArray(); | 198 virtual ~SkPDFArray(); |
199 | 199 |
200 // The SkPDFObject interface. | 200 // The SkPDFObject interface. |
201 void emitObject(SkWStream* stream, | 201 void emitObject(SkWStream* stream, |
202 const SkPDFObjNumMap& objNumMap, | 202 const SkPDFObjNumMap& objNumMap, |
203 const SkPDFSubstituteMap& substitutes) override; | 203 const SkPDFSubstituteMap& substitutes) const override; |
204 void addResources(SkPDFObjNumMap*, | 204 void addResources(SkPDFObjNumMap*, |
205 const SkPDFSubstituteMap&) const override; | 205 const SkPDFSubstituteMap&) const override; |
206 | 206 |
207 /** The size of the array. | 207 /** The size of the array. |
208 */ | 208 */ |
209 int size() const; | 209 int size() const; |
210 | 210 |
211 /** Preallocate space for the given number of entries. | 211 /** Preallocate space for the given number of entries. |
212 * @param length The number of array slots to preallocate. | 212 * @param length The number of array slots to preallocate. |
213 */ | 213 */ |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 /** Create a PDF dictionary with a Type entry. | 248 /** Create a PDF dictionary with a Type entry. |
249 * @param type The value of the Type entry. | 249 * @param type The value of the Type entry. |
250 */ | 250 */ |
251 explicit SkPDFDict(const char type[]); | 251 explicit SkPDFDict(const char type[]); |
252 | 252 |
253 virtual ~SkPDFDict(); | 253 virtual ~SkPDFDict(); |
254 | 254 |
255 // The SkPDFObject interface. | 255 // The SkPDFObject interface. |
256 void emitObject(SkWStream* stream, | 256 void emitObject(SkWStream* stream, |
257 const SkPDFObjNumMap& objNumMap, | 257 const SkPDFObjNumMap& objNumMap, |
258 const SkPDFSubstituteMap& substitutes) override; | 258 const SkPDFSubstituteMap& substitutes) const override; |
259 void addResources(SkPDFObjNumMap*, | 259 void addResources(SkPDFObjNumMap*, |
260 const SkPDFSubstituteMap&) const override; | 260 const SkPDFSubstituteMap&) const override; |
261 | 261 |
262 /** The size of the dictionary. | 262 /** The size of the dictionary. |
263 */ | 263 */ |
264 int size() const; | 264 int size() const; |
265 | 265 |
266 /** Add the value to the dictionary with the given key. Takes | 266 /** Add the value to the dictionary with the given key. Takes |
267 * ownership of the object. | 267 * ownership of the object. |
268 * @param key The text of the key for this dictionary entry. | 268 * @param key The text of the key for this dictionary entry. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 SkPDFObject* operator()(SkPDFObject* o) const { | 353 SkPDFObject* operator()(SkPDFObject* o) const { |
354 return this->getSubstitute(o); | 354 return this->getSubstitute(o); |
355 } | 355 } |
356 | 356 |
357 private: | 357 private: |
358 SkTHashMap<SkPDFObject*, SkPDFObject*> fSubstituteMap; | 358 SkTHashMap<SkPDFObject*, SkPDFObject*> fSubstituteMap; |
359 }; | 359 }; |
360 | 360 |
361 #endif | 361 #endif |
OLD | NEW |