src/SDL_compat.c
changeset 2838 00356f22195a
parent 2831 7173fc5c7ef6
child 2852 7046f9567045
--- a/src/SDL_compat.c	Sat Dec 06 05:49:08 2008 +0000
+++ b/src/SDL_compat.c	Sat Dec 06 05:49:53 2008 +0000
@@ -686,16 +686,19 @@
 int
 SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
 {
-    if (flag & SDL_RLEACCEL) {
-        SDL_SetSurfaceRLE(surface, 1);
-    }
-    if (flag) {
+    if (flag & SDL_SRCALPHA) {
+        /* According to the docs, value is ignored for alpha surfaces */
+        if (surface->format->Amask) {
+            value = 0xFF;
+        }
         SDL_SetSurfaceAlphaMod(surface, value);
         SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
     } else {
         SDL_SetSurfaceAlphaMod(surface, 0xFF);
         SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_NONE);
     }
+    SDL_SetSurfaceRLE(surface, (flag & SDL_RLEACCEL));
+
     return 0;
 }