From: <bal...@us...> - 2003-11-26 16:38:26
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/SDLVideo In directory sc8-pr-cvs1:/tmp/cvs-serv6706/SDLVideo Modified Files: SDLVideoDriver.cpp Log Message: Optimization : SDLVideoDriver.cpp : Simple optimization on BlitSpriteTinted Index: SDLVideoDriver.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/SDLVideo/SDLVideoDriver.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** SDLVideoDriver.cpp 26 Nov 2003 13:57:44 -0000 1.28 --- SDLVideoDriver.cpp 26 Nov 2003 16:38:23 -0000 1.29 *************** *** 496,508 **** SDL_Surface * tmp = (SDL_Surface*)spr->vptr; SDL_Color * pal = tmp->format->palette->colors; ! SDL_Color oldPal[256], newPal[256]; memcpy(oldPal, pal, 256*sizeof(SDL_Color)); ! memcpy(newPal, pal, 2*sizeof(SDL_Color)); for(int i = 2; i < 256; i++) { ! newPal[i].r = (tint.r*oldPal[i].r) >> 8; ! newPal[i].g = (tint.g*oldPal[i].g) >> 8; ! newPal[i].b = (tint.b*oldPal[i].b) >> 8; } ! SDL_SetPalette(tmp, SDL_LOGPAL, newPal, 0, 256); BlitSprite(spr, x, y); SDL_SetPalette(tmp, SDL_LOGPAL, oldPal, 0, 256); --- 496,508 ---- SDL_Surface * tmp = (SDL_Surface*)spr->vptr; SDL_Color * pal = tmp->format->palette->colors; ! SDL_Color oldPal[256];//, newPal[256]; memcpy(oldPal, pal, 256*sizeof(SDL_Color)); ! //memcpy(newPal, pal, 2*sizeof(SDL_Color)); for(int i = 2; i < 256; i++) { ! pal[i].r = (tint.r*oldPal[i].r) >> 8; ! pal[i].g = (tint.g*oldPal[i].g) >> 8; ! pal[i].b = (tint.b*oldPal[i].b) >> 8; } ! //SDL_SetPalette(tmp, SDL_LOGPAL, newPal, 0, 256); BlitSprite(spr, x, y); SDL_SetPalette(tmp, SDL_LOGPAL, oldPal, 0, 256); |