[whatwg] Canvas toDataURL and device dpi resolution

John Knottenbelt jknotten at chromium.org
Thu Dec 1 08:52:14 PST 2011


How should the data url returned by toDataURL be sized in the case of
a high device dpi resolution system? E.g. where the canvas's backing
store horizontal and vertical dimensions are some multiple of the
specified width and height in CSS pixels.

The test http://philip.html5.org/tests/canvas/suite/tests/toDataURL.png.primarycolours.html
makes a drawing with canvas, saves this drawing to a data url, loads
the data url into an Image element and then draws that back to the
canvas, and then performs some assertions that the image is as
expected.

I've been trying this out in the DumpRenderTree test runner of WebKit,
where toDataURL returns an image derived from the canvas' backing
store image data. If I set the device dpi scale to 2.0 to imitate a
high DPI display, the test will fail because the image returned by
toDataURL is now four times as big as the test expects it to be.

Is this correct behaviour, or is the test correct and I simply have a
bug in WebKit?

Many thanks

John


More information about the whatwg mailing list