Revert "Avoid all rendering breaking completely when CanvasPattern.setTransform() is unsupported" (PR 13725 follow-up)
PR 13725 was only intended as a temporary work-around, and it seems that we can now revert that. - Firefox 102 is the currently maintained ESR-branch, and the PDF.js project only supports the active one. - Node.js now works, thanks to the `node-canvas` package, and I've confirmed locally that following the STR in issue 13724 generates a correct image.
This commit is contained in:
parent
f5711fc385
commit
497edbd0ee
@ -19,7 +19,6 @@ import {
|
|||||||
shadow,
|
shadow,
|
||||||
unreachable,
|
unreachable,
|
||||||
Util,
|
Util,
|
||||||
warn,
|
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
import { getCurrentTransform } from "./display_utils.js";
|
import { getCurrentTransform } from "./display_utils.js";
|
||||||
import { isNodeJS } from "../shared/is_node.js";
|
import { isNodeJS } from "../shared/is_node.js";
|
||||||
@ -140,13 +139,7 @@ class RadialAxialShadingPattern extends BaseShadingPattern {
|
|||||||
|
|
||||||
pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
|
pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
|
||||||
const domMatrix = new DOMMatrix(inverse);
|
const domMatrix = new DOMMatrix(inverse);
|
||||||
try {
|
pattern.setTransform(domMatrix);
|
||||||
pattern.setTransform(domMatrix);
|
|
||||||
} catch (ex) {
|
|
||||||
// Avoid rendering breaking completely in Firefox 78 ESR,
|
|
||||||
// and in Node.js (see issue 13724).
|
|
||||||
warn(`RadialAxialShadingPattern.getPattern: "${ex?.message}".`);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Shading fills are applied relative to the current matrix which is also
|
// Shading fills are applied relative to the current matrix which is also
|
||||||
// how canvas gradients work, so there's no need to do anything special
|
// how canvas gradients work, so there's no need to do anything special
|
||||||
@ -680,13 +673,8 @@ class TilingPattern {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat");
|
const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat");
|
||||||
try {
|
pattern.setTransform(domMatrix);
|
||||||
pattern.setTransform(domMatrix);
|
|
||||||
} catch (ex) {
|
|
||||||
// Avoid rendering breaking completely in Firefox 78 ESR,
|
|
||||||
// and in Node.js (see issue 13724).
|
|
||||||
warn(`TilingPattern.getPattern: "${ex?.message}".`);
|
|
||||||
}
|
|
||||||
return pattern;
|
return pattern;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user