-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Apply transformation matrix to RadialGradient radiuses #6640
Apply transformation matrix to RadialGradient radiuses #6640
Conversation
@@ -205,6 +205,8 @@ Shadings.RadialAxial = (function RadialAxialClosure() { | |||
if (matrix) { | |||
p0 = Util.applyTransform(p0, matrix); | |||
p1 = Util.applyTransform(p1, matrix); | |||
r0 *= matrix[0]; |
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.
Use Util.singularValueDecompose2dScale https://github.com/mozilla/pdf.js/blob/master/src/shared/util.js#L701 instead of the matrix[0]
Please include "eq" test file. |
The PDF file included in this PR seems to be slightly corrupt, since the @dsprenkels I hope you don't mind that I took the liberty of linking to a "cleaned-up" version (obtained by running the PDF file through PDFtk) of the PDF file: issue6006.pdf |
@Snuffleupagus So I know for the next time: is it this or this pdftk? |
I'm using the command-line version, called |
@@ -205,6 +205,9 @@ Shadings.RadialAxial = (function RadialAxialClosure() { | |||
if (matrix) { | |||
p0 = Util.applyTransform(p0, matrix); | |||
p1 = Util.applyTransform(p1, matrix); | |||
var scale = Util.singularValueDecompose2dScale(matrix); | |||
r0 *= scale[0]; |
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.
notice that r0 can be null
(see above).
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.
perform the multiplication only for shadingType === ShadingType.RADIAL
case
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.
Good point, that's a nasty mistake.
not only to circle origin points fix for #6006
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/449aed77d8383fb/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/449aed77d8383fb/output.txt Total script time: 0.77 mins Published |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/0429acb79bc1aaa/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/5c498b9ef545dab/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/5c498b9ef545dab/output.txt Total script time: 18.67 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/0429acb79bc1aaa/output.txt Total script time: 20.05 mins
|
Looks good to me. I'll leave the final review to @yurydelendik. |
Thank you for the patch. /botio makeref |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/0e986fa62717e8c/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/d7aef6f4e51de0d/output.txt |
Apply transformation matrix to RadialGradient radiuses
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/0e986fa62717e8c/output.txt Total script time: 18.94 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/d7aef6f4e51de0d/output.txt Total script time: 19.54 mins
|
It looked like #6006 was caused by the fact that the transformation matrix of some pattern was only applied to the origin points of the two circles describing the gradient. This change makes it so that also the radii of the circles will be scaled.
Note that this commit does not fix #6296.
I have not really tested the commit very thoroughly, using the unit tests. I ran into some problems.Fixes #6006.