Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32shape.c @ 4822:55f32099a4b5
Worked on Windows implementation and the quad-trees.
author | egottlieb |
---|---|
date | Mon, 02 Aug 2010 01:54:59 -0400 |
parents | 93402b9dd20c |
children | 2e446923c9fb 1f9915666afd |
comparison
equal
deleted
inserted
replaced
4821:1fd1b7a2ba8b | 4822:55f32099a4b5 |
---|---|
28 SDL_WindowShaper* result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); | 28 SDL_WindowShaper* result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); |
29 result->window = window; | 29 result->window = window; |
30 result->mode.mode = ShapeModeDefault; | 30 result->mode.mode = ShapeModeDefault; |
31 result->mode.parameters.binarizationCutoff = 1; | 31 result->mode.parameters.binarizationCutoff = 1; |
32 result->usershownflag = 0; | 32 result->usershownflag = 0; |
33 result->driverdata = (SDL_ShapeData*)SDL_malloc(sizeof(SDL_ShapeData)); | |
34 ((SDL_ShapeData*)result->driverdata)->mask_tree = NULL; | |
33 //Put some driver-data here. | 35 //Put some driver-data here. |
34 window->shaper = result; | 36 window->shaper = result; |
35 resized_properly = Win32_ResizeWindowShape(window); | 37 resized_properly = Win32_ResizeWindowShape(window); |
36 if (resized_properly != 0) | 38 if (resized_properly != 0) |
37 return NULL; | 39 return NULL; |
54 SDL_WindowData *windowdata; | 56 SDL_WindowData *windowdata; |
55 HWND hwnd; | 57 HWND hwnd; |
56 | 58 |
57 if (shaper == NULL || shape == NULL) | 59 if (shaper == NULL || shape == NULL) |
58 return SDL_INVALID_SHAPE_ARGUMENT; | 60 return SDL_INVALID_SHAPE_ARGUMENT; |
59 if(!SDL_ISPIXELFORMAT_ALPHA(SDL_MasksToPixelFormatEnum(shape->format->BitsPerPixel,shape->format->Rmask,shape->format->Gmask,shape->format->Bmask,shape->format->Amask)) && shapeMode->mode != ShapeModeColorKey || shape->w != shaper->window->w || shape->h != shaper->window->h) | 61 if(shape->format->Amask == 0 && shapeMode->mode != ShapeModeColorKey || shape->w != shaper->window->w || shape->h != shaper->window->h) |
60 return SDL_INVALID_SHAPE_ARGUMENT; | 62 return SDL_INVALID_SHAPE_ARGUMENT; |
61 | 63 |
62 data = (SDL_ShapeData*)shaper->driverdata; | 64 data = (SDL_ShapeData*)shaper->driverdata; |
65 if(data->mask_tree != NULL) | |
66 SDL_FreeShapeTree(&data->mask_tree); | |
63 data->mask_tree = SDL_CalculateShapeTree(*shapeMode,shape,SDL_FALSE); | 67 data->mask_tree = SDL_CalculateShapeTree(*shapeMode,shape,SDL_FALSE); |
64 | 68 |
65 /* | 69 /* |
66 * Start with empty region | 70 * Start with empty region |
67 */ | 71 */ |