diff src/video/x11/SDL_x11shape.c @ 4787:e25ad8d97027

Ported over, to the best of my ability, the code for Win32 shaped windows and patched in the correct C syntax and coding conventions of SDL.
author Eli Gottlieb <eligottlieb@gmail.com>
date Thu, 08 Jul 2010 22:52:49 -0400
parents 175da36d1342
children a6bc01875d20
line wrap: on
line diff
--- a/src/video/x11/SDL_x11shape.c	Wed Jul 07 16:20:54 2010 -0400
+++ b/src/video/x11/SDL_x11shape.c	Thu Jul 08 22:52:49 2010 -0400
@@ -63,13 +63,13 @@
 }
 	
 int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) {
-	assert(shaper != NULL && shape != NULL);
+	if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
+		return -1;
 	if(!SDL_ISPIXELFORMAT_ALPHA(SDL_MasksToPixelFormatEnum(shape->format->BitsPerPixel,shape->format->Rmask,shape->format->Gmask,shape->format->Bmask,shape->format->Amask)))
 		return -2;
 	if(shape->w != shaper->window->w || shape->h != shaper->window->h)
 		return -3;
 	SDL_ShapeData *data = shaper->driverdata;
-	assert(data != NULL);
 	
 	/* 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);