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

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

Issue 14265010: Make SkSHA1 and SkM5 use common SkDigestHash result type (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: rename_set_to_copyFrom 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
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 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" 13 #include "SkBitmapTransformer.h"
14 14
15 // TODO(epoger): Soon, SkHashDigest will become a real class of its own, 15 // TODO(epoger): Soon, SkBitmapHasher will generate its results as an
16 // and callers won't be able to assume it converts to/from a uint64_t. 16 // SkHashDigest rather than SkUInt64HashDigest, and callers won't be
17 typedef uint64_t SkHashDigest; 17 // able to assume it converts to/from a uint64_t.
18 typedef uint64_t SkUInt64HashDigest;
18 19
19 /** 20 /**
20 * Static class that can generate an SkHashDigest from an SkBitmap. 21 * Static class that can generate an SkHashDigest from an SkBitmap.
21 */ 22 */
22 class SkBitmapHasher { 23 class SkBitmapHasher {
23 public: 24 public:
24 /** 25 /**
25 * Fills in "result" with a hash of the pixels in this bitmap. 26 * Fills in "result" with a hash of the pixels in this bitmap.
26 * 27 *
27 * If this is unable to compute the hash for some reason, 28 * If this is unable to compute the hash for some reason,
28 * it returns false. 29 * it returns false.
29 * 30 *
30 * Note: depending on the bitmap config, we may need to create an 31 * 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 32 * intermediate SkBitmap and copy the pixels over to it... so in some
32 * cases, performance and memory usage can suffer. 33 * cases, performance and memory usage can suffer.
33 */ 34 */
34 static bool ComputeDigest(const SkBitmap& bitmap, SkHashDigest *result); 35 static bool ComputeDigest(const SkBitmap& bitmap, SkUInt64HashDigest *result );
35 36
36 private: 37 private:
37 static bool ComputeDigestInternal(const SkBitmap& bitmap, 38 static bool ComputeDigestInternal(const SkBitmap& bitmap,
38 const SkBitmapTransformer& transformer, 39 const SkBitmapTransformer& transformer,
39 SkHashDigest *result); 40 SkUInt64HashDigest *result);
40 }; 41 };
41 42
42 #endif 43 #endif
OLDNEW
« no previous file with comments | « gm/gmmain.cpp ('k') | src/utils/SkBitmapHasher.cpp » ('j') | src/utils/SkHashDigest.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698