src/SDL_compat.c
changeset 2266 e61ad15a205f
parent 2240 eebaa05f8bd9
child 2267 c785543d1843
--- a/src/SDL_compat.c	Fri Aug 17 06:58:20 2007 +0000
+++ b/src/SDL_compat.c	Sat Aug 18 01:44:21 2007 +0000
@@ -589,6 +589,22 @@
     return SDL_PublicSurface;
 }
 
+int
+SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
+{
+    if (flag & SDL_RLEACCEL) {
+        SDL_SetSurfaceRLE(surface, 1);
+    }
+    if (flag) {
+        SDL_SetSurfaceAlphaMod(surface, value);
+        SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
+    } else {
+        SDL_SetSurfaceAlphaMod(surface, 0xFF);
+        SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_NONE);
+    }
+    return 0;
+}
+
 SDL_Surface *
 SDL_DisplayFormat(SDL_Surface * surface)
 {
@@ -600,15 +616,7 @@
     }
 
     /* Set the flags appropriate for copying to display surface */
-    flags = SDL_SWSURFACE;
-#ifdef AUTORLE_DISPLAYFORMAT
-    flags |= (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA));
-    flags |= SDL_RLEACCELOK;
-#else
-    flags |=
-        surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA | SDL_RLEACCELOK);
-#endif
-    return SDL_ConvertSurface(surface, SDL_PublicSurface->format, flags);
+    return SDL_ConvertSurface(surface, SDL_PublicSurface->format, SDL_RLEACCELOK);
 }
 
 SDL_Surface *
@@ -658,8 +666,7 @@
         break;
     }
     format = SDL_AllocFormat(32, rmask, gmask, bmask, amask);
-    flags = surface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
-    converted = SDL_ConvertSurface(surface, format, flags);
+    converted = SDL_ConvertSurface(surface, format, SDL_RLEACCELOK);
     SDL_FreeFormat(format);
     return converted;
 }