Skip to content

Commit

Permalink
Merge pull request #1758 from Tyriar/1757_cjk_glyph_key
Browse files Browse the repository at this point in the history
Move dynamic atlas canCache check higher
  • Loading branch information
Tyriar committed Oct 16, 2018
2 parents af0ca6c + 3edd2f2 commit 5bc7fc4
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 5bc7fc4

Please sign in to comment.