mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Merge pull request #20716 from Snuffleupagus/src-display-getOrInsert
Use `Map.prototype.getOrInsert()` more in the `src/display/` folder
This commit is contained in:
commit
7b451f6a89
@ -3877,12 +3877,7 @@ class AnnotationLayer {
|
||||
this.#elements.push(element);
|
||||
|
||||
if (data.popupRef) {
|
||||
const elements = popupToElements.get(data.popupRef);
|
||||
if (!elements) {
|
||||
popupToElements.set(data.popupRef, [element]);
|
||||
} else {
|
||||
elements.push(element);
|
||||
}
|
||||
popupToElements.getOrInsert(data.popupRef, []).push(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user