Skip to content

Commit c81904a

Browse files
committed
Use Map.prototype.getOrInsertComputed() in the src/display/canvas.js file
1 parent ab8e67e commit c81904a

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/display/canvas.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -989,11 +989,10 @@ class CanvasGraphics {
989989
: [currentTransform.slice(0, 4), fillColor]
990990
);
991991

992-
cache = this._cachedBitmapsMap.get(mainKey);
993-
if (!cache) {
994-
cache = new Map();
995-
this._cachedBitmapsMap.set(mainKey, cache);
996-
}
992+
cache = this._cachedBitmapsMap.getOrInsertComputed(
993+
mainKey,
994+
() => new Map()
995+
);
997996
const cachedImage = cache.get(cacheKey);
998997
if (cachedImage && !isPatternFill) {
999998
const offsetX = Math.round(

0 commit comments

Comments
 (0)