Set blend mode for textures that were created from surfaces with a colorkey
authorSam Lantinga
Wed, 12 Jan 2011 15:58:53 -0800
changeset 4987b68a0e03db02
parent 4986 8431f59485d0
child 4988 f9af88a9c823
Set blend mode for textures that were created from surfaces with a colorkey
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Wed Jan 12 15:42:26 2011 -0800
     1.2 +++ b/src/video/SDL_video.c	Wed Jan 12 15:58:53 2011 -0800
     1.3 @@ -1988,8 +1988,13 @@
     1.4          SDL_GetSurfaceAlphaMod(surface, &a);
     1.5          SDL_SetTextureAlphaMod(texture, a);
     1.6  
     1.7 -        SDL_GetSurfaceBlendMode(surface, &blendMode);
     1.8 -        SDL_SetTextureBlendMode(texture, blendMode);
     1.9 +        if (surface->map->info.flags & SDL_COPY_COLORKEY) {
    1.10 +            /* We converted to a texture with alpha format */
    1.11 +            SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
    1.12 +        } else {
    1.13 +            SDL_GetSurfaceBlendMode(surface, &blendMode);
    1.14 +            SDL_SetTextureBlendMode(texture, blendMode);
    1.15 +        }
    1.16  
    1.17          SDL_GetSurfaceScaleMode(surface, &scaleMode);
    1.18          SDL_SetTextureScaleMode(texture, scaleMode);