BitmapRenderer draws contents the wrong size
Categories
(Core :: Graphics: Canvas2D, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox120 | --- | fixed |
People
(Reporter: mozilla2, Assigned: aosmond)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Steps to reproduce:
Run https://jsgist.org/?src=7dd4869ec2e14cfc1c3a62cb9c14741e or the attached file
Actual results:
Only the top 300x150 pixels of the 2000x1000 image are displayed
Expected results:
The 2000x1000 image should have been scaled to fit the canvas (300x150)
Run the same example in Chrome or Safari for comparison
![]() |
||
Updated•1 years ago
|
Comment 1•1 years ago
|
||
Thanks for the bug report! In Chrome I see what you describe as the expected result, with the full image scaled to 300x150. And in Firefox I indeed see only the top-left 300x150 pixels.
In Safari, however, I see the canvas size is updated to 2000x1000 pixels and the bitmap is displayed at full size.
My feeling is that both Firefox and Chrome have it wrong, and Safari does the right thing. See this discussion
Andrew, I know you had to figure out lots of canvas spec things for offscreen canvas, does that seem right to you?
Reporter | ||
Comment 2•1 years ago
|
||
you are probably right. an img tag with no width and height attributes wipp change it's display size when the src image changes. this seems similar
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 3•1 year ago
|
||
A more recent discussion of this issue is https://github.com/whatwg/html/issues/7833. I'm happy to implement this once we achieve consensus, but the discussion still seems to be unresolved. FWIW, there don't appear to be any WPT tests impacted by the behaviour so this isn't an issue for interop-2023.
Comment 4•1 year ago
|
||
I just posted what our most recent consensus was to whatwg/html#7833, from when we talked about this extensively in the WebGL WG. (last talk 2023-01-12, though I'm looking at the text pulled from the 2023-05-04 minutes)
Assignee | ||
Comment 5•1 year ago
|
||
This patch makes it so that when a new ImageBitmap is provided to an
ImageBitmapRenderingContext, we resize its owning canvas rather than
crop or scale the given ImageBitmap to fit inside the canvas dimensions.
See discussion in https://github.com/whatwg/html/issues/7833.
![]() |
||
Comment 7•1 year ago
|
||
bugherder |
Description
•