From e1e30e17ac7b3cb9f42c31df1f12cccfdea12b6f Mon Sep 17 00:00:00 2001 From: Tim Goya Date: Mon, 7 Dec 2009 05:43:32 +0000 Subject: [PATCH] make SDL texture optimization less aggressive and generally stupider SVN-Revision: 6192 --- external/squirrel/CMakeLists.txt | 3 ++- src/video/sdl/sdl_texture.cpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/external/squirrel/CMakeLists.txt b/external/squirrel/CMakeLists.txt index f92ce75d0..0c4ef292d 100644 --- a/external/squirrel/CMakeLists.txt +++ b/external/squirrel/CMakeLists.txt @@ -36,7 +36,8 @@ ENDIF(ENABLE_SQDBG) # the squirrel sources are out of our control so don't be too pedantic about # them -REMOVE_DEFINITIONS(-Werror -Wextra) +SET(CMAKE_CXX_FLAGS "") +SET(CMAKE_C_FLAGS "") ## define a target for building the library diff --git a/src/video/sdl/sdl_texture.cpp b/src/video/sdl/sdl_texture.cpp index 0bdd714f2..2a93c6d37 100644 --- a/src/video/sdl/sdl_texture.cpp +++ b/src/video/sdl/sdl_texture.cpp @@ -423,13 +423,15 @@ SDL_Surface *optimize(SDL_Surface *src) } else { + int bpp; + bool colors[(1 << 12)]; + memset(colors, 0, (1 << 12) * sizeof(bool)); +#if 0 int transparent = 0; int opaque = 0; int semitransparent = 0; int alphasum = 0; int squaredalphasum = 0; - bool colors[(1 << 12)]; - memset(colors, 0, (1 << 12) * sizeof(bool)); int bpp = src->format->BytesPerPixel; if(SDL_MUSTLOCK(src)) @@ -496,6 +498,7 @@ SDL_Surface *optimize(SDL_Surface *src) { return SDL_DisplayFormatAlpha(src); } +#endif int keycolor = -1; for(int i = 0;i < (1 << 12);i++) { @@ -548,7 +551,8 @@ SDL_Surface *optimize(SDL_Surface *src) } Uint8 red, green, blue, alpha; SDL_GetRGBA(mapped, src->format, &red, &green, &blue, &alpha); - if(alpha < (avgalpha / 4)) + //if(alpha < (avgalpha / 4)) + if(alpha < 8) { mapped = key; } @@ -588,10 +592,12 @@ SDL_Surface *optimize(SDL_Surface *src) { SDL_UnlockSurface(src); } + /* if(avgalpha < 240) { SDL_SetAlpha(dst, SDL_SRCALPHA | SDL_RLEACCEL, avgalpha); } + */ SDL_SetColorKey(dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, key); SDL_Surface *convert = SDL_DisplayFormat(dst); SDL_FreeSurface(dst); -- 2.11.0