Closed Bug 1842572 Opened 2 years ago Closed 2 years ago

SVG as Image src drawn on 2D Context are not scaled according to `drawImage` parameters (differs from Webkit/Chromium)

Categories

(Core :: Graphics: Canvas2D, defect, P2)

Firefox 115
defect

Tracking

()

RESOLVED DUPLICATE of bug 1547776

People

(Reporter: hello, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Steps to reproduce:

Create an SVG image with a viewBox attribute but no preserveAspectRatio attribute set
Set the SVG as an HTMLImageElement tag src attribute
Create an HTML Canvas Element and get the 2d context
Use the drawImage method on the 2d context to draw the HTMLImageElement and set the "destination" width to be larger than the viewBox width (so you would non-uniformly scale the SVG image)

Actual results:

SVG Image is drawn with the preserveAspectRatio default setting applied and the image is scaled uniformly

Codesandbox Example https://codesandbox.io/s/eager-cartwright-ksm22w?file=/src/index.js

Expected results:

SVG image should be drawn scaled non-uniformly on the canvas.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: Canvas2D
Product: Firefox → Core
Severity: -- → S3
Priority: -- → P2

Have you checked #1547776 and is this the same problem?

Flags: needinfo?(hello)

(In reply to Mark Hills from comment #2)

Have you checked #1547776 and is this the same problem?

I didn't find that in my search but you're right this is a duplicate of that issue.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1547776
Flags: needinfo?(hello)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: