| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef SkBitmapHasher_DEFINED | 9 #ifndef SkBitmapHasher_DEFINED |
| 10 #define SkBitmapHasher_DEFINED | 10 #define SkBitmapHasher_DEFINED |
| 11 | 11 |
| 12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
| 13 #include "SkBitmapTransformer.h" | |
| 14 | 13 |
| 15 // TODO(epoger): Soon, SkHashDigest will become a real class of its own, | 14 // TODO(epoger): Soon, SkHashDigest will become a real class of its own, |
| 16 // and callers won't be able to assume it converts to/from a uint64_t. | 15 // and callers won't be able to assume it converts to/from a uint64_t. |
| 17 typedef uint64_t SkHashDigest; | 16 typedef uint64_t SkHashDigest; |
| 18 | 17 |
| 19 /** | 18 /** |
| 20 * Static class that can generate an SkHashDigest from an SkBitmap. | 19 * Static class that can generate an SkHashDigest from an SkBitmap. |
| 21 */ | 20 */ |
| 22 class SkBitmapHasher { | 21 class SkBitmapHasher { |
| 23 public: | 22 public: |
| 24 /** | 23 /** |
| 25 * Fills in "result" with a hash of the pixels in this bitmap. | 24 * Fills in "result" with a hash of the pixels in this bitmap. |
| 26 * | 25 * |
| 27 * If this is unable to compute the hash for some reason, | 26 * If this is unable to compute the hash for some reason, |
| 28 * it returns false. | 27 * it returns false. |
| 29 * | 28 * |
| 30 * Note: depending on the bitmap config, we may need to create an | 29 * Note: depending on the bitmap config, we may need to create an |
| 31 * intermediate SkBitmap and copy the pixels over to it... so in some | 30 * intermediate SkBitmap and copy the pixels over to it... so in some |
| 32 * cases, performance and memory usage can suffer. | 31 * cases, performance and memory usage can suffer. |
| 33 */ | 32 */ |
| 34 static bool ComputeDigest(const SkBitmap& bitmap, SkHashDigest *result); | 33 static bool ComputeDigest(const SkBitmap& bitmap, SkHashDigest *result); |
| 35 | 34 |
| 36 private: | 35 private: |
| 37 static bool ComputeDigestInternal(const SkBitmap& bitmap, | 36 static bool ComputeDigestInternal(const SkBitmap& bitmap, SkHashDigest *resu
lt); |
| 38 const SkBitmapTransformer& transformer, | |
| 39 SkHashDigest *result); | |
| 40 }; | 37 }; |
| 41 | 38 |
| 42 #endif | 39 #endif |
| OLD | NEW |