Use Map.prototype.getOrInsertComputed() in the src/display/canvas.js file

This commit is contained in:
Jonas Jenwald 2026-02-22 17:55:51 +01:00
parent ab8e67ecff
commit c81904ac0a

View File

@ -989,11 +989,10 @@ class CanvasGraphics {
: [currentTransform.slice(0, 4), fillColor]
);
cache = this._cachedBitmapsMap.get(mainKey);
if (!cache) {
cache = new Map();
this._cachedBitmapsMap.set(mainKey, cache);
}
cache = this._cachedBitmapsMap.getOrInsertComputed(
mainKey,
() => new Map()
);
const cachedImage = cache.get(cacheKey);
if (cachedImage && !isPatternFill) {
const offsetX = Math.round(