Skip to content

Commit

Permalink
Adjust the heuristics used when dealing with rectangles, i.e. re op…
Browse files Browse the repository at this point in the history
…erators, with zero width/height (issue 12010)
  • Loading branch information
Snuffleupagus committed Jun 30, 2020
1 parent e451cab commit 23f9e28
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,20 +1185,20 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
y = args[j++];
var width = args[j++];
var height = args[j++];
if (width === 0) {
if (width === 0 && ctx.lineWidth < this.getSinglePixelWidth()) {
width = this.getSinglePixelWidth();
}
if (height === 0) {
if (height === 0 && ctx.lineWidth < this.getSinglePixelWidth()) {
height = this.getSinglePixelWidth();
}
var xw = x + width;
var yh = y + height;
this.ctx.moveTo(x, y);
this.ctx.lineTo(xw, y);
this.ctx.lineTo(xw, yh);
this.ctx.lineTo(x, yh);
this.ctx.lineTo(x, y);
this.ctx.closePath();
ctx.moveTo(x, y);
ctx.lineTo(xw, y);
ctx.lineTo(xw, yh);
ctx.lineTo(x, yh);
ctx.lineTo(x, y);
ctx.closePath();
break;
case OPS.moveTo:
x = args[j++];
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
!bug903856.pdf
!bug850854.pdf
!bug866395.pdf
!issue12010_reduced.pdf
!issue11718_reduced.pdf
!bug1027533.pdf
!bug1028735.pdf
Expand Down
Binary file added test/pdfs/issue12010_reduced.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2720,6 +2720,12 @@
"link": false,
"type": "eq"
},
{ "id": "issue12010",
"file": "pdfs/issue12010_reduced.pdf",
"md5": "8894ec63069dcf92c9f56baec05c0425",
"rounds": 1,
"type": "eq"
},
{ "id": "issue7598",
"file": "pdfs/issue7598.pdf",
"md5": "c5bc5a779bfcb4b234f853231b56cf60",
Expand Down

0 comments on commit 23f9e28

Please sign in to comment.