sdl_texture.cpp: Rewrite the optimize() function.