Skip to content
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 transformations when painting image masks and tiling patterns. #13683

Merged
merged 1 commit into from
Jul 7, 2021

Conversation

brendandahl
Copy link
Contributor

@brendandahl brendandahl commented Jul 6, 2021

Previously, when we filled image masks we didn't copy over the current transformation,
this caused patterns to be misaligned when painted. Now we create a temporary
canvas with the mask and have the transform copied over and offset it relative to
where the mask would be painted. We also weren't properly offsetting tiling patterns.
This isn't usually noticeable since patters repeat, but in the case of #13561 the pattern
is only drawn once and has to be in the correct position to line up with the mask image.

These fixes broke #11473, but highlighted that we were drawing that correctly by
accident and not correctly handling negative bounding boxes on tiling patterns.

Fixes #6297, #13561, #13441

Partially fixes #1344 (still blurry but boxes are in correct position now)

@brendandahl
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2021

From: Bot.io (Windows)


Received

Command cmd_test from @brendandahl received. Current queue size: 0

Live output at: http://3.101.106.178:8877/b5caff5f14ede14/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2021

From: Bot.io (Linux m4)


Received

Command cmd_test from @brendandahl received. Current queue size: 0

Live output at: http://54.67.70.0:8877/c48fed926f5d8b7/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2021

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/c48fed926f5d8b7/output.txt

Total script time: 31.73 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 52
  different first/second rendering: 1

Image differences available at: http://54.67.70.0:8877/c48fed926f5d8b7/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2021

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/b5caff5f14ede14/output.txt

Total script time: 36.10 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 52
  different first/second rendering: 1

Image differences available at: http://3.101.106.178:8877/b5caff5f14ede14/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator

There seem to be a number of cases, mostly involving images with "text", which now look a bit blurrier (and less sharp) than before.
Is this perhaps related e.g. to the zoom level, and thus less noticeable in the viewer, or is there something which can be done about that? (Given the overall improvements, I'd totally understand if we have to accept some smaller "regressions" here.)

@brendandahl
Copy link
Contributor Author

I'm not quite sure why some of the images seem a bit more blurry. I thought if anything they'd be more crisp since we are now drawing at the correct scale. It could be we're now drawing at fractional x/y and the pixels are being blurred. Locally I can't tell a difference with a high-dpi screen, but I'll look into a few to see if there's anything obvious.

This was linked to issues Jul 6, 2021
Previously, when we filled image masks we didn't copy over the current transformation,
this caused patterns to be misaligned when painted. Now we create a temporary
canvas with the mask and have the transform copied over and offset it relative to
where the mask would be painted. We also weren't properly offsetting tiling patterns.
This isn't usually noticeable since patters repeat, but in the case of mozilla#13561 the pattern
is only drawn once and has to be in the correct position to line up with the mask image.

These fixes broke mozilla#11473, but highlighted that we were drawing that correctly by
accident and not correctly handling negative bounding boxes on tiling patterns.

Fixes mozilla#6297,  mozilla#13561, mozilla#13441

Partially fixes mozilla#1344 (still blurry but boxes are in correct position now)
@brendandahl
Copy link
Contributor Author

I did some testing and it looks like the issue was drawing the image with fractional offsetX/Y coordinates. Let's try this again...
/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Windows)


Received

Command cmd_test from @brendandahl received. Current queue size: 0

Live output at: http://3.101.106.178:8877/f2e2b1b11c5827a/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Linux m4)


Received

Command cmd_test from @brendandahl received. Current queue size: 0

Live output at: http://54.67.70.0:8877/03b9aa14a298940/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/03b9aa14a298940/output.txt

Total script time: 31.59 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 54
  different first/second rendering: 1

Image differences available at: http://54.67.70.0:8877/03b9aa14a298940/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/f2e2b1b11c5827a/output.txt

Total script time: 35.93 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 54
  different first/second rendering: 1

Image differences available at: http://3.101.106.178:8877/f2e2b1b11c5827a/reftest-analyzer.html#web=eq.log

@marco-c
Copy link
Contributor

marco-c commented Jul 7, 2021

It's looking better now.

@Snuffleupagus
Copy link
Collaborator

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/2a95eb4d426a8e2/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/2a95eb4d426a8e2/output.txt

Total script time: 4.69 mins

Published

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!

@Snuffleupagus Snuffleupagus merged commit 05ebb63 into mozilla:master Jul 7, 2021
@Snuffleupagus
Copy link
Collaborator

/botio makeref

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/b3c1feb2a37a3d8/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Windows)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 1

Live output at: http://3.101.106.178:8877/e1d56f84499ea0c/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/b3c1feb2a37a3d8/output.txt

Total script time: 28.50 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

pdfjsbot commented Jul 7, 2021

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/e1d56f84499ea0c/output.txt

Total script time: 33.29 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image missing in PDF Backgroundimage is not rendered Pattern not rendered Blurred images
4 participants