diff src/video/win32/SDL_win32shape.c @ 4837:2e446923c9fb

Fixed lots of little bugs in Win32 shaping and in SDL_CalculateShapeTree(). Still not actually showing anything on Windows, though there's no crashes and everything compiles fine. Bugger.
author egottlieb
date Fri, 06 Aug 2010 20:22:14 -0400
parents 55f32099a4b5
children 05d172e92b52
line wrap: on
line diff
--- a/src/video/win32/SDL_win32shape.c	Fri Aug 06 13:52:38 2010 -0400
+++ b/src/video/win32/SDL_win32shape.c	Fri Aug 06 20:22:14 2010 -0400
@@ -20,6 +20,7 @@
     eligottlieb@gmail.com
 */
 
+#include "SDL_assert.h"
 #include "SDL_win32shape.h"
 #include "SDL_win32video.h"
 
@@ -43,9 +44,12 @@
 
 void CombineRectRegions(SDL_ShapeTree* node, void* closure) {
 	HRGN* mask_region = (HRGN *)closure;
+	int combined = -1;
 	if(node->kind == OpaqueShape) {
 		HRGN temp_region = CreateRectRgn(node->data.shape.x,node->data.shape.y,node->data.shape.w,node->data.shape.h);
-		CombineRgn(*mask_region,*mask_region,temp_region, RGN_OR);
+		SDL_assert(temp_region != NULL);
+		combined = CombineRgn(*mask_region,*mask_region,temp_region, RGN_OR);
+		SDL_assert(combined == SIMPLEREGION || combined == COMPLEXREGION);
 		DeleteObject(temp_region);
 	}
 }
@@ -64,7 +68,7 @@
 	data = (SDL_ShapeData*)shaper->driverdata;
 	if(data->mask_tree != NULL)
 		SDL_FreeShapeTree(&data->mask_tree);
-	data->mask_tree = SDL_CalculateShapeTree(*shapeMode,shape,SDL_FALSE);
+	data->mask_tree = SDL_CalculateShapeTree(*shapeMode,shape);
 	
 	/*
 	 * Start with empty region 
@@ -78,7 +82,7 @@
 	 */
 	windowdata=(SDL_WindowData *)(shaper->window->driverdata);
 	hwnd = windowdata->hwnd;
-	SetWindowRgn(hwnd, mask_region, TRUE);
+	SDL_assert(SetWindowRgn(hwnd, mask_region, TRUE) != 0);
 	
 	return 0;
 }