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

Unified Diff: src/utils/SkBitmapTransformer.cpp

Issue 14265010: Make SkSHA1 and SkM5 use common SkDigestHash result type (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: sync_to_r8826 Created 7 years, 8 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 | « src/utils/SkBitmapTransformer.h ('k') | src/utils/SkHashDigest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkBitmapTransformer.cpp
===================================================================
--- src/utils/SkBitmapTransformer.cpp (revision 8826)
+++ src/utils/SkBitmapTransformer.cpp (working copy)
@@ -85,3 +85,30 @@
fBitmap.unlockPixels();
return true;
}
+
+bool SkBitmapTransformer::copyRowToPixelBuffer(int row, void *dstBuffer,
+ size_t dstBufferSize) const {
+ if (!this->isValid(true)) {
+ return false;
+ }
+ if ((row < 0) || (row >= this->numRows())) {
+ // EPOGER: add unit test for this check
+ SkDEBUGF(("row %d must be within range [0,%d]\n", row, numRows()-1));
+ return false;
+ }
+ size_t bytesNeeded = this->bytesNeededPerRow();
+ if (dstBufferSize < bytesNeeded) {
+ SkDEBUGF(("dstBufferSize %d must be >= %d\n", dstBufferSize, bytesNeeded));
+ return false;
+ }
+
+ fBitmap.lockPixels();
+ int width = fBitmap.width();
+ size_t srcRowBytes = fBitmap.rowBytes();
+ const char *srcBytes = const_cast<const char *>(static_cast<char*>(fBitmap.getPixels()));
+ char *dstBytes = static_cast<char *>(dstBuffer);
+ srcBytes += srcRowBytes * row;
+ transform_scanline(srcBytes, width, dstBytes);
+ fBitmap.unlockPixels();
+ return true;
+}
« no previous file with comments | « src/utils/SkBitmapTransformer.h ('k') | src/utils/SkHashDigest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698