Not sure what you mean by "in the same order". |
The channels in a pixel can appear in 24 different orders: RGBA, RGAB, RBAG, etc. When blitting surfaces, if the source and destination orders match, a simple series of memcpy() is enough. If the orders are different to blit SDL has to, for each pixel, load each channel from the source into a register and then store each into the destination.
Given I know with complete certainty that the screen surface and the thousands of individual surfaces all have the same bit depth, should I expect a massive speed boost by calling the function? |
Maybe so, maybe not. From what you're saying, it seems like it'd be easier to ensure that the channels are in the correct order at the file level.
It seems to me that you've written yourself into a corner with your design. Not having an Image or Texture class for such a large project is absolutely insane. For example, if you find a resource management bug, you have no way of fixing it everywhere at once; and as you've probably realized by now, making any changes to the rendering pipeline or the loading mechanism is pretty much impossible.
This is the worst thing to hear, but my recommendation is to just scrap all the graphics code and start from scratch. What you have now is unmanageable. If you'd like, I can send you the source from a engine I was working on a while back that implements a Texture class with subtextures and reference counting. That should at least give you a jumping-off point. If you design the classes well, the restructuring doesn't need to be too traumatic.