Mercurial > sdl-ios-xcode
changeset 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 | 44be910366a9 |
files | src/video/SDL_surface.c src/video/SDL_video.c |
diffstat | 2 files changed, 2 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/SDL_surface.c Tue Nov 25 02:21:53 2008 +0000 +++ b/src/video/SDL_surface.c Tue Nov 25 05:29:14 2008 +0000 @@ -270,7 +270,7 @@ } /* This is a fairly slow function to switch from colorkey to alpha */ -void +static void SDL_ConvertColorkeyToAlpha(SDL_Surface * surface) { int x, y; @@ -813,6 +813,7 @@ &keyG, &keyB, &keyA); SDL_SetColorKey(convert, 1, SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA)); + SDL_ConvertColorkeyToAlpha(convert); } convert->map->info.r = surface->map->info.r; convert->map->info.g = surface->map->info.g;
--- a/src/video/SDL_video.c Tue Nov 25 02:21:53 2008 +0000 +++ b/src/video/SDL_video.c Tue Nov 25 05:29:14 2008 +0000 @@ -46,9 +46,6 @@ #endif #endif /* SDL_VIDEO_OPENGL */ -/* From SDL_surface.c */ -extern void SDL_ConvertColorkeyToAlpha(SDL_Surface * surface); - /* Available video drivers */ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_COCOA @@ -1588,7 +1585,6 @@ } dst = SDL_ConvertSurface(surface, dst_fmt, 0); if (dst) { - SDL_ConvertColorkeyToAlpha(dst); SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch); SDL_FreeSurface(dst); }