Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: src/core/SkPaint.cpp

Issue 637583002: Add SkPaint::getHash(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: better Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPaint.h ('k') | tests/PaintTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
+}
« no previous file with comments | « include/core/SkPaint.h ('k') | tests/PaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698