cocos2d/cocos2d-html5 — pull request #1049 by MarkEHenderson (2013-08-01 18:37:24+00:00)
Title: Caching for tinted image buffers (memory win for Canvas)

This causes colored textures that share the same textureRect and color to share the same image buffer, rather than creating a new image buffer for each instance.

We have a scene with a couple hundred instance of the same texture were all being colored one of 3 ways. Because each instance was generating a new texture, this scene was causing browser crashes on mobile web and performing very poorly in canvas rendering on the desktop.

I was considering adding a new set of functions to CCTextureCache instead of adding the details to the texture keys, but I decided to re-use existing functionality as much as possible. I already had the system working and debugged when I discovered CCParticleSystemQuad.js already had a similar system, and that system could reasonably be adapted to a more general usage. I'm completely open to changing to a different system for the caching if people think it would be a significant improvement.