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 size of maskCanvas to draw image masks correctly #17148

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

JT-External
Copy link
Contributor

The current code creates a Canvas for drawing an ImageMask using only the top-left and bottom-right coordinates of the ImageMask. This code cannot allocate an area on the Canvas to draw the entire ImageMask when the ImageMask is rotated. Therefore, I modified the code to use the four corner coordinates of the ImageMask when creating the Canvas. I also adjusted the offset for drawing on the Canvas according to this modification.

This is a fix for #17147 .

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.

Thanks for the patch; I've left a couple of inline comments below.

Can you please also add a reference-test?
For an example of how that's done, see e.g. 459d26e#diff-bbeef90df04bff7617f7ef59e3f37cac92192c5169bc500d857bd6fb107fcabd (and below).

src/display/canvas.js Outdated Show resolved Hide resolved
src/display/canvas.js Outdated Show resolved Hide resolved
@Snuffleupagus
Copy link
Collaborator

Please squash the commits into one (we don't use separate fixup commits in this projects); see https://github.com/mozilla/pdf.js/wiki/Squashing-Commits

Use existing helper to calculate the Box

Co-authored-by: Jonas Jenwald <jonas.jenwald@gmail.com>

Ensure that there are non-zero

Co-authored-by: Jonas Jenwald <jonas.jenwald@gmail.com>

Add a reference test for mozilla#17147
@JT-External
Copy link
Contributor Author

Thank you for your review and feedback. I appreciate your time and effort.
I have addressed your inline comments and made the necessary changes. I have also added a reference-test as you requested.

Unless I'm missing something, it looks like this code is re-implementing the following helper?

I was not aware of its existence. I have updated my code to use it instead of re-implementing it.

The old code ensured that these are non-zero, why was that removed?

I removed it by mistake. I have restored it in the latest commit. Thank you for catching that error.

Please let me know if you have any further suggestions or questions. Thank you again for your support.

@calixteman
Copy link
Contributor

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/69df77d1bcdbad5/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/69df77d1bcdbad5/output.txt

Total script time: 24.92 mins

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

Image differences available at: http://54.241.84.105:8877/69df77d1bcdbad5/reftest-analyzer.html#web=eq.log

@Snuffleupagus Snuffleupagus linked an issue Oct 20, 2023 that may be closed by this pull request
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.

r=me, thank you!

@Snuffleupagus Snuffleupagus merged commit a4cd2ef into mozilla:master Oct 20, 2023
3 checks passed
@Snuffleupagus
Copy link
Collaborator

/botio makeref

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/d74e85ae39ab116/output.txt

@marco-c
Copy link
Contributor

marco-c commented Oct 20, 2023

Thanks for the contribution!

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/d74e85ae39ab116/output.txt

Total script time: 19.52 mins

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

@calixteman
Copy link
Contributor

/botio-windows makeref

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/0c5787c1f9e595b/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/0c5787c1f9e595b/output.txt

Total script time: 23.07 mins

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

@JT-External JT-External deleted the support-rotated-imagemask branch October 23, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rotated image mask is not rendered correctly
5 participants