Chromium Code Reviews| Index: src/utils/SkBitmapHasher.h |
| =================================================================== |
| --- src/utils/SkBitmapHasher.h (revision 8614) |
| +++ src/utils/SkBitmapHasher.h (working copy) |
| @@ -6,32 +6,37 @@ |
| * found in the LICENSE file. |
| */ |
| -#ifndef SkBitmapChecksummer_DEFINED |
| -#define SkBitmapChecksummer_DEFINED |
| +#ifndef SkBitmapHasher_DEFINED |
| +#define SkBitmapHasher_DEFINED |
| #include "SkBitmap.h" |
| #include "SkBitmapTransformer.h" |
| +// TODO(epoger): Soon, SkHashDigest will become a real class of its own, |
| +// and callers won't be able to assume it converts to/from a uint64_t. |
| +typedef uint64_t SkHashDigest; |
| + |
| /** |
| - * Static class that can generate checksums from SkBitmaps. |
| + * Static class that can generate an SkHashDigest from an SkBitmap. |
| */ |
| -class SkBitmapChecksummer { |
| +class SkBitmapHasher { |
| public: |
| /** |
| - * Returns a 64-bit checksum of the pixels in this bitmap. |
| + * Fills in "result" with a hash of the pixels in this bitmap. |
| * |
| - * If this is unable to compute the checksum for some reason, |
| - * it returns 0. |
| + * If this is unable to compute the hash for some reason, |
| + * it returns false. |
| * |
| * Note: depending on the bitmap config, we may need to create an |
| * intermediate SkBitmap and copy the pixels over to it... so in some |
| * cases, performance and memory usage can suffer. |
| */ |
| - static uint64_t Compute64(const SkBitmap& bitmap); |
| + static bool Compute64(const SkBitmap& bitmap, SkHashDigest *result); |
|
bungeman-skia
2013/04/11 20:49:37
Any reason not to change the name of this right no
epoger
2013/04/12 02:20:48
Good idea, thanks. Done in patchset 3.
|
| private: |
| - static uint64_t Compute64Internal(const SkBitmap& bitmap, |
| - const SkBitmapTransformer& transformer); |
| + static bool Compute64Internal(const SkBitmap& bitmap, |
| + const SkBitmapTransformer& transformer, |
| + SkHashDigest *result); |
| }; |
| #endif |