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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 * to the specific drawing area (margin or content). The default drawing | 119 * to the specific drawing area (margin or content). The default drawing |
120 * area is the content drawing area. | 120 * area is the content drawing area. |
121 * | 121 * |
122 * Currently if margin content is drawn and then a complex (for PDF) xfer | 122 * Currently if margin content is drawn and then a complex (for PDF) xfer |
123 * mode is used, like SrcIn, Clear, etc, the margin content will get | 123 * mode is used, like SrcIn, Clear, etc, the margin content will get |
124 * clipped. A simple way to avoid the bug is to always draw the margin | 124 * clipped. A simple way to avoid the bug is to always draw the margin |
125 * content last. | 125 * content last. |
126 */ | 126 */ |
127 SK_API void setDrawingArea(DrawingArea drawingArea); | 127 SK_API void setDrawingArea(DrawingArea drawingArea); |
128 | 128 |
129 /** Sets the DCTEncoder for images. | |
130 * @param encoder The encoder to encode a bitmap as JPEG (DCT). | |
131 * Result of encodings are cached, if the encoder changes the | |
132 * behaivor dynamically and an image is added to a second catalog, | |
133 * we will likely use the result of the first encoding call. | |
134 * By returning false from the encoder function, the encoder result | |
135 * is not used. | |
136 * Callers might not want to encode small images, as the time spent | |
137 * encoding and decoding might not be worth the space savings, | |
138 * if any at all. | |
139 */ | |
140 void setDCTEncoder(SkData* (*encoder)(size_t*, const SkBitmap&)) { | |
141 fEncoder = encoder; | |
142 } | |
143 | |
144 // PDF specific methods. | 129 // PDF specific methods. |
145 | 130 |
146 /** Returns the resource dictionary for this device. | 131 /** Returns the resource dictionary for this device. |
147 */ | 132 */ |
148 SK_API SkPDFResourceDict* getResourceDict(); | 133 SK_API SkPDFResourceDict* getResourceDict(); |
149 | 134 |
150 /** Get the fonts used on this device. | 135 /** Get the fonts used on this device. |
151 */ | 136 */ |
152 SK_API const SkTDArray<SkPDFFont*>& getFontResources() const; | 137 SK_API const SkTDArray<SkPDFFont*>& getFontResources() const; |
153 | 138 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 const SkClipStack* fClipStack; | 223 const SkClipStack* fClipStack; |
239 | 224 |
240 // Accessor and setter functions based on the current DrawingArea. | 225 // Accessor and setter functions based on the current DrawingArea. |
241 SkAutoTDelete<ContentEntry>* getContentEntries(); | 226 SkAutoTDelete<ContentEntry>* getContentEntries(); |
242 ContentEntry* getLastContentEntry(); | 227 ContentEntry* getLastContentEntry(); |
243 void setLastContentEntry(ContentEntry* contentEntry); | 228 void setLastContentEntry(ContentEntry* contentEntry); |
244 | 229 |
245 // Glyph ids used for each font on this device. | 230 // Glyph ids used for each font on this device. |
246 SkAutoTDelete<SkPDFGlyphSetMap> fFontGlyphUsage; | 231 SkAutoTDelete<SkPDFGlyphSetMap> fFontGlyphUsage; |
247 | 232 |
248 SkData* (*fEncoder)(size_t*, const SkBitmap&); | |
249 SkScalar fRasterDpi; | 233 SkScalar fRasterDpi; |
250 | 234 |
251 SkBitmap fLegacyBitmap; | 235 SkBitmap fLegacyBitmap; |
252 | 236 |
253 SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack, | 237 SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack, |
254 const SkRegion& existingClipRegion); | 238 const SkRegion& existingClipRegion); |
255 | 239 |
256 // override from SkBaseDevice | 240 // override from SkBaseDevice |
257 SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; | 241 SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; |
258 | 242 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 311 |
328 typedef SkBaseDevice INHERITED; | 312 typedef SkBaseDevice INHERITED; |
329 | 313 |
330 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create | 314 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create |
331 // an SkPDFDevice | 315 // an SkPDFDevice |
332 //friend class SkDocument_PDF; | 316 //friend class SkDocument_PDF; |
333 //friend class SkPDFImageShader; | 317 //friend class SkPDFImageShader; |
334 }; | 318 }; |
335 | 319 |
336 #endif | 320 #endif |
OLD | NEW |