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 #ifndef SkDevice_DEFINED | 8 #ifndef SkDevice_DEFINED |
9 #define SkDevice_DEFINED | 9 #define SkDevice_DEFINED |
10 | 10 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y
); | 273 bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y
); |
274 | 274 |
275 /////////////////////////////////////////////////////////////////////////// | 275 /////////////////////////////////////////////////////////////////////////// |
276 | 276 |
277 /** Update as needed the pixel value in the bitmap, so that the caller can | 277 /** Update as needed the pixel value in the bitmap, so that the caller can |
278 access the pixels directly. | 278 access the pixels directly. |
279 @return The device contents as a bitmap | 279 @return The device contents as a bitmap |
280 */ | 280 */ |
281 virtual const SkBitmap& onAccessBitmap() = 0; | 281 virtual const SkBitmap& onAccessBitmap() = 0; |
282 | 282 |
| 283 /** |
| 284 * Override and return true for filters that the device can handle |
| 285 * intrinsically. Doing so means that SkCanvas will pass-through this |
| 286 * filter to drawSprite and drawDevice (and potentially filterImage). |
| 287 * Returning false means the SkCanvas will have apply the filter itself, |
| 288 * and just pass the resulting image to the device. |
| 289 */ |
| 290 virtual bool canHandleImageFilter(const SkImageFilter*) { return false; } |
| 291 |
| 292 /** |
| 293 * Related (but not required) to canHandleImageFilter, this method returns |
| 294 * true if the device could apply the filter to the src bitmap and return |
| 295 * the result (and updates offset as needed). |
| 296 * If the device does not recognize or support this filter, |
| 297 * it just returns false and leaves result and offset unchanged. |
| 298 */ |
| 299 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, |
| 300 const SkImageFilter::Context&, |
| 301 SkBitmap* /*result*/, SkIPoint* /*offset*/) { |
| 302 return false; |
| 303 } |
| 304 |
283 protected: | 305 protected: |
284 virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProp
s&); | 306 virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProp
s&); |
285 virtual bool onPeekPixels(SkPixmap*) { return false; } | 307 virtual bool onPeekPixels(SkPixmap*) { return false; } |
286 | 308 |
287 /** | 309 /** |
288 * The caller is responsible for "pre-clipping" the dst. The impl can assum
e that the dst | 310 * The caller is responsible for "pre-clipping" the dst. The impl can assum
e that the dst |
289 * image at the specified x,y offset will fit within the device's bounds. | 311 * image at the specified x,y offset will fit within the device's bounds. |
290 * | 312 * |
291 * This is explicitly asserted in readPixels(), the public way to call this
. | 313 * This is explicitly asserted in readPixels(), the public way to call this
. |
292 */ | 314 */ |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 SkSurfaceProps fSurfaceProps; | 419 SkSurfaceProps fSurfaceProps; |
398 | 420 |
399 #ifdef SK_DEBUG | 421 #ifdef SK_DEBUG |
400 bool fAttachedToCanvas; | 422 bool fAttachedToCanvas; |
401 #endif | 423 #endif |
402 | 424 |
403 typedef SkRefCnt INHERITED; | 425 typedef SkRefCnt INHERITED; |
404 }; | 426 }; |
405 | 427 |
406 #endif | 428 #endif |
OLD | NEW |