sdl_texture.cpp: Rewrite the optimize() function.
The changes made by tuxdev in revision 6192 broke alpha handling in the SDL
renderer for me (SDL 1.2.7). This commit fixes handling of semi-transparent
surfaces / pixels and improves the function towards readability.
It starts by categorizing pixels into three categories: transparent,
semi-transparent and opaque.
* If semi-transparent pixels are present, "SDL_DisplayFormatAlpha" is used.
* If only opaque pixels are present, "SDL_DisplayFormat" is used.
* If only opaque and transparent pixels are present, "SDL_SetColorKey" is used
for 1-bit alpha.
git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6485
837edb03-e0f3-0310-88ca-
d4d4e8b29345