mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Fix several issues with radial/axial shadings and tiling patterns.
Previously, we set the base transformation and pattern matrix directly to the main rendering ctx of the page, however doing this caused the current transform to be lost. This would cause issues with things like shear missing so the pattern was misaligned or when stroke was used the scale of the line width or dash would be wrong. Instead we should leave the current transform and use setTransfrom on the pattern so it is applied correctly. For axial and radial shadings I had to create a temporary canvas to draw the shading so I could in turn use setTransform. Fixes: #13325, #6769, #7847, #11018, #11597, #11473 The following already in the corpus are improved: issue8078-page1 issue1877-page1
This commit is contained in:
parent
3f187c2c6d
commit
ac44afa70e
10 changed files with 492 additions and 50 deletions
|
@ -245,18 +245,17 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
|
|||
unreachable(`getPattern type unknown: ${shadingType}`);
|
||||
}
|
||||
|
||||
const matrix = this.matrix;
|
||||
if (matrix) {
|
||||
p0 = Util.applyTransform(p0, matrix);
|
||||
p1 = Util.applyTransform(p1, matrix);
|
||||
if (shadingType === ShadingType.RADIAL) {
|
||||
const scale = Util.singularValueDecompose2dScale(matrix);
|
||||
r0 *= scale[0];
|
||||
r1 *= scale[1];
|
||||
}
|
||||
}
|
||||
|
||||
return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
|
||||
return [
|
||||
"RadialAxial",
|
||||
type,
|
||||
this.bbox,
|
||||
this.colorStops,
|
||||
p0,
|
||||
p1,
|
||||
r0,
|
||||
r1,
|
||||
this.matrix,
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue