-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Fix several issues with radial/axial shadings and tiling patterns. #13361
Conversation
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://54.67.70.0:8877/783909067a141d2/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://3.101.106.178:8877/c81eee5345678b4/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/783909067a141d2/output.txt Total script time: 26.20 mins
Image differences available at: http://54.67.70.0:8877/783909067a141d2/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://3.101.106.178:8877/c81eee5345678b4/output.txt Total script time: 29.71 mins
Image differences available at: http://3.101.106.178:8877/c81eee5345678b4/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/f2ead36cdb83ebf/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/f2ead36cdb83ebf/output.txt Total script time: 4.31 mins Published |
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.
Looks great to me, thank you!
src/display/pattern_helper.js
Outdated
tmpCtx.fill(); | ||
|
||
const pattern = ctx.createPattern(tmpCanvas.canvas, "repeat"); | ||
pattern.setTransform(new DOMMatrix(ctx.mozCurrentTransformInverse)); |
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 really don't want to complicate this patch in any way (especially the MOZCENTRAL
build), given how much it improves the pattern handling, but are we worried about people using the general PDF.js library in older Firefox versions?
According to https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform#browser_compatibility, using a DOMMatrix
as the argument has only been supported since Firefox 79 (the current ESR is still on the 78 branch).
Previously, we set the base transformation and pattern matrix directly to the main rendering ctx of the page, however doing this caused the current transform to be lost. This would cause issues with things like shear missing so the pattern was misaligned or when stroke was used the scale of the line width or dash would be wrong. Instead we should leave the current transform and use setTransfrom on the pattern so it is applied correctly. For axial and radial shadings I had to create a temporary canvas to draw the shading so I could in turn use setTransform. Fixes: mozilla#13325, mozilla#6769, mozilla#7847, mozilla#11018, mozilla#11597, mozilla#11473 The following already in the corpus are improved: issue8078-page1 issue1877-page1
3cabae2
to
ac44afa
Compare
Now also fixes #11473. |
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://54.67.70.0:8877/ea2ad5685cb7364/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://3.101.106.178:8877/90e5d3d1bee56bc/output.txt |
From: Bot.io (Windows)FailedFull output at http://3.101.106.178:8877/90e5d3d1bee56bc/output.txt Total script time: 30.71 mins
Image differences available at: http://3.101.106.178:8877/90e5d3d1bee56bc/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/ea2ad5685cb7364/output.txt Total script time: 40.06 mins
Image differences available at: http://54.67.70.0:8877/ea2ad5685cb7364/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/c8cef61fff3f5c4/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/c8cef61fff3f5c4/output.txt Total script time: 4.29 mins Published |
Fixes #10955 as well, right? |
Thanks a lot for fixing this! /botio makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/724534b896d260c/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 2 Live output at: http://3.101.106.178:8877/ff491bb24e4956a/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/724534b896d260c/output.txt Total script time: 23.18 mins
|
From: Bot.io (Windows)SuccessFull output at http://3.101.106.178:8877/ff491bb24e4956a/output.txt Total script time: 27.22 mins
|
Previously, we set the base transformation and pattern matrix
directly to the main rendering ctx of the page, however doing this
caused the current transform to be lost. This would cause issues
with things like shear missing so the pattern was misaligned or when
stroke was used the scale of the line width or dash would be wrong.
Instead we should leave the current transform and use setTransfrom
on the pattern so it is applied correctly. For axial and radial shadings I had
to create a temporary canvas to draw the shading so I could in turn
use setTransform.
Fixes: #13325, #6769, #7847, #11018, #11597, #11473
The following already in the corpus are improved:
issue8078-page1
issue1877-page1