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. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403248
This commit is contained in:
parent
a733eee1b8
commit
228035d0f3
2 changed files with 2 additions and 5 deletions
|
@ -270,7 +270,7 @@ SDL_SetColorKey(SDL_Surface * surface, Uint32 flag, Uint32 key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a fairly slow function to switch from colorkey to alpha */
|
/* This is a fairly slow function to switch from colorkey to alpha */
|
||||||
void
|
static void
|
||||||
SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)
|
SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
@ -813,6 +813,7 @@ SDL_ConvertSurface(SDL_Surface * surface,
|
||||||
&keyG, &keyB, &keyA);
|
&keyG, &keyB, &keyA);
|
||||||
SDL_SetColorKey(convert, 1,
|
SDL_SetColorKey(convert, 1,
|
||||||
SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA));
|
SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA));
|
||||||
|
SDL_ConvertColorkeyToAlpha(convert);
|
||||||
}
|
}
|
||||||
convert->map->info.r = surface->map->info.r;
|
convert->map->info.r = surface->map->info.r;
|
||||||
convert->map->info.g = surface->map->info.g;
|
convert->map->info.g = surface->map->info.g;
|
||||||
|
|
|
@ -46,9 +46,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif /* SDL_VIDEO_OPENGL */
|
#endif /* SDL_VIDEO_OPENGL */
|
||||||
|
|
||||||
/* From SDL_surface.c */
|
|
||||||
extern void SDL_ConvertColorkeyToAlpha(SDL_Surface * surface);
|
|
||||||
|
|
||||||
/* Available video drivers */
|
/* Available video drivers */
|
||||||
static VideoBootStrap *bootstrap[] = {
|
static VideoBootStrap *bootstrap[] = {
|
||||||
#if SDL_VIDEO_DRIVER_COCOA
|
#if SDL_VIDEO_DRIVER_COCOA
|
||||||
|
@ -1588,7 +1585,6 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
|
||||||
}
|
}
|
||||||
dst = SDL_ConvertSurface(surface, dst_fmt, 0);
|
dst = SDL_ConvertSurface(surface, dst_fmt, 0);
|
||||||
if (dst) {
|
if (dst) {
|
||||||
SDL_ConvertColorkeyToAlpha(dst);
|
|
||||||
SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
|
SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
|
||||||
SDL_FreeSurface(dst);
|
SDL_FreeSurface(dst);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue