comparison src/video/SDL_surface.c @ 2787:93764fe8601a

It turns out both the software and the OpenGL renderer had the same problem. According to the spec, when SDL_SRCALPHA is set, the colorkey is ignored, so we just need to convert the colorkey into the alpha channel.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 25 Nov 2008 05:29:14 +0000
parents 6bacfecbf27e
children 365fe1a2aad5
comparison
equal deleted inserted replaced
2786:6bacfecbf27e 2787:93764fe8601a
268 268
269 return 0; 269 return 0;
270 } 270 }
271 271
272 /* This is a fairly slow function to switch from colorkey to alpha */ 272 /* This is a fairly slow function to switch from colorkey to alpha */
273 void 273 static void
274 SDL_ConvertColorkeyToAlpha(SDL_Surface * surface) 274 SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)
275 { 275 {
276 int x, y; 276 int x, y;
277 277
278 if (!surface) { 278 if (!surface) {
811 811
812 SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR, 812 SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR,
813 &keyG, &keyB, &keyA); 813 &keyG, &keyB, &keyA);
814 SDL_SetColorKey(convert, 1, 814 SDL_SetColorKey(convert, 1,
815 SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA)); 815 SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA));
816 SDL_ConvertColorkeyToAlpha(convert);
816 } 817 }
817 convert->map->info.r = surface->map->info.r; 818 convert->map->info.r = surface->map->info.r;
818 convert->map->info.g = surface->map->info.g; 819 convert->map->info.g = surface->map->info.g;
819 convert->map->info.b = surface->map->info.b; 820 convert->map->info.b = surface->map->info.b;
820 convert->map->info.a = surface->map->info.a; 821 convert->map->info.a = surface->map->info.a;