W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2011

[whatwg] Canvas toDataURL and device dpi resolution

From: John Knottenbelt <jknotten@chromium.org>
Date: Thu, 1 Dec 2011 16:52:14 +0000
Message-ID: <CAJtTCa4SjP81Mj=COmN4op8pk3EAJg_OjdQ+Xbk1YgCE5o2zHA@mail.gmail.com>
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
Received on Thursday, 1 December 2011 08:52:14 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:38 UTC