michael@0: michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkBitmapHasher_DEFINED michael@0: #define SkBitmapHasher_DEFINED michael@0: michael@0: #include "SkBitmap.h" michael@0: michael@0: /** michael@0: * Static class that generates a uint64 hash digest from an SkBitmap. michael@0: */ michael@0: class SkBitmapHasher { michael@0: public: michael@0: /** michael@0: * Fills in "result" with a hash of the pixels in this bitmap. michael@0: * michael@0: * If this is unable to compute the hash for some reason, michael@0: * it returns false. michael@0: * michael@0: * Note: depending on the bitmap config, we may need to create an michael@0: * intermediate SkBitmap and copy the pixels over to it... so in some michael@0: * cases, performance and memory usage can suffer. michael@0: */ michael@0: static bool ComputeDigest(const SkBitmap& bitmap, uint64_t *result); michael@0: michael@0: private: michael@0: static bool ComputeDigestInternal(const SkBitmap& bitmap, uint64_t *result); michael@0: }; michael@0: michael@0: #endif