Skip to content

Commit

Permalink
Merge pull request #12044 from Snuffleupagus/issue-12010
Browse files Browse the repository at this point in the history
Adjust the heuristics used when dealing with rectangles, i.e. `re` operators, with zero width/height (issue 12010)
  • Loading branch information
timvandermeij authored Jul 1, 2020
2 parents 75fed02 + fef2465 commit ec635b8
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 @@ -2727,6 +2727,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 ec635b8

Please sign in to comment.