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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 const SkPoint verts[], const SkPoint texs[], | 280 const SkPoint verts[], const SkPoint texs[], |
281 const SkColor colors[], SkXfermode* xmode, | 281 const SkColor colors[], SkXfermode* xmode, |
282 const uint16_t indices[], int indexCount, | 282 const uint16_t indices[], int indexCount, |
283 const SkPaint& paint) = 0; | 283 const SkPaint& paint) = 0; |
284 /** The SkDevice passed will be an SkDevice which was returned by a call to | 284 /** The SkDevice passed will be an SkDevice which was returned by a call to |
285 onCreateDevice on this device with kSaveLayer_Usage. | 285 onCreateDevice on this device with kSaveLayer_Usage. |
286 */ | 286 */ |
287 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, | 287 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, |
288 const SkPaint&) = 0; | 288 const SkPaint&) = 0; |
289 | 289 |
290 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG | |
290 /** | 291 /** |
291 * On success (returns true), copy the device pixels into the bitmap. | 292 * On success (returns true), copy the device pixels into the bitmap. |
292 * On failure, the bitmap parameter is left unchanged and false is | 293 * On failure, the bitmap parameter is left unchanged and false is |
293 * returned. | 294 * returned. |
294 * | 295 * |
295 * The device's pixels are converted to the bitmap's config. The only | 296 * The device's pixels are converted to the bitmap's config. The only |
296 * supported config is kARGB_8888_Config, though this is likely to be | 297 * supported config is kARGB_8888_Config, though this is likely to be |
297 * relaxed in the future. The meaning of config kARGB_8888_Config is | 298 * relaxed in the future. The meaning of config kARGB_8888_Config is |
298 * modified by the enum param config8888. The default value interprets | 299 * modified by the enum param config8888. The default value interprets |
299 * kARGB_8888_Config as SkPMColor | 300 * kARGB_8888_Config as SkPMColor |
(...skipping 10 matching lines...) Expand all Loading... | |
310 * | 311 * |
311 * Other failure conditions: | 312 * Other failure conditions: |
312 * * If the device is not a raster device (e.g. PDF) then readPixels will | 313 * * If the device is not a raster device (e.g. PDF) then readPixels will |
313 * fail. | 314 * fail. |
314 * * If bitmap is texture-backed then readPixels will fail. (This may be | 315 * * If bitmap is texture-backed then readPixels will fail. (This may be |
315 * relaxed in the future.) | 316 * relaxed in the future.) |
316 */ | 317 */ |
317 bool readPixels(SkBitmap* bitmap, | 318 bool readPixels(SkBitmap* bitmap, |
318 int x, int y, | 319 int x, int y, |
319 SkCanvas::Config8888 config8888); | 320 SkCanvas::Config8888 config8888); |
321 #endif | |
322 bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y ); | |
320 | 323 |
321 /////////////////////////////////////////////////////////////////////////// | 324 /////////////////////////////////////////////////////////////////////////// |
322 | 325 |
323 /** Update as needed the pixel value in the bitmap, so that the caller can | 326 /** Update as needed the pixel value in the bitmap, so that the caller can |
324 access the pixels directly. | 327 access the pixels directly. |
325 @return The device contents as a bitmap | 328 @return The device contents as a bitmap |
326 */ | 329 */ |
327 virtual const SkBitmap& onAccessBitmap() = 0; | 330 virtual const SkBitmap& onAccessBitmap() = 0; |
328 | 331 |
329 /** Called when this device is installed into a Canvas. Balanced by a call | 332 /** Called when this device is installed into a Canvas. Balanced by a call |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 static const SkCanvas::Config8888 kPMColorAlias; | 368 static const SkCanvas::Config8888 kPMColorAlias; |
366 | 369 |
367 protected: | 370 protected: |
368 // default impl returns NULL | 371 // default impl returns NULL |
369 virtual SkSurface* newSurface(const SkImageInfo&); | 372 virtual SkSurface* newSurface(const SkImageInfo&); |
370 | 373 |
371 // default impl returns NULL | 374 // default impl returns NULL |
372 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); | 375 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); |
373 | 376 |
374 /** | 377 /** |
375 * Implements readPixels API. The caller will ensure that: | 378 * Implements readPixels API. The caller will ensure that: |
scroggo
2014/03/24 15:31:36
Is this comment intended to apply to the new onRea
reed1
2014/03/24 15:53:05
good point -- I'll move the comment into the ifdef
| |
376 * 1. bitmap has pixel config kARGB_8888_Config. | 379 * 1. bitmap has pixel config kARGB_8888_Config. |
377 * 2. bitmap has pixels. | 380 * 2. bitmap has pixels. |
378 * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is | 381 * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is |
379 * contained in the device bounds. | 382 * contained in the device bounds. |
380 */ | 383 */ |
381 virtual bool onReadPixels(const SkBitmap& bitmap, | 384 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG |
382 int x, int y, | 385 virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, SkCanvas::Co nfig8888); |
383 SkCanvas::Config8888 config8888); | 386 #endif |
387 | |
388 /** | |
389 * The caller is responsible for "pre-clipping" the dst. The impl can assum e that the dst | |
390 * image at the specified x,y offset will fit within the device's bounds. | |
391 * | |
392 * This is explicitly asserted in readPixels(), the public way to call this . | |
393 */ | |
394 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y); | |
384 | 395 |
385 /** | 396 /** |
386 * The caller is responsible for "pre-clipping" the src. The impl can assum e that the src | 397 * The caller is responsible for "pre-clipping" the src. The impl can assum e that the src |
387 * image at the specified x,y offset will fit within the device's bounds. | 398 * image at the specified x,y offset will fit within the device's bounds. |
388 * | 399 * |
389 * This is explicitly asserted in writePixelsDirect(), the public way to ca ll this. | 400 * This is explicitly asserted in writePixelsDirect(), the public way to ca ll this. |
390 */ | 401 */ |
391 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i nt y); | 402 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i nt y); |
392 | 403 |
393 /** | 404 /** |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 SkMetaData* fMetaData; | 478 SkMetaData* fMetaData; |
468 | 479 |
469 #ifdef SK_DEBUG | 480 #ifdef SK_DEBUG |
470 bool fAttachedToCanvas; | 481 bool fAttachedToCanvas; |
471 #endif | 482 #endif |
472 | 483 |
473 typedef SkRefCnt INHERITED; | 484 typedef SkRefCnt INHERITED; |
474 }; | 485 }; |
475 | 486 |
476 #endif | 487 #endif |
OLD | NEW |