changeset 4987:b68a0e03db02

Set blend mode for textures that were created from surfaces with a colorkey
author Sam Lantinga <slouken@libsdl.org>
date Wed, 12 Jan 2011 15:58:53 -0800
parents 8431f59485d0
children f9af88a9c823
files src/video/SDL_video.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_video.c	Wed Jan 12 15:42:26 2011 -0800
+++ b/src/video/SDL_video.c	Wed Jan 12 15:58:53 2011 -0800
@@ -1988,8 +1988,13 @@
         SDL_GetSurfaceAlphaMod(surface, &a);
         SDL_SetTextureAlphaMod(texture, a);
 
-        SDL_GetSurfaceBlendMode(surface, &blendMode);
-        SDL_SetTextureBlendMode(texture, blendMode);
+        if (surface->map->info.flags & SDL_COPY_COLORKEY) {
+            /* We converted to a texture with alpha format */
+            SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
+        } else {
+            SDL_GetSurfaceBlendMode(surface, &blendMode);
+            SDL_SetTextureBlendMode(texture, blendMode);
+        }
 
         SDL_GetSurfaceScaleMode(surface, &scaleMode);
         SDL_SetTextureScaleMode(texture, scaleMode);