Home | History | Annotate | Download | only in utils
      1 
      2 /*
      3  * Copyright 2012 Google Inc.
      4  *
      5  * Use of this source code is governed by a BSD-style license that can be
      6  * found in the LICENSE file.
      7  */
      8 
      9 #ifndef SkBitmapChecksummer_DEFINED
     10 #define SkBitmapChecksummer_DEFINED
     11 
     12 #include "SkBitmap.h"
     13 #include "SkBitmapTransformer.h"
     14 
     15 /**
     16  * Static class that can generate checksums from SkBitmaps.
     17  */
     18 class SkBitmapChecksummer {
     19 public:
     20     /**
     21      * Returns a 64-bit checksum of the pixels in this bitmap.
     22      *
     23      * If this is unable to compute the checksum for some reason,
     24      * it returns 0.
     25      *
     26      * 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
     28      * cases, performance and memory usage can suffer.
     29      */
     30     static uint64_t Compute64(const SkBitmap& bitmap);
     31 
     32 private:
     33     static uint64_t Compute64Internal(const SkBitmap& bitmap,
     34                                       const SkBitmapTransformer& transformer);
     35 };
     36 
     37 #endif
     38