scummvm/scummvm — pull request #257 by lordhoto (2012-07-15 00:20:58+00:00)
Title: Extend crossBlit for abitrary (in-place) conversions and add a in-place conversion to Surface

This is a (untested!) implementation of a possibility to convert a Surface in-place, this means without an additional buffer like converTo uses for example. This can reduce the memory usage for conversions, when you don't need the original anymore.

I implemented this method using crossBlit, which I extended to allow abitrary conversions (various source/destination depths supported now). The only requirement for it being inplace is a ratio of dstPitch / srcPitch to hold, which should be sane for most uses.
While implementing this I removed the ability to produce 3Bpp in crossBlit, since we actually don't want code to use 3Bpp. It is still possible to use 3Bpp source surfaces though, I even fixed a bug there I think, since it wasn't advancing the source buffer correctly before as far as I can tell.

Possible uses for this are the graphics widgets in our GUI, which currently do an out-of-place conversion and thus take up more memory in the process than they might need to. In case there is any interest or use in this we can probably merge it. Though as I said, this is untested, so it should get some testing before it comes to that.