aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-10-07 09:26:10 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-07 09:26:10 -0700
commitfb1fe4f51820731f557e765f8c71cba9a0d28048 (patch)
treee9fda5dffc33f26459b45c803f4ebd836bad5d1f /src
parentd909759832d5a6bb476597098e05bbe7ba0ccbd2 (diff)
Add SkPaint::getHash().
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPaint.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 7ce7fc9ccd..a25ec1d333 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -8,6 +8,7 @@
#include "SkPaint.h"
#include "SkAnnotation.h"
#include "SkAutoKern.h"
+#include "SkChecksum.h"
#include "SkColorFilter.h"
#include "SkData.h"
#include "SkDeviceProperties.h"
@@ -2460,3 +2461,11 @@ bool SkPaint::nothingToDraw() const {
return false;
}
+uint32_t SkPaint::getHash() const {
+ // We're going to hash 10 pointers and 7 32-bit values, finishing up with fBitfields,
+ // so fBitfields should be 10 pointers and 6 32-bit values from the start.
+ SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t),
+ SkPaint_notPackedTightly);
+ return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
+ offsetof(SkPaint, fBitfields) + sizeof(fBitfields));
+}