diff test/testshape.c @ 4817:c68e7490e4cf

Fixed a couple of bugs in the general and X11 shape code, and fixed a bug in testshape that was keeping it from recognizing surfaces without alpha. Thanks to Andreas's bit-bashing tip, X11 shaped windows now work entirely, AFAICT.
author Eli Gottlieb <eligottlieb@gmail.com>
date Sun, 01 Aug 2010 21:10:42 -0400
parents eb433f0d2ac5
children 2e446923c9fb
line wrap: on
line diff
--- a/test/testshape.c	Fri Jul 30 18:04:21 2010 -0400
+++ b/test/testshape.c	Sun Aug 01 21:10:42 2010 -0400
@@ -43,7 +43,7 @@
 	Uint8 num_pictures;
 	LoadedPicture* pictures;
 	int i, j;
-	SDL_PixelFormat* format;
+	SDL_PixelFormat* format = NULL;
 	Uint32 format_enum;
 	SDL_Window *window;
 	SDL_Color black = {0,0,0,0xff};
@@ -52,8 +52,8 @@
 	int should_exit = 0;
 	unsigned int current_picture;
 	int button_down;
-	Uint32 pixelFormat;
-	int access;
+	Uint32 pixelFormat = 0;
+	int access = 0;
 	SDL_Rect texture_dimensions;;
 
 	if(argc < 2) {
@@ -84,8 +84,7 @@
 		}
 
 		format = pictures[i].surface->format;
-		format_enum = SDL_MasksToPixelFormatEnum (format->BitsPerPixel,format->Rmask,format->Gmask, format->Bmask,format->Amask);
-		if(SDL_ISPIXELFORMAT_ALPHA(format_enum)) {
+		if(format->Amask != 0) {
 			pictures[i].mode.mode = ShapeModeBinarizeAlpha;
 			pictures[i].mode.parameters.binarizationCutoff = 1;
 		}
@@ -139,7 +138,6 @@
 	event_pending = SDL_PollEvent(&event);
 	current_picture = 0;
 	button_down = 0;
-	format = 0,access = 0;
 	texture_dimensions.h = 0;
 	texture_dimensions.w = 0;
 	texture_dimensions.x = 0;