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] : [currentTransform.slice(0, 4), fillColor]
); );
cache = this._cachedBitmapsMap.get(mainKey); cache = this._cachedBitmapsMap.getOrInsertComputed(
if (!cache) { mainKey,
cache = new Map(); () => new Map()
this._cachedBitmapsMap.set(mainKey, cache); );
}
const cachedImage = cache.get(cacheKey); const cachedImage = cache.get(cacheKey);
if (cachedImage && !isPatternFill) { if (cachedImage && !isPatternFill) {
const offsetX = Math.round( const offsetX = Math.round(