Don't unlink node when updating inBitmap and verify undefined
This commit is contained in:
@@ -335,7 +335,11 @@ export default class DynamicCharAtlas extends BaseCharAtlas {
|
||||
// Mark all new glyphs as in bitmap
|
||||
for (let i = 0; i < countAtGeneration; i++) {
|
||||
const key = this._glyphsWaitingOnBitmapQueue[i];
|
||||
this._cacheMap.get(key).inBitmap = true;
|
||||
const value = this._cacheMap.peekValue(key);
|
||||
// If the value has already been evicted, do nothing
|
||||
if (value) {
|
||||
value.inBitmap = true;
|
||||
}
|
||||
this._glyphsWaitingOnBitmapQueue[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,17 @@ export default class LRUMap<T> {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value from a key without marking it as the most recently used item.
|
||||
*/
|
||||
public peekValue(key: number): T | null {
|
||||
const node = this._map[key];
|
||||
if (node !== undefined) {
|
||||
return node.value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public peek(): T | null {
|
||||
const head = this._head;
|
||||
return head === null ? null : head.value;
|
||||
|
||||
Reference in New Issue
Block a user