Skip to content

Commit

Permalink
Move dynamic atlas canCache check higher
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Oct 15, 2018
1 parent 75071ad commit 86f9b66
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/renderer/atlas/DynamicCharAtlas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 86f9b66

Please sign in to comment.