Compute correctly the bounding box of a transformed rectangle (fixes #17065)
This commit is contained in:
parent
4245d87de5
commit
1be9bbd2e1
@ -517,10 +517,13 @@ class CanvasExtraState {
|
||||
updateRectMinMax(transform, rect) {
|
||||
const p1 = Util.applyTransform(rect, transform);
|
||||
const p2 = Util.applyTransform(rect.slice(2), transform);
|
||||
this.minX = Math.min(this.minX, p1[0], p2[0]);
|
||||
this.minY = Math.min(this.minY, p1[1], p2[1]);
|
||||
this.maxX = Math.max(this.maxX, p1[0], p2[0]);
|
||||
this.maxY = Math.max(this.maxY, p1[1], p2[1]);
|
||||
const p3 = Util.applyTransform([rect[0], rect[3]], transform);
|
||||
const p4 = Util.applyTransform([rect[2], rect[1]], transform);
|
||||
|
||||
this.minX = Math.min(this.minX, p1[0], p2[0], p3[0], p4[0]);
|
||||
this.minY = Math.min(this.minY, p1[1], p2[1], p3[1], p4[1]);
|
||||
this.maxX = Math.max(this.maxX, p1[0], p2[0], p3[0], p4[0]);
|
||||
this.maxY = Math.max(this.maxY, p1[1], p2[1], p3[1], p4[1]);
|
||||
}
|
||||
|
||||
updateScalingPathMinMax(transform, minMax) {
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -613,3 +613,4 @@
|
||||
!empty_protected.pdf
|
||||
!tagged_stamp.pdf
|
||||
!bug1851498.pdf
|
||||
!issue17065.pdf
|
||||
|
BIN
test/pdfs/issue17065.pdf
Normal file
BIN
test/pdfs/issue17065.pdf
Normal file
Binary file not shown.
@ -8149,5 +8149,12 @@
|
||||
"rounds": 1,
|
||||
"type": "eq",
|
||||
"annotations": true
|
||||
},
|
||||
{
|
||||
"id": "issue17065",
|
||||
"file": "pdfs/issue17065.pdf",
|
||||
"md5": "16a70b9941ba049a61612109e0e1d719",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user