From 353196f44f8c4f5fc3dc3783241faef264b80927 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Fri, 21 Jul 2017 11:01:18 -0400 Subject: clean read/write pixels signatures, augment SkSurface API For now, not adding writePixels to surface, since it appears we may not be able to remove writePixels from canvas :( Bug: skia:3216 Change-Id: I64ccebb31effacffe615ae4537fb46a161a6768d Reviewed-on: https://skia-review.googlesource.com/25562 Reviewed-by: Brian Salomon Commit-Queue: Mike Reed --- include/core/SkSurface.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/core') diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index b13702e83e..4a8d81205f 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -284,13 +284,13 @@ public: bool peekPixels(SkPixmap*); /** - * Copy the pixels from the surface into the specified buffer (pixels + rowBytes), - * converting them into the requested format (dstInfo). The surface pixels are read + * Copy the pixels from the surface into the specified pixmap, + * converting them into the pixmap's format. The surface pixels are read * starting at the specified (srcX,srcY) location. * - * The specified ImageInfo and (srcX,srcY) offset specifies a source rectangle + * The pixmap and (srcX,srcY) offset specifies a source rectangle * - * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height()); + * srcR.setXYWH(srcX, srcY, pixmap.width(), pixmap.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). Replace the dst pixels with the @@ -301,8 +301,10 @@ public: * - If srcR does not intersect the surface bounds. * - If the requested colortype/alphatype cannot be converted from the surface's types. */ + bool readPixels(const SkPixmap& dst, int srcX, int srcY); bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY); + bool readPixels(const SkBitmap& dst, int srcX, int srcY); const SkSurfaceProps& props() const { return fProps; } -- cgit v1.2.3