mozilla/pdf.js — pull request #4181 by nnethercote (2014-01-24 05:26:00+00:00)
Title: Reduce memory consumption of simple black and white images.

https://bugzilla.mozilla.org/show_bug.cgi?id=962933#c0 has a description of the
basic idea. The enormous improvements described there still apply.

Things to note about the patch.

- I merged getImageData() and fillRgbaBuffer(). The new function is called
createImageData().

- In evaluator.js, when replacing queue items, I set |kind| to 'rgba_32bpp'.
I'm not sure if it would be possible here for the incoming image to be
'grayscale_1bpp'. (It doesn't happen in any of the tests, though.)

- In canvas.js, I made the chunking code more concise by combining the two
loops into one. This required a condition within the outer loop, but this
doesn't hurt performance. I also came up with better names for lots of the
variables.