aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGlyph.h
diff options
context:
space:
mode:
authorGravatar herb <herb@google.com>2015-07-21 15:36:25 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-21 15:36:25 -0700
commitc71239b9ff7d8c19dc03cb6c9081e7dc4e0947d2 (patch)
tree87ba38517e448556b6fab94809c3bcace6f56b41 /src/core/SkGlyph.h
parent10b371c6e376f1f3eba88ac4bfdf34652f3ab1dc (diff)
Change the GlyphCache to use a hash table instead of doing its own ad-hoc
hashing. This change appears to be performance neutral. BUG=skia: Review URL: https://codereview.chromium.org/1216983003
Diffstat (limited to 'src/core/SkGlyph.h')
-rw-r--r--src/core/SkGlyph.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h
index abca215d00..469985959c 100644
--- a/src/core/SkGlyph.h
+++ b/src/core/SkGlyph.h
@@ -8,6 +8,7 @@
#ifndef SkGlyph_DEFINED
#define SkGlyph_DEFINED
+#include "SkChecksum.h"
#include "SkTypes.h"
#include "SkFixed.h"
#include "SkMask.h"
@@ -114,6 +115,16 @@ class SkGlyph {
void toMask(SkMask* mask) const;
+ class HashTraits {
+ public:
+ static uint32_t GetKey(const SkGlyph& glyph) {
+ return glyph.fID;
+ }
+ static uint32_t Hash(uint32_t glyphId) {
+ return SkChecksum::CheapMix(glyphId);
+ }
+ };
+
private:
// TODO(herb) remove friend statement after SkGlyphCache cleanup.
friend class SkGlyphCache;