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

Side by Side Diff: src/utils/SkBitmapHasher.h

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/utils/SkBitmapChecksummer.cpp ('k') | src/utils/SkBitmapHasher.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SkBitmapChecksummer_DEFINED 9 #ifndef SkBitmapHasher_DEFINED
10 #define SkBitmapChecksummer_DEFINED 10 #define SkBitmapHasher_DEFINED
11 11
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkBitmapTransformer.h" 13 #include "SkBitmapTransformer.h"
14 14
15 // 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.
17 typedef uint64_t SkHashDigest;
18
15 /** 19 /**
16 * Static class that can generate checksums from SkBitmaps. 20 * Static class that can generate an SkHashDigest from an SkBitmap.
17 */ 21 */
18 class SkBitmapChecksummer { 22 class SkBitmapHasher {
19 public: 23 public:
20 /** 24 /**
21 * Returns a 64-bit checksum of the pixels in this bitmap. 25 * Fills in "result" with a hash of the pixels in this bitmap.
22 * 26 *
23 * If this is unable to compute the checksum for some reason, 27 * If this is unable to compute the hash for some reason,
24 * it returns 0. 28 * it returns false.
25 * 29 *
26 * Note: depending on the bitmap config, we may need to create an 30 * Note: depending on the bitmap config, we may need to create an
27 * intermediate SkBitmap and copy the pixels over to it... so in some 31 * intermediate SkBitmap and copy the pixels over to it... so in some
28 * cases, performance and memory usage can suffer. 32 * cases, performance and memory usage can suffer.
29 */ 33 */
30 static uint64_t Compute64(const SkBitmap& bitmap); 34 static bool ComputeDigest(const SkBitmap& bitmap, SkHashDigest *result);
31 35
32 private: 36 private:
33 static uint64_t Compute64Internal(const SkBitmap& bitmap, 37 static bool ComputeDigestInternal(const SkBitmap& bitmap,
34 const SkBitmapTransformer& transformer); 38 const SkBitmapTransformer& transformer,
39 SkHashDigest *result);
35 }; 40 };
36 41
37 #endif 42 #endif
OLDNEW
« no previous file with comments | « src/utils/SkBitmapChecksummer.cpp ('k') | src/utils/SkBitmapHasher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698