diff src/video/SDL_shape.c @ 4785:ef8b32ef9793

Updated test code, updated win32 code a bit (still not complete, but hopefully tonight), and removed the last vestiges of ellipse and polygon drawing support.
author Eli Gottlieb <eligottlieb@gmail.com>
date Tue, 06 Jul 2010 22:05:22 -0400
parents b6930aefd008
children 175da36d1342
line wrap: on
line diff
--- a/src/video/SDL_shape.c	Fri Jul 02 12:05:47 2010 -0400
+++ b/src/video/SDL_shape.c	Tue Jul 06 22:05:22 2010 -0400
@@ -45,7 +45,7 @@
 }
 
 /* REQUIRES that bitmap point to a w-by-h bitmap with 1bpp. */
-void SDL_CalculateShapeBitmap(Uint8 alphacutoff,SDL_Surface *shape,Uint8* bitmap) {
+void SDL_CalculateShapeBitmap(Uint8 alphacutoff,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb,Uint8 value) {
 	if(SDL_MUSTLOCK(shape))
 		SDL_LockSurface(shape);
 	int x = 0,y = 0;
@@ -55,7 +55,7 @@
 			Uint8 alpha = 0;
 			SDL_GetRGBA(*(Uint32*)pixel,shape->format,NULL,NULL,NULL,&alpha);
 			Uint32 bitmap_pixel = y*shape->w + x;
-			bitmap[bitmap_pixel / 8] |= (alpha >= alphacutoff ? 1 : 0) << (8 - (bitmap_pixel % 8));
+			bitmap[bitmap_pixel / ppb] |= (alpha >= alphacutoff ? value : 0) << ((ppb - 1) - (bitmap_pixel % ppb));
 		}
 	if(SDL_MUSTLOCK(shape))
 		SDL_UnlockSurface(shape);
@@ -81,7 +81,7 @@
 			}
 		}
 	}
-	//TODO: Platform-specific implementations of SetWindowShape.  X11 is in-progress.
+	//TODO: Platform-specific implementations of SetWindowShape.  X11 is finished.  Win32 is in progress.
 	int result = window->display->device->shape_driver.SetWindowShape(window->shaper,shape,shapeMode);
 	window->shaper->hasshape = SDL_TRUE;
 	if(window->shaper->usershownflag & SDL_WINDOW_SHOWN == SDL_WINDOW_SHOWN) {