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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 const SkPDFGlyphSetMap& getFontGlyphUsage() const { | 190 const SkPDFGlyphSetMap& getFontGlyphUsage() const { |
191 return *(fFontGlyphUsage.get()); | 191 return *(fFontGlyphUsage.get()); |
192 } | 192 } |
193 | 193 |
194 protected: | 194 protected: |
195 virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, | 195 virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, |
196 SkCanvas::Config8888) SK_OVERRIDE; | 196 SkCanvas::Config8888) SK_OVERRIDE; |
197 | 197 |
198 virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE; | 198 virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE; |
199 | 199 |
200 /** | |
201 * rasterDpi - the DPI at which features without native PDF support | |
202 * will be rasterized (e.g. draw image with perspective, | |
203 * draw text with perspective, ...) | |
204 * A larger DPI would create a PDF that reflects the original | |
205 * intent with better fidelity, but it can make for larger | |
206 * PDF files too, which would use more memory while rendering, | |
207 * and it would be slower to be processed or sent online or | |
208 * to printer. | |
209 */ | |
210 void setRasterDpi(SkScalar rasterDpi) { | |
211 fRasterDpi = rasterDpi; | |
vandebo (ex-Chrome)
2013/10/21 16:28:35
nit: you could move the 0 check down to this metho
edisonn
2013/10/21 16:36:34
IMHO it is way easier for a dev to find out the de
| |
212 } | |
213 | |
200 private: | 214 private: |
201 // TODO(vandebo): push most of SkPDFDevice's state into a core object in | 215 // TODO(vandebo): push most of SkPDFDevice's state into a core object in |
202 // order to get the right access levels without using friend. | 216 // order to get the right access levels without using friend. |
203 friend class ScopedContentEntry; | 217 friend class ScopedContentEntry; |
204 | 218 |
205 SkISize fPageSize; | 219 SkISize fPageSize; |
206 SkISize fContentSize; | 220 SkISize fContentSize; |
207 SkMatrix fInitialTransform; | 221 SkMatrix fInitialTransform; |
208 SkClipStack fExistingClipStack; | 222 SkClipStack fExistingClipStack; |
209 SkRegion fExistingClipRegion; | 223 SkRegion fExistingClipRegion; |
(...skipping 16 matching lines...) Expand all Loading... | |
226 | 240 |
227 // Accessor and setter functions based on the current DrawingArea. | 241 // Accessor and setter functions based on the current DrawingArea. |
228 SkAutoTDelete<ContentEntry>* getContentEntries(); | 242 SkAutoTDelete<ContentEntry>* getContentEntries(); |
229 ContentEntry* getLastContentEntry(); | 243 ContentEntry* getLastContentEntry(); |
230 void setLastContentEntry(ContentEntry* contentEntry); | 244 void setLastContentEntry(ContentEntry* contentEntry); |
231 | 245 |
232 // Glyph ids used for each font on this device. | 246 // Glyph ids used for each font on this device. |
233 SkAutoTDelete<SkPDFGlyphSetMap> fFontGlyphUsage; | 247 SkAutoTDelete<SkPDFGlyphSetMap> fFontGlyphUsage; |
234 | 248 |
235 SkPicture::EncodeBitmap fEncoder; | 249 SkPicture::EncodeBitmap fEncoder; |
250 SkScalar fRasterDpi; | |
236 | 251 |
237 SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack, | 252 SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack, |
238 const SkRegion& existingClipRegion); | 253 const SkRegion& existingClipRegion); |
239 | 254 |
240 // override from SkBaseDevice | 255 // override from SkBaseDevice |
241 virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config, | 256 virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config, |
242 int width, int height, | 257 int width, int height, |
243 bool isOpaque, | 258 bool isOpaque, |
244 Usage usage) SK_OVERRIDE; | 259 Usage usage) SK_OVERRIDE; |
245 | 260 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 | 328 |
314 typedef SkBitmapDevice INHERITED; | 329 typedef SkBitmapDevice INHERITED; |
315 | 330 |
316 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to create | 331 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to create |
317 // an SkPDFDevice | 332 // an SkPDFDevice |
318 //friend class SkDocument_PDF; | 333 //friend class SkDocument_PDF; |
319 //friend class SkPDFImageShader; | 334 //friend class SkPDFImageShader; |
320 }; | 335 }; |
321 | 336 |
322 #endif | 337 #endif |
OLD | NEW |