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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 * Override and return true for filters that the device can handle | 267 * Override and return true for filters that the device can handle |
268 * intrinsically. Doing so means that SkCanvas will pass-through this | 268 * intrinsically. Doing so means that SkCanvas will pass-through this |
269 * filter to drawSprite and drawDevice (and potentially filterImage). | 269 * filter to drawSprite and drawDevice (and potentially filterImage). |
270 * Returning false means the SkCanvas will have apply the filter itself, | 270 * Returning false means the SkCanvas will have apply the filter itself, |
271 * and just pass the resulting image to the device. | 271 * and just pass the resulting image to the device. |
272 */ | 272 */ |
273 virtual bool canHandleImageFilter(const SkImageFilter*) { return false; } | 273 virtual bool canHandleImageFilter(const SkImageFilter*) { return false; } |
274 | 274 |
275 /** | 275 /** |
276 * Related (but not required) to canHandleImageFilter, this method returns | 276 * Related (but not required) to canHandleImageFilter, this method returns |
277 * true if the device could apply the filter to the src bitmap and return | 277 * true if the device could apply the filter to the src image and return |
278 * the result (and updates offset as needed). | 278 * the result (and updates offset as needed). |
279 * If the device does not recognize or support this filter, | 279 * If the device does not recognize or support this filter, |
280 * it just returns false and leaves result and offset unchanged. | 280 * it just returns false and leaves result and offset unchanged. |
281 */ | 281 */ |
282 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, | 282 virtual bool filterImage(const SkImageFilter*, const SkImage*, |
283 const SkImageFilter::Context&, | 283 const SkImageFilter::Context&, |
284 SkBitmap* /*result*/, SkIPoint* /*offset*/) { | 284 SkAutoTUnref<const SkImage>& /*result*/, SkIPoint*
/*offset*/) { |
285 return false; | 285 return false; |
286 } | 286 } |
287 | 287 |
288 protected: | 288 protected: |
289 // default impl returns NULL | 289 // default impl returns NULL |
290 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&); | 290 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&); |
291 | 291 |
292 // default impl returns NULL | 292 // default impl returns NULL |
293 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); | 293 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); |
294 | 294 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 private: | 364 private: |
365 friend class SkCanvas; | 365 friend class SkCanvas; |
366 friend struct DeviceCM; //for setMatrixClip | 366 friend struct DeviceCM; //for setMatrixClip |
367 friend class SkDraw; | 367 friend class SkDraw; |
368 friend class SkDrawIter; | 368 friend class SkDrawIter; |
369 friend class SkDeviceFilteredPaint; | 369 friend class SkDeviceFilteredPaint; |
370 friend class SkDeviceImageFilterProxy; | 370 friend class SkDeviceImageFilterProxy; |
371 friend class SkDeferredDevice; // for newSurface | 371 friend class SkDeferredDevice; // for newSurface |
372 friend class SkNoPixelsBitmapDevice; | 372 friend class SkNoPixelsBitmapDevice; |
373 | 373 |
| 374 friend class SkSurface; |
| 375 friend class SkSurface_Gpu; |
374 friend class SkSurface_Raster; | 376 friend class SkSurface_Raster; |
375 | 377 |
376 // used to change the backend's pixels (and possibly config/rowbytes) | 378 // used to change the backend's pixels (and possibly config/rowbytes) |
377 // but cannot change the width/height, so there should be no change to | 379 // but cannot change the width/height, so there should be no change to |
378 // any clip information. | 380 // any clip information. |
379 // TODO: move to SkBitmapDevice | 381 // TODO: move to SkBitmapDevice |
380 virtual void replaceBitmapBackend(const SkBitmap&) {} | 382 virtual void replaceBitmapBackend(const SkBitmap&) {} |
381 | 383 |
382 virtual bool forceConservativeRasterClip() const { return false; } | 384 virtual bool forceConservativeRasterClip() const { return false; } |
383 | 385 |
(...skipping 11 matching lines...) Expand all Loading... |
395 SkDeviceProperties* fLeakyProperties; // will always exist. | 397 SkDeviceProperties* fLeakyProperties; // will always exist. |
396 | 398 |
397 #ifdef SK_DEBUG | 399 #ifdef SK_DEBUG |
398 bool fAttachedToCanvas; | 400 bool fAttachedToCanvas; |
399 #endif | 401 #endif |
400 | 402 |
401 typedef SkRefCnt INHERITED; | 403 typedef SkRefCnt INHERITED; |
402 }; | 404 }; |
403 | 405 |
404 #endif | 406 #endif |
OLD | NEW |