Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32shape.c @ 4837:2e446923c9fb
Fixed lots of little bugs in Win32 shaping and in SDL_CalculateShapeTree(). Still not actually showing anything on Windows, though there's no crashes and everything compiles fine. Bugger.
author | egottlieb |
---|---|
date | Fri, 06 Aug 2010 20:22:14 -0400 |
parents | 55f32099a4b5 |
children | 05d172e92b52 |
comparison
equal
deleted
inserted
replaced
4836:7eb8ca721a5b | 4837:2e446923c9fb |
---|---|
18 | 18 |
19 Eli Gottlieb | 19 Eli Gottlieb |
20 eligottlieb@gmail.com | 20 eligottlieb@gmail.com |
21 */ | 21 */ |
22 | 22 |
23 #include "SDL_assert.h" | |
23 #include "SDL_win32shape.h" | 24 #include "SDL_win32shape.h" |
24 #include "SDL_win32video.h" | 25 #include "SDL_win32video.h" |
25 | 26 |
26 SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window) { | 27 SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window) { |
27 int resized_properly; | 28 int resized_properly; |
41 return result; | 42 return result; |
42 } | 43 } |
43 | 44 |
44 void CombineRectRegions(SDL_ShapeTree* node, void* closure) { | 45 void CombineRectRegions(SDL_ShapeTree* node, void* closure) { |
45 HRGN* mask_region = (HRGN *)closure; | 46 HRGN* mask_region = (HRGN *)closure; |
47 int combined = -1; | |
46 if(node->kind == OpaqueShape) { | 48 if(node->kind == OpaqueShape) { |
47 HRGN temp_region = CreateRectRgn(node->data.shape.x,node->data.shape.y,node->data.shape.w,node->data.shape.h); | 49 HRGN temp_region = CreateRectRgn(node->data.shape.x,node->data.shape.y,node->data.shape.w,node->data.shape.h); |
48 CombineRgn(*mask_region,*mask_region,temp_region, RGN_OR); | 50 SDL_assert(temp_region != NULL); |
51 combined = CombineRgn(*mask_region,*mask_region,temp_region, RGN_OR); | |
52 SDL_assert(combined == SIMPLEREGION || combined == COMPLEXREGION); | |
49 DeleteObject(temp_region); | 53 DeleteObject(temp_region); |
50 } | 54 } |
51 } | 55 } |
52 | 56 |
53 int Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { | 57 int Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { |
62 return SDL_INVALID_SHAPE_ARGUMENT; | 66 return SDL_INVALID_SHAPE_ARGUMENT; |
63 | 67 |
64 data = (SDL_ShapeData*)shaper->driverdata; | 68 data = (SDL_ShapeData*)shaper->driverdata; |
65 if(data->mask_tree != NULL) | 69 if(data->mask_tree != NULL) |
66 SDL_FreeShapeTree(&data->mask_tree); | 70 SDL_FreeShapeTree(&data->mask_tree); |
67 data->mask_tree = SDL_CalculateShapeTree(*shapeMode,shape,SDL_FALSE); | 71 data->mask_tree = SDL_CalculateShapeTree(*shapeMode,shape); |
68 | 72 |
69 /* | 73 /* |
70 * Start with empty region | 74 * Start with empty region |
71 */ | 75 */ |
72 mask_region = CreateRectRgn(0, 0, 0, 0); | 76 mask_region = CreateRectRgn(0, 0, 0, 0); |
76 /* | 80 /* |
77 * Set the new region mask for the window | 81 * Set the new region mask for the window |
78 */ | 82 */ |
79 windowdata=(SDL_WindowData *)(shaper->window->driverdata); | 83 windowdata=(SDL_WindowData *)(shaper->window->driverdata); |
80 hwnd = windowdata->hwnd; | 84 hwnd = windowdata->hwnd; |
81 SetWindowRgn(hwnd, mask_region, TRUE); | 85 SDL_assert(SetWindowRgn(hwnd, mask_region, TRUE) != 0); |
82 | 86 |
83 return 0; | 87 return 0; |
84 } | 88 } |
85 | 89 |
86 int Win32_ResizeWindowShape(SDL_Window *window) { | 90 int Win32_ResizeWindowShape(SDL_Window *window) { |