diff src/video/SDL_surface.c @ 1052:68f607298ca9

Some work on using accelerated alpha blits with hardware surfaces. From Stephane Marchesin's fork, don't know who originally wrote it.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 17 Apr 2005 10:40:41 +0000
parents c2f2370ac1e5
children 91569ec25acd
line wrap: on
line diff
--- a/src/video/SDL_surface.c	Sun Apr 17 10:36:03 2005 +0000
+++ b/src/video/SDL_surface.c	Sun Apr 17 10:40:41 2005 +0000
@@ -91,11 +91,22 @@
 	}
 	surface->flags = SDL_SWSURFACE;
 	if ( (flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
-		depth = screen->format->BitsPerPixel;
-		Rmask = screen->format->Rmask;
-		Gmask = screen->format->Gmask;
-		Bmask = screen->format->Bmask;
-		Amask = screen->format->Amask;
+		if ((Amask) && (video->displayformatalphapixel))
+		{
+			depth = video->displayformatalphapixel->BitsPerPixel;
+			Rmask = video->displayformatalphapixel->Rmask;
+			Gmask = video->displayformatalphapixel->Gmask;
+			Bmask = video->displayformatalphapixel->Bmask;
+			Amask = video->displayformatalphapixel->Amask;
+		}
+		else
+		{
+			depth = screen->format->BitsPerPixel;
+			Rmask = screen->format->Rmask;
+			Gmask = screen->format->Gmask;
+			Bmask = screen->format->Bmask;
+			Amask = screen->format->Amask;
+		}
 	}
 	surface->format = SDL_AllocFormat(depth, Rmask, Gmask, Bmask, Amask);
 	if ( surface->format == NULL ) {