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

Unified Diff: src/utils/SkBitmapHasher.cpp

Issue 14170010: rename SkBitmapChecksummer as SkBitmapHasher, and prepare for it to possibly use (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: sync_to_r8638 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/SkBitmapHasher.h ('k') | tests/BitmapHasherTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkBitmapHasher.cpp
===================================================================
--- src/utils/SkBitmapHasher.cpp (revision 8614)
+++ src/utils/SkBitmapHasher.cpp (working copy)
@@ -7,7 +7,7 @@
*/
#include "SkBitmap.h"
-#include "SkBitmapChecksummer.h"
+#include "SkBitmapHasher.h"
#include "SkBitmapTransformer.h"
#include "SkCityHash.h"
#include "SkEndian.h"
@@ -23,8 +23,8 @@
}
}
-/*static*/ uint64_t SkBitmapChecksummer::Compute64Internal(
- const SkBitmap& bitmap, const SkBitmapTransformer& transformer) {
+/*static*/ bool SkBitmapHasher::ComputeDigestInternal(
+ const SkBitmap& bitmap, const SkBitmapTransformer& transformer, SkHashDigest *result) {
size_t pixelBufferSize = transformer.bytesNeededTotal();
size_t totalBufferSize = pixelBufferSize + 8; // leave room for x/y dimensions
@@ -39,12 +39,13 @@
// add all the pixel data
if (!transformer.copyBitmapToPixelBuffer(bufPtr, pixelBufferSize)) {
- return 0;
+ return false;
}
- return SkCityHash::Compute64(bufferStart, totalBufferSize);
+ *result = SkCityHash::Compute64(bufferStart, totalBufferSize);
+ return true;
}
-/*static*/ uint64_t SkBitmapChecksummer::Compute64(const SkBitmap& bitmap) {
+/*static*/ bool SkBitmapHasher::ComputeDigest(const SkBitmap& bitmap, SkHashDigest *result) {
const SkBitmapTransformer::PixelFormat kPixelFormat =
SkBitmapTransformer::kARGB_8888_Premul_PixelFormat;
@@ -52,7 +53,7 @@
const SkBitmapTransformer transformer =
SkBitmapTransformer(bitmap, kPixelFormat);
if (transformer.isValid(false)) {
- return Compute64Internal(bitmap, transformer);
+ return ComputeDigestInternal(bitmap, transformer, result);
}
// Hmm, that didn't work. Maybe if we create a new
@@ -62,8 +63,8 @@
const SkBitmapTransformer copyTransformer =
SkBitmapTransformer(copyBitmap, kPixelFormat);
if (copyTransformer.isValid(true)) {
- return Compute64Internal(copyBitmap, copyTransformer);
+ return ComputeDigestInternal(copyBitmap, copyTransformer, result);
} else {
- return 0;
+ return false;
}
}
« no previous file with comments | « src/utils/SkBitmapHasher.h ('k') | tests/BitmapHasherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698