gfx/skia/trunk/src/utils/SkBitmapHasher.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/utils/SkBitmapHasher.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2012 Google Inc.
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +#ifndef SkBitmapHasher_DEFINED
    1.13 +#define SkBitmapHasher_DEFINED
    1.14 +
    1.15 +#include "SkBitmap.h"
    1.16 +
    1.17 +/**
    1.18 + * Static class that generates a uint64 hash digest from an SkBitmap.
    1.19 + */
    1.20 +class SkBitmapHasher {
    1.21 +public:
    1.22 +    /**
    1.23 +     * Fills in "result" with a hash of the pixels in this bitmap.
    1.24 +     *
    1.25 +     * If this is unable to compute the hash for some reason,
    1.26 +     * it returns false.
    1.27 +     *
    1.28 +     * Note: depending on the bitmap config, we may need to create an
    1.29 +     * intermediate SkBitmap and copy the pixels over to it... so in some
    1.30 +     * cases, performance and memory usage can suffer.
    1.31 +     */
    1.32 +    static bool ComputeDigest(const SkBitmap& bitmap, uint64_t *result);
    1.33 +
    1.34 +private:
    1.35 +    static bool ComputeDigestInternal(const SkBitmap& bitmap, uint64_t *result);
    1.36 +};
    1.37 +
    1.38 +#endif

mercurial