Normalize the coordinates used in SVGGraphics._makeTilingPattern (issue 12996)

While this prevents the error which is currently thrown by the `assert` in the `DOMSVGFactory.create` method, the pattern still doesn't actually render (visibly). However, in the interest of getting rid of some open issues, this patch should make (some) sense and there's already other issues about patterns in the SVG-backend,

Given that, as clearly [outlined in the FAQ](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#backends), the SVG-backend is *not* officially supported and that there's currently no development of it; this is probably the most that is reasonable to do here.
This commit is contained in:
Jonas Jenwald 2021-06-05 09:02:38 +02:00
parent 1dd01b8506
commit 04ab4bd406

View File

@ -1113,8 +1113,10 @@ if (
const paintType = args[7];
const tilingId = `shading${shadingCount++}`;
const [tx0, ty0] = Util.applyTransform([x0, y0], matrix);
const [tx1, ty1] = Util.applyTransform([x1, y1], matrix);
const [tx0, ty0, tx1, ty1] = Util.normalizeRect([
...Util.applyTransform([x0, y0], matrix),
...Util.applyTransform([x1, y1], matrix),
]);
const [xscale, yscale] = Util.singularValueDecompose2dScale(matrix);
const txstep = xstep * xscale;
const tystep = ystep * yscale;