OLD | NEW |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 * @param encoder The encoder to encode a bitmap as JPEG (DCT). | 130 * @param encoder The encoder to encode a bitmap as JPEG (DCT). |
131 * Result of encodings are cached, if the encoder changes the | 131 * Result of encodings are cached, if the encoder changes the |
132 * behaivor dynamically and an image is added to a second catalog, | 132 * behaivor dynamically and an image is added to a second catalog, |
133 * we will likely use the result of the first encoding call. | 133 * we will likely use the result of the first encoding call. |
134 * By returning false from the encoder function, the encoder result | 134 * By returning false from the encoder function, the encoder result |
135 * is not used. | 135 * is not used. |
136 * Callers might not want to encode small images, as the time spent | 136 * Callers might not want to encode small images, as the time spent |
137 * encoding and decoding might not be worth the space savings, | 137 * encoding and decoding might not be worth the space savings, |
138 * if any at all. | 138 * if any at all. |
139 */ | 139 */ |
140 void setDCTEncoder(SkPicture::EncodeBitmap encoder) { | 140 void setDCTEncoder(SkData* (*encoder)(size_t*, const SkBitmap&)) { |
141 fEncoder = encoder; | 141 fEncoder = encoder; |
142 } | 142 } |
143 | 143 |
144 // PDF specific methods. | 144 // PDF specific methods. |
145 | 145 |
146 /** Returns the resource dictionary for this device. | 146 /** Returns the resource dictionary for this device. |
147 */ | 147 */ |
148 SK_API SkPDFResourceDict* getResourceDict(); | 148 SK_API SkPDFResourceDict* getResourceDict(); |
149 | 149 |
150 /** Get the fonts used on this device. | 150 /** Get the fonts used on this device. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 const SkClipStack* fClipStack; | 238 const SkClipStack* fClipStack; |
239 | 239 |
240 // Accessor and setter functions based on the current DrawingArea. | 240 // Accessor and setter functions based on the current DrawingArea. |
241 SkAutoTDelete<ContentEntry>* getContentEntries(); | 241 SkAutoTDelete<ContentEntry>* getContentEntries(); |
242 ContentEntry* getLastContentEntry(); | 242 ContentEntry* getLastContentEntry(); |
243 void setLastContentEntry(ContentEntry* contentEntry); | 243 void setLastContentEntry(ContentEntry* contentEntry); |
244 | 244 |
245 // Glyph ids used for each font on this device. | 245 // Glyph ids used for each font on this device. |
246 SkAutoTDelete<SkPDFGlyphSetMap> fFontGlyphUsage; | 246 SkAutoTDelete<SkPDFGlyphSetMap> fFontGlyphUsage; |
247 | 247 |
248 SkPicture::EncodeBitmap fEncoder; | 248 SkData* (*fEncoder)(size_t*, const SkBitmap&); |
249 SkScalar fRasterDpi; | 249 SkScalar fRasterDpi; |
250 | 250 |
251 SkBitmap fLegacyBitmap; | 251 SkBitmap fLegacyBitmap; |
252 | 252 |
253 SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack, | 253 SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack, |
254 const SkRegion& existingClipRegion); | 254 const SkRegion& existingClipRegion); |
255 | 255 |
256 // override from SkBaseDevice | 256 // override from SkBaseDevice |
257 SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; | 257 SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; |
258 | 258 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 typedef SkBaseDevice INHERITED; | 328 typedef SkBaseDevice INHERITED; |
329 | 329 |
330 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create | 330 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create |
331 // an SkPDFDevice | 331 // an SkPDFDevice |
332 //friend class SkDocument_PDF; | 332 //friend class SkDocument_PDF; |
333 //friend class SkPDFImageShader; | 333 //friend class SkPDFImageShader; |
334 }; | 334 }; |
335 | 335 |
336 #endif | 336 #endif |
OLD | NEW |