Re: [whatwg] Canvas in Workers

On Fri, 30 Nov 2012, Gregg Tavares (社ç~T¨) wrote:
>
> on ImageBitmap should zero size canvases just work (and create a 0 sized
> ImageBitmap)?
> 
> My personal preference is for APIs that just work with zero sizes so I
> don't have to write lots of special cases for handling zero.
> 
> For example [1,2,3].slice(0,0) returns []. It doesn't throw.
> "abc".substring(0,0) returns "" it doesn't throw. fillRect(x, y, 0, 0)
> doesn't throw. etc...
> 
> It just makes life a lot easier

The main reason 0-sized canvases have always thrown in drawImage() is that 
I couldn't work out what you would paint, nor why you'd have a zero-sized 
canvas, and throwing seemed like it'd be the best way to help the author 
figure out where the problem was, rather than just ignoring the call and 
having the author scratch their head about why nothing was happening.

If there's cases where you would legitimately end up with zero-sized 
canvases that you'd try to draw from, though, I'm happy to change it.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 30 November 2012 18:12:47 UTC