From: Wenyuan G. <guo...@gm...> - 2010-06-09 07:19:25
|
Hi all, I have updated our Git repository, master branch with an improved version of SVG sprite loader. It caches prerendered PNG versions of SVG sprites on harddisk, and I'm happy to report that it greatly improves the initial loading time as well as delay in switching between fullscreen and windowed mode in-game! No new cache files will be generated as long as the user doesn't change the resolution of his/her desktop. Please try it out if you have time! The modification is entirely transparent to other parts of the program and the function signatures and usages are completely unchanged. One difficulty I had was I had intended to use BMP files as cache, since SDL has native "save" functions into that format. But it turns out that SDL's saveBMP doesn't support alpha transparency, causing scrambled sprites. After a good amount of googling, to my surprise, tuxpaint has a function to save SDL surfaces into PNG format! So in my implementation I have "borrowed" that function (after modifying it a bit to support alpha channel) and everything's fine :D! Maybe that part can eventually to be factored out in the common? Cheers Wenyuan |