[whatwg] isPointInPath v. set of pixels in canvas hit regions

Ian Hickson ian at hixie.ch
Thu Jul 5 14:25:50 PDT 2012

On Thu, 5 Jul 2012, Edward O'Connor wrote:
> As things currently stand in the spec, implementations basically need to 
> keep N+1 bitmaps per canvas, where N is the number of hit regions. I 
> doubt any implementors would be enthusiastic to implement hit regions 
> like this. From a WebKit perspective, we'd much prefer keeping a Path 
> for each hit region, and then simply using isPointInPath for hit 
> testing. This also implies that the current piggybacking of "Clear 
> regions that cover the pixels" in clearRect() could go away. Yay! :)

You only need one bitmap to implement the hit testing.

(Or you can do it using paths, sure. The effect is the same, but it's 
probably quicker to use a bitmap.)

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

More information about the whatwg mailing list