48 CombineRectRegions(SDL_ShapeTree* node,void* closure) { |
48 CombineRectRegions(SDL_ShapeTree* node,void* closure) { |
49 char debug_str[200]; |
49 char debug_str[200]; |
50 HRGN mask_region = *((HRGN*)closure),temp_region = NULL; |
50 HRGN mask_region = *((HRGN*)closure),temp_region = NULL; |
51 if(node->kind == OpaqueShape) { |
51 if(node->kind == OpaqueShape) { |
52 //Win32 API regions exclude their outline, so we widen the region by one pixel in each direction to include the real outline. |
52 //Win32 API regions exclude their outline, so we widen the region by one pixel in each direction to include the real outline. |
53 sprintf_s(&debug_str[0],200,"x: %u y: %u, x+w: %u, y+h: %u\n", |
53 /* sprintf_s(&debug_str[0],200,"x: %u y: %u, x+w: %u, y+h: %u\n", |
54 node->data.shape.x,node->data.shape.y, |
54 node->data.shape.x,node->data.shape.y, |
55 node->data.shape.x + node->data.shape.w,node->data.shape.y + node->data.shape.h); |
55 node->data.shape.x + node->data.shape.w,node->data.shape.y + node->data.shape.h);*/ |
56 OutputDebugStringA(debug_str); |
56 //OutputDebugStringA(debug_str); |
57 OutputDebugStringA("Converting SDL_ShapeTree opaque node to Windows rectangle.\n"); |
|
58 temp_region = CreateRectRgn(node->data.shape.x - 1,node->data.shape.y - 1,node->data.shape.x + node->data.shape.w + 1,node->data.shape.y + node->data.shape.h + 1); |
57 temp_region = CreateRectRgn(node->data.shape.x - 1,node->data.shape.y - 1,node->data.shape.x + node->data.shape.w + 1,node->data.shape.y + node->data.shape.h + 1); |
59 if(mask_region != NULL) { |
58 if(mask_region != NULL) { |
60 CombineRgn(mask_region,mask_region,temp_region,RGN_OR); |
59 CombineRgn(mask_region,mask_region,temp_region,RGN_OR); |
61 DeleteObject(temp_region); |
60 DeleteObject(temp_region); |
62 } |
61 } |
98 if (data == NULL) |
97 if (data == NULL) |
99 return -1; |
98 return -1; |
100 |
99 |
101 if(data->mask_tree != NULL) |
100 if(data->mask_tree != NULL) |
102 SDL_FreeShapeTree(&data->mask_tree); |
101 SDL_FreeShapeTree(&data->mask_tree); |
103 |
102 if(window->shaper->hasshape == SDL_TRUE) { |
104 window->shaper->userx = window->x; |
103 window->shaper->userx = window->x; |
105 window->shaper->usery = window->y; |
104 window->shaper->usery = window->y; |
106 SDL_SetWindowPosition(window,-1000,-1000); |
105 SDL_SetWindowPosition(window,-1000,-1000); |
|
106 } |
107 |
107 |
108 return 0; |
108 return 0; |
109 } |
109 } |