mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-25 16:37:22 +02:00
Use getOrInsertComputed in the CanvasGraphics.prototype._getPattern method
This commit is contained in:
parent
dd7e3731d1
commit
0f060e1e64
@ -3092,13 +3092,9 @@ class CanvasGraphics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getPattern(opIdx, objId, matrix = null) {
|
_getPattern(opIdx, objId, matrix = null) {
|
||||||
let pattern;
|
const pattern = this.cachedPatterns.getOrInsertComputed(objId, () =>
|
||||||
if (this.cachedPatterns.has(objId)) {
|
getShadingPattern(this.getObject(opIdx, objId))
|
||||||
pattern = this.cachedPatterns.get(objId);
|
);
|
||||||
} else {
|
|
||||||
pattern = getShadingPattern(this.getObject(opIdx, objId));
|
|
||||||
this.cachedPatterns.set(objId, pattern);
|
|
||||||
}
|
|
||||||
if (matrix) {
|
if (matrix) {
|
||||||
pattern.matrix = matrix;
|
pattern.matrix = matrix;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user