Index: src/core/SkGlyphCache.h |
diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h |
index b335d29d2d8a8acf2005213bd11bf7f27a82a4ca..9725bf4da08eadfa31492aa88a4353cbf9888e32 100644 |
--- a/src/core/SkGlyphCache.h |
+++ b/src/core/SkGlyphCache.h |
@@ -187,32 +187,38 @@ private: |
kFull_MetricsType |
}; |
- SkGlyph* lookupMetrics(uint32_t id, MetricsType); |
+ // Gets the glyph index given the sub-pixel postion glyph ID, and maintains the glyph cache. |
+ SkGlyph* maintainGlyphCache(uint32_t id, MetricsType type); |
+ SkGlyph* maintainCharCache(SkUnichar id, MetricsType type, SkFixed x = 0, SkFixed y = 0); |
+ uint16_t lookupMetrics(uint32_t id, MetricsType); |
static bool DetachProc(const SkGlyphCache*, void*) { return true; } |
- SkGlyphCache* fNext, *fPrev; |
- SkDescriptor* fDesc; |
- SkScalerContext* fScalerContext; |
+ SkGlyphCache* fNext, *fPrev; |
+ SkDescriptor* fDesc; |
+ SkScalerContext* fScalerContext; |
SkPaint::FontMetrics fFontMetrics; |
enum { |
kHashBits = 8, |
kHashCount = 1 << kHashBits, |
- kHashMask = kHashCount - 1 |
+ kHashMask = kHashCount - 1, |
+ kInvalidGlyph = 0xFFFF |
}; |
- SkGlyph* fGlyphHash[kHashCount]; |
- SkTDArray<SkGlyph*> fGlyphArray; |
- SkChunkAlloc fGlyphAlloc; |
+ |
+ // A quick lookup to avoid the binary search looking for glyphs in fGlyphArray. |
+ uint16_t fGlyphHash[kHashCount]; |
+ SkTDArray<SkGlyph> fGlyphArray; |
+ SkChunkAlloc fGlyphAlloc; |
struct CharGlyphRec { |
uint32_t fID; // unichar + subpixel |
- SkGlyph* fGlyph; |
+ uint16_t fGlyphIndex; |
}; |
// no reason to use the same kHashCount as fGlyphHash, but we do for now |
// Dynamically allocated when chars are encountered. |
SkAutoTArray<CharGlyphRec> fCharToGlyphHash; |
- |
CharGlyphRec* getCharGlyphRec(uint32_t id); |
+ void adjustCaches(int16_t insertion_index); |
static inline unsigned ID2HashIndex(uint32_t h) { |
return SkChecksum::CheapMix(h) & kHashMask; |