diff src/video/x11/SDL_x11shape.c @ 4807:c9eb95f29770

Added color-key mode and redid the code to work with it.
author Eli Gottlieb <eligottlieb@gmail.com>
date Thu, 22 Jul 2010 23:11:01 -0400
parents f14a8c05f5bb
children 329708ffe2a7
line wrap: on
line diff
--- a/src/video/x11/SDL_x11shape.c	Tue Jul 20 12:42:43 2010 -0400
+++ b/src/video/x11/SDL_x11shape.c	Thu Jul 22 23:11:01 2010 -0400
@@ -32,7 +32,8 @@
 	if (SDL_X11_HAVE_XSHAPE) {  /* Make sure X server supports it. */
 		result = malloc(sizeof(SDL_WindowShaper));
 		result->window = window;
-		result->alphacutoff = 0;
+		result->mode.mode = ShapeModeDefault;
+		result->mode.parameters.binarizationCutoff = 1;
 		result->usershownflag = 0;
 		SDL_ShapeData* data = malloc(sizeof(SDL_ShapeData));
 		result->driverdata = data;
@@ -65,6 +66,8 @@
 			return -1;
 		}
 	}
+	else
+		memset(data->bitmap,0,data->bitmapsize);
 	
 	window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN;
 	
@@ -83,7 +86,7 @@
 	SDL_ShapeData *data = shaper->driverdata;
 	
 	/* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
-	SDL_CalculateShapeBitmap(shaper->alphacutoff,shape,data->bitmap,8,1);
+	SDL_CalculateShapeBitmap(shaper->mode,shape,data->bitmap,8,1);
 		
 	SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata);
 	Pixmap shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);