Remove the undocumented 3rd argument of the emitters (bytes left in buffer).
Add a column to the browser tests that displays JPEGs.
Revise how buffers are allocated.
From "[WHATWG HTML Living Standard]
(https://html.spec.whatwg.org/multipage/indices.html#event-load)", the definition of 'onload':
> Fired at the Window when the document has finished loading; fired at an
element containing a resource (e.g. img, embed) when its resource has finished
loading
To adhere to that specification both handlers should be called as many times as Image loads.
From Google Chrome's Developer Tools:
```js
> function handler(evt) { console.log('img handler: %s', evt.type); }
< undefined
> var img = document.createElement('img')
< undefined
> img.onload = handler
< handler(evt)
> img.onerror = handler
< handler(evt)
> img.src = 'https://www.google.com/images/errors/logo_sm_2.png'; true
< true
< img handler: load
> img.src = 'https://www.google.com/images/errors/logo_sm_2.png'; true
< true
< img handler: load
> img.src = 'https://example.com/404.png'; true
< true
< img handler: error
> img.src = 'https://example.com/404.png'; true
< true
< img handler: error
```
Benchmark:
var canvas = new Canvas(300, 600);
var ctx = canvas.getContext("2d");
// any manipulation of canvas/ctx here.
var data = ctx.getImageData(0,0,300,600);
// time 1000x:
ctx.putImageData(data, 0, 0);
Added some argument testing/manipulation to match WebKit/Moz behaviors.
Additionally benchmarked:
* branching on `if (a == 0 || a == 255)`, as it is
* not branching (always doing the alpha calculation)
* Mozilla's implementation found here: https://dxr.mozilla.org/mozilla-central/source/dom/canvas/CanvasRenderingContext2D.cpp#5083
Mozilla's is insignificantly faster (p=0.17) :) so left it as-is.