Re: [whatwg] Proposal: ImageData constructor or factory method with preexisting data

On Tue, Mar 12, 2013 at 6:54 PM, Rik Cabanier <cabanier@gmail.com> wrote:

> It feels like something is missing. How does putImageDataHD know that the
> bitmap should be scaled? Width and height refer to the pixel dimensions and
> not the 'px' unit
>

It's putImageData that scales, not putImageDataHD.

putImageData *always* scales by the pixel ratio.  If you're on a system
with a ratio of 2, calling putImageData with a 500x1000 buffer will always
draw a 1000x2000 image, scaling the image up.  putImageDataHD on a 500x1000
buffer will always draw a 500x1000 image, regardless of the pixel ratio.

In other words, the blitter knows whether to scale or not based on whether
it was putImageData or putImageDataHD that you called, not on something
inside the ImageData you passed in.

-- 
Glenn Maynard

Received on Wednesday, 13 March 2013 00:05:34 UTC