| Index: include/core/SkCanvas.h
|
| diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
|
| index b5df1e85e02fb9bf49093aefa8b5c350285007b9..1e41babd9e0835d839eb7a0bd3979668c4aff207 100644
|
| --- a/include/core/SkCanvas.h
|
| +++ b/include/core/SkCanvas.h
|
| @@ -18,6 +18,8 @@
|
| #include "SkRegion.h"
|
| #include "SkXfermode.h"
|
|
|
| +//#define SK_SUPPORT_LEGACY_READPIXELSCONFIG
|
| +
|
| // if not defined, we always assume ClipToLayer for saveLayer()
|
| //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
|
|
|
| @@ -265,6 +267,7 @@ public:
|
| kRGBA_Unpremul_Config8888
|
| };
|
|
|
| +#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
|
| /**
|
| * On success (returns true), copy the canvas pixels into the bitmap.
|
| * On failure, the bitmap parameter is left unchanged and false is
|
| @@ -301,17 +304,8 @@ public:
|
| * // use the pixels
|
| * }
|
| */
|
| - bool readPixels(SkBitmap* bitmap,
|
| - int x, int y,
|
| - Config8888 config8888 = kNative_Premul_Config8888);
|
| -
|
| - /**
|
| - * DEPRECATED: This will be removed as soon as webkit is no longer relying
|
| - * on it. The bitmap is resized to the intersection of srcRect and the
|
| - * canvas bounds. New pixels are always allocated on success. Bitmap is
|
| - * unmodified on failure.
|
| - */
|
| - bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
|
| + bool readPixels(SkBitmap* bitmap, int x, int y, Config8888 config8888);
|
| +#endif
|
|
|
| #ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG
|
| /**
|
| @@ -334,6 +328,42 @@ public:
|
| #endif
|
|
|
| /**
|
| + * Copy the pixels from the base-layer into the specified buffer (pixels + rowBytes),
|
| + * converting them into the requested format (SkImageInfo). The base-layer pixels are read
|
| + * starting at the specified (x,y) location in the coordinate system of the base-layer.
|
| + *
|
| + * The specified ImageInfo and (x,y) offset specifies a source rectangle
|
| + *
|
| + * srcR(x, y, info.width(), info.height());
|
| + *
|
| + * SrcR is intersected with the bounds of the base-layer. If this intersection is not empty,
|
| + * then we have two sets of pixels (of equal size), the "src" specified by base-layer at (x,y)
|
| + * and the "dst" by info+pixels+rowBytes. Replace the dst pixels with the corresponding src
|
| + * pixels, performing any colortype/alphatype transformations needed (in the case where the
|
| + * src and dst have different colortypes or alphatypes).
|
| + *
|
| + * This call can fail, returning false, for several reasons:
|
| + * - If the requested colortype/alphatype cannot be converted from the base-layer's types.
|
| + * - If this canvas is not backed by pixels (e.g. picture or PDF)
|
| + */
|
| + bool readPixels(const SkImageInfo&, void* pixels, size_t rowBytes, int x, int y);
|
| +
|
| + /**
|
| + * Helper for calling readPixels(info, ...). This call will check if bitmap has been allocated.
|
| + * If not, it will attempt to call allocPixels(). If this fails, it will return false. If not,
|
| + * it calls through to readPixels(info, ...) and returns its result.
|
| + */
|
| + bool readPixels(SkBitmap* bitmap, int x, int y);
|
| +
|
| + /**
|
| + * Helper for allocating pixels and then calling readPixels(info, ...). The bitmap is resized
|
| + * to the intersection of srcRect and the base-layer bounds. On success, pixels will be
|
| + * allocated in bitmap and true returned. On failure, false is returned and bitmap will be
|
| + * set to empty.
|
| + */
|
| + bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
|
| +
|
| + /**
|
| * This method affects the pixels in the base-layer, and operates in pixel coordinates,
|
| * ignoring the matrix and clip.
|
| *
|
|
|