aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-02-16 18:38:14 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-16 18:38:15 -0800
commitf60a8908d2ee5cc2e699dc42c17a6e431c3a49ac (patch)
treee221dd1213f456cdfe2aeb4a38fbeabb65d0fbd5 /src/utils
parent2a42f48b58f11c32017e2da6c8468a3e2cd9bd8c (diff)
Delete dead code. SkBitmapHasher has not been used since gm.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/SkBitmapHasher.cpp64
-rw-r--r--src/utils/SkBitmapHasher.h35
2 files changed, 0 insertions, 99 deletions
diff --git a/src/utils/SkBitmapHasher.cpp b/src/utils/SkBitmapHasher.cpp
deleted file mode 100644
index 32ff1cb081..0000000000
--- a/src/utils/SkBitmapHasher.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkBitmap.h"
-#include "SkBitmapHasher.h"
-#include "SkEndian.h"
-#include "SkImageEncoder.h"
-
-#include "SkMD5.h"
-
-/**
- * Write an int32 value to a stream in little-endian order.
- */
-static void write_int32_to_buffer(uint32_t val, SkWStream* out) {
- val = SkEndian_SwapLE32(val);
- for (size_t byte = 0; byte < 4; ++byte) {
- out->write8((uint8_t)(val & 0xff));
- val = val >> 8;
- }
-}
-
-/**
- * Return the first 8 bytes of a bytearray, encoded as a little-endian uint64.
- */
-static inline uint64_t first_8_bytes_as_uint64(const uint8_t *bytearray) {
- return SkEndian_SwapLE64(*(reinterpret_cast<const uint64_t *>(bytearray)));
-}
-
-/*static*/ bool SkBitmapHasher::ComputeDigestInternal(const SkBitmap& bitmap, uint64_t *result) {
- SkMD5 out;
-
- // start with the x/y dimensions
- write_int32_to_buffer(SkToU32(bitmap.width()), &out);
- write_int32_to_buffer(SkToU32(bitmap.height()), &out);
-
- // add all the pixel data
- SkAutoTDelete<SkImageEncoder> enc(CreateARGBImageEncoder());
- if (!enc->encodeStream(&out, bitmap, SkImageEncoder::kDefaultQuality)) {
- return false;
- }
-
- SkMD5::Digest digest;
- out.finish(digest);
- *result = first_8_bytes_as_uint64(digest.data);
- return true;
-}
-
-/*static*/ bool SkBitmapHasher::ComputeDigest(const SkBitmap& bitmap, uint64_t *result) {
- if (ComputeDigestInternal(bitmap, result)) {
- return true;
- }
-
- // Hmm, that didn't work. Maybe if we create a new
- // version of the bitmap it will work better?
- SkBitmap copyBitmap;
- if (!bitmap.copyTo(&copyBitmap, kN32_SkColorType)) {
- return false;
- }
- return ComputeDigestInternal(copyBitmap, result);
-}
diff --git a/src/utils/SkBitmapHasher.h b/src/utils/SkBitmapHasher.h
deleted file mode 100644
index c8a5c0406f..0000000000
--- a/src/utils/SkBitmapHasher.h
+++ /dev/null
@@ -1,35 +0,0 @@
-
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkBitmapHasher_DEFINED
-#define SkBitmapHasher_DEFINED
-
-#include "SkBitmap.h"
-
-/**
- * Static class that generates a uint64 hash digest from an SkBitmap.
- */
-class SkBitmapHasher {
-public:
- /**
- * Fills in "result" with a hash of the pixels in this bitmap.
- *
- * If this is unable to compute the hash for some reason,
- * it returns false.
- *
- * Note: depending on the bitmap colortype, we may need to create an
- * intermediate SkBitmap and copy the pixels over to it... so in some
- * cases, performance and memory usage can suffer.
- */
- static bool ComputeDigest(const SkBitmap& bitmap, uint64_t *result);
-
-private:
- static bool ComputeDigestInternal(const SkBitmap& bitmap, uint64_t *result);
-};
-
-#endif