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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 * pre-concated with the current matrix. | 200 * pre-concated with the current matrix. |
201 */ | 201 */ |
202 virtual void drawPath(const SkDraw&, const SkPath& path, | 202 virtual void drawPath(const SkDraw&, const SkPath& path, |
203 const SkPaint& paint, | 203 const SkPaint& paint, |
204 const SkMatrix* prePathMatrix = NULL, | 204 const SkMatrix* prePathMatrix = NULL, |
205 bool pathIsMutable = false) = 0; | 205 bool pathIsMutable = false) = 0; |
206 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, | 206 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, |
207 const SkMatrix& matrix, const SkPaint& paint) = 0; | 207 const SkMatrix& matrix, const SkPaint& paint) = 0; |
208 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, | 208 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, |
209 int x, int y, const SkPaint& paint) = 0; | 209 int x, int y, const SkPaint& paint) = 0; |
210 virtual void drawSprite(const SkDraw&, const SkImage& bitmap, | |
reed1
2015/02/25 16:36:20
naming nit: two virtuals w/ the same name are tric
| |
211 int x, int y, const SkPaint& paint) = 0; | |
210 | 212 |
211 /** | 213 /** |
212 * The default impl. will create a bitmap-shader from the bitmap, | 214 * The default impl. will create a bitmap-shader from the bitmap, |
213 * and call drawRect with it. | 215 * and call drawRect with it. |
214 */ | 216 */ |
215 virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, | 217 virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, |
216 const SkRect* srcOrNull, const SkRect& dst, | 218 const SkRect* srcOrNull, const SkRect& dst, |
217 const SkPaint& paint, | 219 const SkPaint& paint, |
218 SkCanvas::DrawBitmapRectFlags flags) = 0; | 220 SkCanvas::DrawBitmapRectFlags flags) = 0; |
219 | 221 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 * Override and return true for filters that the device can handle | 275 * Override and return true for filters that the device can handle |
274 * intrinsically. Doing so means that SkCanvas will pass-through this | 276 * intrinsically. Doing so means that SkCanvas will pass-through this |
275 * filter to drawSprite and drawDevice (and potentially filterImage). | 277 * filter to drawSprite and drawDevice (and potentially filterImage). |
276 * Returning false means the SkCanvas will have apply the filter itself, | 278 * Returning false means the SkCanvas will have apply the filter itself, |
277 * and just pass the resulting image to the device. | 279 * and just pass the resulting image to the device. |
278 */ | 280 */ |
279 virtual bool canHandleImageFilter(const SkImageFilter*) { return false; } | 281 virtual bool canHandleImageFilter(const SkImageFilter*) { return false; } |
280 | 282 |
281 /** | 283 /** |
282 * Related (but not required) to canHandleImageFilter, this method returns | 284 * Related (but not required) to canHandleImageFilter, this method returns |
283 * true if the device could apply the filter to the src bitmap and return | 285 * true if the device could apply the filter to the src image and return |
284 * the result (and updates offset as needed). | 286 * the result (and updates offset as needed). |
285 * If the device does not recognize or support this filter, | 287 * If the device does not recognize or support this filter, |
286 * it just returns false and leaves result and offset unchanged. | 288 * it just returns false and leaves result and offset unchanged. |
287 */ | 289 */ |
288 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, | 290 virtual bool filterImage(const SkImageFilter*, const SkImage*, |
289 const SkImageFilter::Context&, | 291 const SkImageFilter::Context&, |
290 SkBitmap* /*result*/, SkIPoint* /*offset*/) { | 292 SkAutoTUnref<const SkImage>& /*result*/, SkIPoint* /*offset*/) { |
291 return false; | 293 return false; |
292 } | 294 } |
293 | 295 |
294 protected: | 296 protected: |
295 // default impl returns NULL | 297 // default impl returns NULL |
296 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&); | 298 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&); |
297 | 299 |
298 // default impl returns NULL | 300 // default impl returns NULL |
299 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); | 301 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); |
300 | 302 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 private: | 368 private: |
367 friend class SkCanvas; | 369 friend class SkCanvas; |
368 friend struct DeviceCM; //for setMatrixClip | 370 friend struct DeviceCM; //for setMatrixClip |
369 friend class SkDraw; | 371 friend class SkDraw; |
370 friend class SkDrawIter; | 372 friend class SkDrawIter; |
371 friend class SkDeviceFilteredPaint; | 373 friend class SkDeviceFilteredPaint; |
372 friend class SkDeviceImageFilterProxy; | 374 friend class SkDeviceImageFilterProxy; |
373 friend class SkDeferredDevice; // for newSurface | 375 friend class SkDeferredDevice; // for newSurface |
374 friend class SkNoPixelsBitmapDevice; | 376 friend class SkNoPixelsBitmapDevice; |
375 | 377 |
378 friend class SkSurface; | |
379 friend class SkSurface_Gpu; | |
376 friend class SkSurface_Raster; | 380 friend class SkSurface_Raster; |
377 | 381 |
378 // used to change the backend's pixels (and possibly config/rowbytes) | 382 // used to change the backend's pixels (and possibly config/rowbytes) |
379 // but cannot change the width/height, so there should be no change to | 383 // but cannot change the width/height, so there should be no change to |
380 // any clip information. | 384 // any clip information. |
381 // TODO: move to SkBitmapDevice | 385 // TODO: move to SkBitmapDevice |
382 virtual void replaceBitmapBackend(const SkBitmap&) {} | 386 virtual void replaceBitmapBackend(const SkBitmap&) {} |
383 | 387 |
384 virtual bool forceConservativeRasterClip() const { return false; } | 388 virtual bool forceConservativeRasterClip() const { return false; } |
385 | 389 |
(...skipping 11 matching lines...) Expand all Loading... | |
397 SkDeviceProperties* fLeakyProperties; // will always exist. | 401 SkDeviceProperties* fLeakyProperties; // will always exist. |
398 | 402 |
399 #ifdef SK_DEBUG | 403 #ifdef SK_DEBUG |
400 bool fAttachedToCanvas; | 404 bool fAttachedToCanvas; |
401 #endif | 405 #endif |
402 | 406 |
403 typedef SkRefCnt INHERITED; | 407 typedef SkRefCnt INHERITED; |
404 }; | 408 }; |
405 | 409 |
406 #endif | 410 #endif |
OLD | NEW |