Move dynamic atlas canCache check higher

Fixes #1757
This commit is contained in:
Daniel Imms
2018-10-15 11:35:21 -07:00
parent 37972aa5dd
commit a53aaa5f25
+6 -1
View File
@@ -129,12 +129,17 @@ export default class DynamicCharAtlas extends BaseCharAtlas {
return true;
}
// Exit early for uncachable glyphs
if (!this._canCache(glyph)) {
return false;
}
const glyphKey = getGlyphCacheKey(glyph);
const cacheValue = this._cacheMap.get(glyphKey);
if (cacheValue !== null && cacheValue !== undefined) {
this._drawFromCache(ctx, cacheValue, x, y);
return true;
} else if (this._canCache(glyph) && this._drawToCacheCount < FRAME_CACHE_DRAW_LIMIT) {
} else if (this._drawToCacheCount < FRAME_CACHE_DRAW_LIMIT) {
let index;
if (this._cacheMap.size < this._cacheMap.capacity) {
index = this._cacheMap.size;