Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: include/core/SkCanvas.h

Issue 390693002: Add SkBitmap::readPixels() and reimplement copyTo and SkCanvas::readPixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 424c12dbf36df4b89e9a14c63546b4d98fb0b65e..6bd3cc5363175234c8fcd9665f2390c95f84033c 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -234,30 +234,31 @@ public:
/**
* 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.
+ * starting at the specified (srcX,srcY) location in the coordinate system of the base-layer.
*
- * The specified ImageInfo and (x,y) offset specifies a source rectangle
+ * The specified ImageInfo and (srcX,srcY) offset specifies a source rectangle
*
- * srcR(x, y, info.width(), info.height());
+ * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.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).
+ * 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
+ * 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 srcR does not intersect the base-layer bounds.
* - 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);
+ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
+ int srcX, int srcY);
/**
* 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);
+ bool readPixels(SkBitmap* bitmap, int srcX, int srcY);
/**
* Helper for allocating pixels and then calling readPixels(info, ...). The bitmap is resized
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698