fix for lines (stroke) are rendered too thick (Bug 1743245)

This commit fixes Bug 1743245 (Grided PDF file lines rendered too thick) which was created by a fix for  #12868 .
The lineWidth was set to round(1 * this._combinedScaleFactor) when the pixel is drawn as a parallelorgam with a height <1. This fix changes this to floor(1*this._combinedScaleFactor) .

This change shows a visual result comparable to Chrome and Acrobat.
Regarding the last PR 3 statements in canvas.js are affected and will change with this commit (stroke and paintChar).

renaming the reference files to naming comvention
This commit is contained in:
quaoaris 2022-01-25 00:26:45 +01:00
parent ede26bfe4a
commit 3f77d80f31
4 changed files with 10 additions and 3 deletions

View File

@ -1770,7 +1770,7 @@ class CanvasGraphics {
// parallelogram where both heights are lower than 1 and not equal.
ctx.save();
ctx.resetTransform();
ctx.lineWidth = Math.round(this._combinedScaleFactor);
ctx.lineWidth = Math.floor(this._combinedScaleFactor);
ctx.stroke();
ctx.restore();
} else {
@ -2040,7 +2040,7 @@ class CanvasGraphics {
) {
if (resetLineWidthToOne) {
ctx.resetTransform();
ctx.lineWidth = Math.round(this._combinedScaleFactor);
ctx.lineWidth = Math.floor(this._combinedScaleFactor);
}
ctx.stroke();
}
@ -2060,7 +2060,7 @@ class CanvasGraphics {
ctx.save();
ctx.moveTo(x, y);
ctx.resetTransform();
ctx.lineWidth = Math.round(this._combinedScaleFactor);
ctx.lineWidth = Math.floor(this._combinedScaleFactor);
ctx.strokeText(character, 0, 0);
ctx.restore();
} else {

View File

@ -471,6 +471,7 @@
!issue11442_reduced.pdf
!issue11549_reduced.pdf
!issue8097_reduced.pdf
!bug1743245.pdf
!quadpoints.pdf
!transparent.pdf
!issue13931.pdf

BIN
test/pdfs/bug1743245.pdf Normal file

Binary file not shown.

View File

@ -4042,6 +4042,12 @@
"type": "eq",
"annotations": true
},
{ "id": "bug1743245",
"file": "pdfs/bug1743245.pdf",
"md5": "01eadf118ec05fe02e91db63536d50f6",
"rounds": 1,
"type": "eq"
},
{ "id": "issue1002",
"file": "pdfs/issue1002.pdf",
"md5": "af62d6cd95079322d4af18edd960d15c",