Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
4786:175da36d1342 | 4787:e25ad8d97027 |
---|---|
61 | 61 |
62 return 0; | 62 return 0; |
63 } | 63 } |
64 | 64 |
65 int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { | 65 int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { |
66 assert(shaper != NULL && shape != NULL); | 66 if(shaper == NULL || shape == NULL || shaper->driverdata == NULL) |
67 return -1; | |
67 if(!SDL_ISPIXELFORMAT_ALPHA(SDL_MasksToPixelFormatEnum(shape->format->BitsPerPixel,shape->format->Rmask,shape->format->Gmask,shape->format->Bmask,shape->format->Amask))) | 68 if(!SDL_ISPIXELFORMAT_ALPHA(SDL_MasksToPixelFormatEnum(shape->format->BitsPerPixel,shape->format->Rmask,shape->format->Gmask,shape->format->Bmask,shape->format->Amask))) |
68 return -2; | 69 return -2; |
69 if(shape->w != shaper->window->w || shape->h != shaper->window->h) | 70 if(shape->w != shaper->window->w || shape->h != shaper->window->h) |
70 return -3; | 71 return -3; |
71 SDL_ShapeData *data = shaper->driverdata; | 72 SDL_ShapeData *data = shaper->driverdata; |
72 assert(data != NULL); | |
73 | 73 |
74 /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */ | 74 /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */ |
75 SDL_CalculateShapeBitmap(shaper->alphacutoff,shape,data->bitmap,8,1); | 75 SDL_CalculateShapeBitmap(shaper->alphacutoff,shape,data->bitmap,8,1); |
76 | 76 |
77 SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata); | 77 SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata); |