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 scaling issue in canvas image rendering test #3236

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

greggman
Copy link
Contributor

@greggman greggman commented Jan 3, 2024

IIUC the issue is scaling can happen edge cases, especially given some APIs render with flipped Y so in the pixelated/crisp-edges case they might choose a different edge than the canvas API.

Making the display size exactly double the rendered size seems like it might solve this issue. The test would still show a difference between image-rendering: initial and image-rendeirng: pixelated / crisp-edges but should probably not show any difference otherwise


Requirements for PR author:

  • All missing test coverage is tracked with "TODO" or .unimplemented().
  • New helpers are /** documented */ and new helper files are found in helper_index.txt.
  • Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)

Requirements for reviewer sign-off:

  • Tests are properly located in the test tree.
  • Test descriptions allow a reader to "read only the test plans and evaluate coverage completeness", and accurately reflect the test code.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Helpers and types promote readability and maintainability.

When landing this PR, be sure to make any necessary issue status updates.

IIUC the issue is scaling can happen edge cases, especially
given some APIs render with flipped Y so in the pixelated/crisp-edges
case they might choose a different edge than the canvas API.

Making the display size exactly double the rendered size seems like it
might solve this issue. The test would still show a difference between
image-rendering: initial and image-rendeirng: pixelated / crisp-edges
but should probably not show any difference otherwise
@greggman greggman requested a review from kainino0x January 3, 2024 23:14
Copy link
Collaborator

@kainino0x kainino0x left a comment

Choose a reason for hiding this comment

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

(For any other readers more info can be found on https://crbug.com/1515185)

This looks like it'll at least make the test reliable for devices with devicePixelRatio=1. For higher non-integer devicePixelRatio values I suspect we may still see the same issues though maybe this will still be more reliable on average.

@kainino0x kainino0x merged commit 67c1786 into gpuweb:main Jan 4, 2024
1 check passed
@greggman greggman deleted the canvas-image-scaling-issue branch November 1, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants