Index: src/core/SkPaint.cpp |
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
index 7ce7fc9ccd19df02b740bb96c38e934d63c7974d..a25ec1d333902ad6b194339c8f6cdfca4c10a0a0 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)); |
+} |