| 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 | |
| 305 protected: | 283 protected: |
| 306 virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProp
s&); | 284 virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProp
s&); |
| 307 virtual bool onPeekPixels(SkPixmap*) { return false; } | 285 virtual bool onPeekPixels(SkPixmap*) { return false; } |
| 308 | 286 |
| 309 /** | 287 /** |
| 310 * The caller is responsible for "pre-clipping" the dst. The impl can assum
e that the dst | 288 * The caller is responsible for "pre-clipping" the dst. The impl can assum
e that the dst |
| 311 * image at the specified x,y offset will fit within the device's bounds. | 289 * image at the specified x,y offset will fit within the device's bounds. |
| 312 * | 290 * |
| 313 * This is explicitly asserted in readPixels(), the public way to call this
. | 291 * This is explicitly asserted in readPixels(), the public way to call this
. |
| 314 */ | 292 */ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 SkSurfaceProps fSurfaceProps; | 397 SkSurfaceProps fSurfaceProps; |
| 420 | 398 |
| 421 #ifdef SK_DEBUG | 399 #ifdef SK_DEBUG |
| 422 bool fAttachedToCanvas; | 400 bool fAttachedToCanvas; |
| 423 #endif | 401 #endif |
| 424 | 402 |
| 425 typedef SkRefCnt INHERITED; | 403 typedef SkRefCnt INHERITED; |
| 426 }; | 404 }; |
| 427 | 405 |
| 428 #endif | 406 #endif |
| OLD | NEW |