class SkCharToGlyphCache { public:
SkCharToGlyphCache();
~SkCharToGlyphCache();
// return number of unichars cached int count() const { return fK32.size();
}
void reset(); // forget all cache entries (to save memory)
/** * Given a unichar, return its glyphID (if the return value is positive), else return * ~index of where to insert the computed glyphID. * * int result = cache.charToGlyph(unichar); * if (result >= 0) { * glyphID = result; * } else { * glyphID = compute_glyph_using_typeface(unichar); * cache.insertCharAndGlyph(~result, unichar, glyphID); * }
*/ int findGlyphIndex(SkUnichar c) const;
/** * Insert a new char/glyph pair into the cache at the specified index. * See charToGlyph() for how to compute the bit-not of the index.
*/ void insertCharAndGlyph(int index, SkUnichar, SkGlyphID);
// helper to pre-seed an entry in the cache void addCharAndGlyph(SkUnichar unichar, SkGlyphID glyph) { int index = this->findGlyphIndex(unichar); if (index >= 0) {
SkASSERT(SkToU16(index) == glyph);
} else {
this->insertCharAndGlyph(~index, unichar, glyph);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.