OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
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 SkDevice_DEFINED | 10 #ifndef SkDevice_DEFINED |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 const SkPoint verts[], const SkPoint texs[], | 300 const SkPoint verts[], const SkPoint texs[], |
301 const SkColor colors[], SkXfermode* xmode, | 301 const SkColor colors[], SkXfermode* xmode, |
302 const uint16_t indices[], int indexCount, | 302 const uint16_t indices[], int indexCount, |
303 const SkPaint& paint) = 0; | 303 const SkPaint& paint) = 0; |
304 /** The SkDevice passed will be an SkDevice which was returned by a call to | 304 /** The SkDevice passed will be an SkDevice which was returned by a call to |
305 onCreateDevice on this device with kSaveLayer_Usage. | 305 onCreateDevice on this device with kSaveLayer_Usage. |
306 */ | 306 */ |
307 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, | 307 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, |
308 const SkPaint&) = 0; | 308 const SkPaint&) = 0; |
309 | 309 |
| 310 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG |
310 /** | 311 /** |
311 * On success (returns true), copy the device pixels into the bitmap. | 312 * On success (returns true), copy the device pixels into the bitmap. |
312 * On failure, the bitmap parameter is left unchanged and false is | 313 * On failure, the bitmap parameter is left unchanged and false is |
313 * returned. | 314 * returned. |
314 * | 315 * |
315 * The device's pixels are converted to the bitmap's config. The only | 316 * The device's pixels are converted to the bitmap's config. The only |
316 * supported config is kARGB_8888_Config, though this is likely to be | 317 * supported config is kARGB_8888_Config, though this is likely to be |
317 * relaxed in the future. The meaning of config kARGB_8888_Config is | 318 * relaxed in the future. The meaning of config kARGB_8888_Config is |
318 * modified by the enum param config8888. The default value interprets | 319 * modified by the enum param config8888. The default value interprets |
319 * kARGB_8888_Config as SkPMColor | 320 * kARGB_8888_Config as SkPMColor |
(...skipping 10 matching lines...) Expand all Loading... |
330 * | 331 * |
331 * Other failure conditions: | 332 * Other failure conditions: |
332 * * If the device is not a raster device (e.g. PDF) then readPixels will | 333 * * If the device is not a raster device (e.g. PDF) then readPixels will |
333 * fail. | 334 * fail. |
334 * * If bitmap is texture-backed then readPixels will fail. (This may be | 335 * * If bitmap is texture-backed then readPixels will fail. (This may be |
335 * relaxed in the future.) | 336 * relaxed in the future.) |
336 */ | 337 */ |
337 bool readPixels(SkBitmap* bitmap, | 338 bool readPixels(SkBitmap* bitmap, |
338 int x, int y, | 339 int x, int y, |
339 SkCanvas::Config8888 config8888); | 340 SkCanvas::Config8888 config8888); |
| 341 #endif |
| 342 bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y
); |
340 | 343 |
341 /////////////////////////////////////////////////////////////////////////// | 344 /////////////////////////////////////////////////////////////////////////// |
342 | 345 |
343 /** Update as needed the pixel value in the bitmap, so that the caller can | 346 /** Update as needed the pixel value in the bitmap, so that the caller can |
344 access the pixels directly. | 347 access the pixels directly. |
345 @return The device contents as a bitmap | 348 @return The device contents as a bitmap |
346 */ | 349 */ |
347 virtual const SkBitmap& onAccessBitmap() = 0; | 350 virtual const SkBitmap& onAccessBitmap() = 0; |
348 | 351 |
349 /** Called when this device is installed into a Canvas. Balanced by a call | 352 /** Called when this device is installed into a Canvas. Balanced by a call |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // default impl returns NULL | 394 // default impl returns NULL |
392 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); | 395 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); |
393 | 396 |
394 /** | 397 /** |
395 * Implements readPixels API. The caller will ensure that: | 398 * Implements readPixels API. The caller will ensure that: |
396 * 1. bitmap has pixel config kARGB_8888_Config. | 399 * 1. bitmap has pixel config kARGB_8888_Config. |
397 * 2. bitmap has pixels. | 400 * 2. bitmap has pixels. |
398 * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is | 401 * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is |
399 * contained in the device bounds. | 402 * contained in the device bounds. |
400 */ | 403 */ |
401 virtual bool onReadPixels(const SkBitmap& bitmap, | 404 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG |
402 int x, int y, | 405 virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, SkCanvas::Co
nfig8888); |
403 SkCanvas::Config8888 config8888); | 406 #endif |
| 407 |
| 408 /** |
| 409 * The caller is responsible for "pre-clipping" the dst. The impl can assum
e that the dst |
| 410 * image at the specified x,y offset will fit within the device's bounds. |
| 411 * |
| 412 * This is explicitly asserted in readPixels(), the public way to call this
. |
| 413 */ |
| 414 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y); |
404 | 415 |
405 /** | 416 /** |
406 * The caller is responsible for "pre-clipping" the src. The impl can assum
e that the src | 417 * The caller is responsible for "pre-clipping" the src. The impl can assum
e that the src |
407 * image at the specified x,y offset will fit within the device's bounds. | 418 * image at the specified x,y offset will fit within the device's bounds. |
408 * | 419 * |
409 * This is explicitly asserted in writePixelsDirect(), the public way to ca
ll this. | 420 * This is explicitly asserted in writePixelsDirect(), the public way to ca
ll this. |
410 */ | 421 */ |
411 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y); | 422 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y); |
412 | 423 |
413 /** | 424 /** |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 SkMetaData* fMetaData; | 498 SkMetaData* fMetaData; |
488 | 499 |
489 #ifdef SK_DEBUG | 500 #ifdef SK_DEBUG |
490 bool fAttachedToCanvas; | 501 bool fAttachedToCanvas; |
491 #endif | 502 #endif |
492 | 503 |
493 typedef SkRefCnt INHERITED; | 504 typedef SkRefCnt INHERITED; |
494 }; | 505 }; |
495 | 506 |
496 #endif | 507 #endif |
OLD | NEW |