mozilla-b2g/gaia — pull request #8363 by janjongboom (2013-02-27 14:50:53+00:00)
Title: Bug 826249 - Thumbs redraw on applying effect or border

Fix for [#826249](https://bugzilla.mozilla.org/show_bug.cgi?id=826249).

When you apply an effect or a border to an image in the gallery all thumbs get redrawn. This is very easy to spot on the Unagi or GeeksPhone, but takes a large image (e.g. grab a 3 MB one from your photo camera) to see in the emulator.

After quite some testing I tracked this down to the moment that the filter is applied (through WebGL, `gl.texImage2D` line). During this moment (which runs on the main thread, can't offload GL to a worker at the moment) the background images of the buttons disappear as well, even though there is no actual change on them. This is not only due to buttons or anything, but seem to happen on all background-images on the current view. Maybe a gecko flake or anything.

I worked around the above by writing the image information to a canvas object embedded within the button, as an tag crashes B2G desktop there. This works great, the effects are also faster applied on the Unagi and no redraws are triggered. Also I now delay the rendering of these elements until the panel is actually used.