-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Use integer coordinates when drawing images (bug 1264608, issue #3351) #14853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the sort of thing that we have to do regardless, but does it affect performance in any noticeable way?
src/display/canvas.js
Outdated
// bottom-right one is at (X + width, Y + height). | ||
|
||
// If leftX is 4.321 then it's rounded to 4. | ||
// If width is 10.432 then it's rounded to 11! because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you meant to use 11!
, since that's actually 39916800
:-)
Please remove the exclamation mark here.
}, | ||
{ "id": "issue3351.1", | ||
"file": "pdfs/issue3351.1.pdf", | ||
"md5": "4216245a5f18bb3eac80575ccf0b272d", | ||
"rounds": 1, | ||
"link": true, | ||
"lastPage": 1, | ||
"type": "eq" | ||
}, | ||
{ "id": "issue3351.2", | ||
"file": "pdfs/issue3351.2.pdf", | ||
"md5": "fa3fd1659c409c7824ef8838c3071efc", | ||
"rounds": 1, | ||
"link": true, | ||
"lastPage": 1, | ||
"type": "eq" | ||
}, | ||
{ "id": "issue3351.3", | ||
"file": "pdfs/issue3351.3.pdf", | ||
"md5": "60e2f2c480b6bc0e7f726743c6896520", | ||
"rounds": 1, | ||
"link": true, | ||
"lastPage": 1, | ||
"type": "eq" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all of the different code-paths that are calling drawImageAtIntegerCoords
covered by these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I firstly fixed the 2nd but without the hack for diag/anti-diag matrices and then in order to fix the 1st I had to add this hack.
And the 3rd is using a mask which was not positioned "correctly".
Do you have in mind a pdf with a lot of images ? |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/565a7d6541ffb86/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/42c39c2338044a9/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/42c39c2338044a9/output.txt Total script time: 24.52 mins
Image differences available at: http://54.241.84.105:8877/42c39c2338044a9/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/565a7d6541ffb86/output.txt Total script time: 26.78 mins
Image differences available at: http://54.193.163.58:8877/565a7d6541ffb86/reftest-analyzer.html#web=eq.log |
Given the huge number of changes it's possible that I've missed many issues, however the following test-cases stand out:
Please go through all of the test results carefully yourself, since there's a few too many clear regressions. |
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 1 Live output at: http://54.241.84.105:8877/fac7cb8edb83dbc/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 1 Live output at: http://54.193.163.58:8877/83ec4279cbfcd05/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/fac7cb8edb83dbc/output.txt Total script time: 24.47 mins
Image differences available at: http://54.241.84.105:8877/fac7cb8edb83dbc/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/83ec4279cbfcd05/output.txt Total script time: 26.98 mins
Image differences available at: http://54.193.163.58:8877/83ec4279cbfcd05/reftest-analyzer.html#web=eq.log |
Looking at the logs there's now a number of errors like [1] Those errors originate in pdf.js/src/display/base_factory.js Lines 18 to 57 in 24d5d5d
|
…la#3351) - it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1264608; - it's only a partial fix for mozilla#3351; - some tiled images have some spurious white lines between the tiles. When the current transform is applyed the corners of an image can have some non-integer coordinates leading to some extra transparency added to handle that. So with this patch the current transform is applied on the point and on the dimensions in order to have at the end only integer values.
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/594bcade3639c71/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/7931134130ba41f/output.txt |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/7931134130ba41f/output.txt Total script time: 9.29 mins
|
/botio-windows test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/72844dcc75baac3/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/594bcade3639c71/output.txt Total script time: 19.82 mins
Image differences available at: http://54.241.84.105:8877/594bcade3639c71/reftest-analyzer.html#web=eq.log |
/botio browsertest |
From: Bot.io (Linux m4)ReceivedCommand cmd_browsertest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/62538ed5ef8b498/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_browsertest from @Snuffleupagus received. Current queue size: 1 Live output at: http://54.193.163.58:8877/4313779aab6ca3d/output.txt |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/72844dcc75baac3/output.txt Total script time: 26.63 mins
Image differences available at: http://54.193.163.58:8877/72844dcc75baac3/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/62538ed5ef8b498/output.txt Total script time: 20.88 mins
Image differences available at: http://54.241.84.105:8877/62538ed5ef8b498/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/4313779aab6ca3d/output.txt Total script time: 20.53 mins
Image differences available at: http://54.193.163.58:8877/4313779aab6ca3d/reftest-analyzer.html#web=eq.log |
We obviously need to carefully go through all test-results again, to check that nothing else regressed. In the meantime, I've only re-checked the list in #14853 (comment) and found a couple of remaining issues. |
I went through all the list and there is nothing obviously wrong. |
Do you mean that you've gone through all of #14853 (comment) and #14853 (comment), since we need to do that before moving forward with (and landing) this PR?
So that one looks OK in the viewer, when comparing with Adobe Reader? Because it looks like a pretty obvious regression in the reftest-analyzer. |
And yes I went through all the 490 tests, it's a bit long... and I did it this morning with the tests from yesterday and thx to that I fixed all the bugs I guess. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me, let's do this :-)
/botio makeref |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @calixteman received. Current queue size: 1 Live output at: http://54.193.163.58:8877/4013a619e718697/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @calixteman received. Current queue size: 1 Live output at: http://54.241.84.105:8877/c53696ead7cca0f/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/c53696ead7cca0f/output.txt Total script time: 21.57 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/4013a619e718697/output.txt Total script time: 21.26 mins
|
When the current transform is applied the corners of an image can have
some non-integer coordinates leading to some extra transparency added
to handle that. So with this patch the current transform is applied on the
point and on the dimensions in order to have at the end only integer values.