Index: src/utils/SkBitmapTransformer.h |
=================================================================== |
--- src/utils/SkBitmapTransformer.h (revision 8826) |
+++ src/utils/SkBitmapTransformer.h (working copy) |
@@ -62,6 +62,13 @@ |
bool isValid(bool logReason=false) const; |
/** |
+ * Returns the number of rows in the bitmap. |
+ */ |
+ int numRows() const { |
+ return fBitmap.height(); |
+ } |
+ |
+ /** |
* Returns the number of bytes needed to store a single row of the |
* bitmap's pixels if converted to pixelFormat. |
*/ |
@@ -96,6 +103,22 @@ |
*/ |
bool copyBitmapToPixelBuffer (void *dstBuffer, size_t dstBufferSize) const; |
+ /** |
+ * Writes a single row of the bitmap into dstBuffer, using the |
+ * already-specified pixelFormat. Returns true if successful. |
+ * |
+ * row is the 0-indexed row number within the bitmap; if the row |
+ * specified is outside of the range [0, numRows()-1], then this method |
+ * will fail. |
+ * |
+ * dstBufferSize is the maximum allowable bytes to write into dstBuffer; |
+ * if that is not large enough to hold the row, then this |
+ * will fail immediately and return false. |
+ * We force the caller to pass this in to avoid buffer overruns in |
+ * unanticipated cases. |
+ */ |
+ bool copyRowToPixelBuffer (int row, void *dstBuffer, size_t dstBufferSize) const; |
+ |
private: |
const SkBitmap& fBitmap; |
const PixelFormat fPixelFormat; |