[whatwg] [canvas] request for {create, get, put}ImageDataHD and ctx.backingStorePixelRatio

Charles Pritchard chuck at jumis.com
Tue Mar 20 12:30:37 PDT 2012


On 3/20/2012 10:53 AM, Tab Atkins Jr. wrote:
> Given that the modern iPhones (and I suspect the iPad 3, though I
> haven't tested it yet) aren't exposing their high-res backing stores
> (they give back ImageData with CSS px resolution), it seems likely
> that the original goal of get/putImageData to seamlessly adapt has
> failed.  So, I support adding an alternate API that explicitly returns
> a high-res store.  If people fuck*that*  up, then we're just screwed.

IE exposes CSS px resolution via window.screen; mobile exposes via 
devicePixelRatio, webkit exposes accidentally through innerHeight and 
outerHeight and Mozilla through CSS queries on device-pixel-ratio.
I tried to get this mess fixed, but I got a lot of push back from Mozilla.

WebKit developers agreed that the MS solution would be OK:
http://msdn.microsoft.com/en-us/library/ms535868(v=vs.85).aspx 
<http://msdn.microsoft.com/en-us/library/ms535868%28v=vs.85%29.aspx>

Anne agreed to add it to CSSOM back when he was editing it, once there 
was a second implementation.

I've got two hacks to get pixel resolution over here:
http://www.jumis.com/cme-button.html#abc6

I didn't add the Mozilla one yet.


I strongly suggest we just fix the problem by updating window.screen so 
us developers can manually manage the CSS width vs independent width.
I've been doing this forever, it works fine [I update on resize events 
if the res has changed]:
<canvas style="width: 50px; height: 50px;" width="100" height="100" />

We already went through this discussion on WHATWG. I didn't like how it 
went back then. Now that we're revisiting it, maybe we can just follow MS.

On desktop, the res changes with browser zoom.

-Charles



More information about the whatwg mailing list