diff src/video/win32/SDL_win32shape.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/win32/SDL_win32shape.c	Tue Jul 20 12:42:43 2010 -0400
+++ b/src/video/win32/SDL_win32shape.c	Thu Jul 22 23:11:01 2010 -0400
@@ -26,7 +26,8 @@
 SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window) {
 	SDL_WindowShaper* result = malloc(sizeof(SDL_WindowShaper));
 	result->window = window;
-	result->alphacutoff = 0;
+	result->mode.mode = ShapeModeDefault;
+	result->mode.parameters.binarizationCutoff = 1;
 	result->usershownflag = 0;
 	//Put some driver-data here.
 	window->shaper = result;
@@ -42,7 +43,6 @@
 	if(shape->w != shaper->window->w || shape->h != shaper->window->h)
 		return -3;
 	
-	/* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
 	/*
 	 * Start with empty region 
 	 */
@@ -57,7 +57,7 @@
 	/*
 	 * Transfer binarized mask image into workbuffer 
 	 */
-	SDL_CalculateShapeBitmap(shaper->alphacutoff,shape,data->shapebuffer,1,0xff);
+	SDL_CalculateShapeBitmap(shaper->mode,shape,data->shapebuffer,1,0xff);
 	
 	//Move code over to here from AW_windowShape.c
 	Uint8 *pos1 = data->shapebuffer + width - 1;
@@ -338,6 +338,8 @@
 			return -1;
 		}
 	}
+	else
+		memset(data->shapebuffer,0,data->buffersize);
 	
 	window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN;