mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-06 15:15:47 +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);
|
this.#elements.push(element);
|
||||||
|
|
||||||
if (data.popupRef) {
|
if (data.popupRef) {
|
||||||
const elements = popupToElements.get(data.popupRef);
|
popupToElements.getOrInsert(data.popupRef, []).push(element);
|
||||||
if (!elements) {
|
|
||||||
popupToElements.set(data.popupRef, [element]);
|
|
||||||
} else {
|
|
||||||
elements.push(element);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user