Added in Visual Studio patch.
authorEli Gottlieb
Thu, 15 Jul 2010 01:41:38 -0400
changeset 4796e8caf178d082
parent 4795 6f0bc179771c
child 4797 2a71f02323c7
Added in Visual Studio patch.
VisualC/SDL_VS2010.sln
src/video/SDL_shape.c
     1.1 --- a/VisualC/SDL_VS2010.sln	Wed Jul 14 00:49:28 2010 -0400
     1.2 +++ b/VisualC/SDL_VS2010.sln	Thu Jul 15 01:41:38 2010 -0400
     1.3 @@ -2,9 +2,9 @@
     1.4  # Visual Studio 2010
     1.5  Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{CE748C1F-3C21-4825-AA6A-F895A023F7E7}"
     1.6  EndProject
     1.7 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL_VS2008.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
     1.8 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL_VS2010.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
     1.9  EndProject
    1.10 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain_VS2008.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
    1.11 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain_VS2010.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
    1.12  EndProject
    1.13  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "automated", "tests\automated\automated.vcxproj", "{DDD710DB-EC7B-4CCB-BD75-535D401A2FE0}"
    1.14  EndProject
     2.1 --- a/src/video/SDL_shape.c	Wed Jul 14 00:49:28 2010 -0400
     2.2 +++ b/src/video/SDL_shape.c	Thu Jul 15 01:41:38 2010 -0400
     2.3 @@ -30,11 +30,21 @@
     2.4  
     2.5  SDL_Window* SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
     2.6  	SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,SDL_WINDOW_BORDERLESS | flags & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
     2.7 -	result->shaper = result->display->device->shape_driver.CreateShaper(result);
     2.8 -	result->shaper->usershownflag = flags & SDL_WINDOW_SHOWN;
     2.9 -	result->shaper->alphacutoff = 1;
    2.10 -	result->shaper->hasshape = SDL_FALSE;
    2.11 -	return result;
    2.12 +	if(result != NULL) {
    2.13 +		result->shaper = result->display->device->shape_driver.CreateShaper(result);
    2.14 +		if(result->shaper != NULL) {
    2.15 +			result->shaper->usershownflag = flags & SDL_WINDOW_SHOWN;
    2.16 +			result->shaper->alphacutoff = 1;
    2.17 +			result->shaper->hasshape = SDL_FALSE;
    2.18 +			return result;
    2.19 +		}
    2.20 +		else {
    2.21 +			SDL_DestroyWindow(result);
    2.22 +			return NULL;
    2.23 +		}
    2.24 +	}
    2.25 +	else
    2.26 +		return NULL;
    2.27  }
    2.28  
    2.29  SDL_bool SDL_IsShapedWindow(const SDL_Window *window) {
    2.30 @@ -55,10 +65,10 @@
    2.31  		SDL_LockSurface(shape);
    2.32  	for(x = 0;x<shape->w;x++)
    2.33  		for(y = 0;y<shape->h;y++) {
    2.34 -			pixel = shape->pixels + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
    2.35 +			pixel = (Uint8 *)(shape->pixels) + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
    2.36  			alpha = 0;
    2.37  			SDL_GetRGBA(*(Uint32*)pixel,shape->format,&r,&g,&b,&alpha);
    2.38 -			Uint32 bitmap_pixel = y*shape->w + x;
    2.39 +			bitmap_pixel = y*shape->w + x;
    2.40  			bitmap[bitmap_pixel / ppb] |= (alpha >= alphacutoff ? value : 0) << ((ppb - 1) - (bitmap_pixel % ppb));
    2.41  		}
    2.42  	if(SDL_MUSTLOCK(shape))