Chromium Code Reviews| Index: include/core/SkCanvas.h |
| diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
| index 5bdf84d58bdc72f4b97527995bac4adb188f4f59..afc5f6cb7f563d46feb50581dc01ed3c2898b11d 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_WRITEPIXELSCONFIG |
| + |
| class SkBounder; |
| class SkBaseDevice; |
| class SkDraw; |
| @@ -279,9 +281,34 @@ public: |
| * Note: If you are recording drawing commands on this canvas to |
| * SkPicture, writePixels() is ignored! |
|
bsalomon
2014/03/06 17:48:12
DEPRECATED?
reed1
2014/03/06 20:21:29
Done.
|
| */ |
| - void writePixels(const SkBitmap& bitmap, |
| - int x, int y, |
| - Config8888 config8888 = kNative_Premul_Config8888); |
| +#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG |
| + void writePixels(const SkBitmap& bitmap, int x, int y, Config8888 config8888); |
| +#endif |
| + |
| + /** |
| + * This method affects the pixels in the base-layer, and operates in pixel coordinates, |
| + * ignoring the matrix and clip. |
| + * |
| + * The specified ImageInfo and (x,y) offset specifies a rectangle: target. |
| + * |
| + * target.setXYWH(x, y, info.width(), info.height()); |
| + * |
| + * Target 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 info+pixels+rowBytes |
| + * and the "dst" by the canvas' backend. 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 src colortype/alphatype cannot be converted to the canvas' types |
| + * - If this canvas is not backed by pixels (e.g. picture or PDF) |
| + */ |
| + bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, int x, int y); |
| + |
| + /** |
| + * Helper for calling writePixels(info, ...) |
| + */ |
| + bool writePixels(const SkBitmap& bitmap, int x, int y); |
| /////////////////////////////////////////////////////////////////////////// |