Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32shape.c @ 4844:c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
author | egottlieb |
---|---|
date | Tue, 10 Aug 2010 15:39:46 -0400 |
parents | 05d172e92b52 |
children | 40b46225e3cf |
rev | line source |
---|---|
4777
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
1 /* |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
3 Copyright (C) 2010 Eli Gottlieb |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
4 |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
9 |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
14 |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
18 |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
19 Eli Gottlieb |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
20 eligottlieb@gmail.com |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
21 */ |
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
22 |
4822
55f32099a4b5
Worked on Windows implementation and the quad-trees.
egottlieb
parents:
4815
diff
changeset
|
23 #include "SDL_win32shape.h" |
4815
93402b9dd20c
Added Andreas's patch to fix my silly C++-style errors.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4813
diff
changeset
|
24 #include "SDL_win32video.h" |
4785
ef8b32ef9793
Updated test code, updated win32 code a bit (still not complete, but hopefully tonight), and removed the last vestiges of ellipse and polygon drawing support.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4777
diff
changeset
|
25 |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
26 SDL_WindowShaper* |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
27 Win32_CreateShaper(SDL_Window * window) { |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
28 int resized_properly; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
29 SDL_WindowShaper* result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
30 result->window = window; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
31 result->mode.mode = ShapeModeDefault; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
32 result->mode.parameters.binarizationCutoff = 1; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
33 result->usershownflag = 0; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
34 result->driverdata = (SDL_ShapeData*)SDL_malloc(sizeof(SDL_ShapeData)); |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
35 ((SDL_ShapeData*)result->driverdata)->mask_tree = NULL; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
36 //Put some driver-data here. |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
37 window->shaper = result; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
38 resized_properly = Win32_ResizeWindowShape(window); |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
39 if (resized_properly != 0) |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
40 return NULL; |
4815
93402b9dd20c
Added Andreas's patch to fix my silly C++-style errors.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4813
diff
changeset
|
41 |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
42 return result; |
4785
ef8b32ef9793
Updated test code, updated win32 code a bit (still not complete, but hopefully tonight), and removed the last vestiges of ellipse and polygon drawing support.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4777
diff
changeset
|
43 } |
4777
6e03d73054d7
Fixed names of driver-specific implementation files.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff
changeset
|
44 |
4844
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
45 typedef struct { |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
46 POINT corners[4]; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
47 void* next; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
48 } SDL_ShapeRect; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
49 |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
50 void |
4844
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
51 CombineRectRegions(SDL_ShapeTree* node,void* closure) { |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
52 SDL_ShapeRect* rect_list = *((SDL_ShapeRect**)closure); |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
53 if(node->kind == OpaqueShape) { |
4844
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
54 SDL_ShapeRect* rect = SDL_malloc(sizeof(SDL_ShapeRect)); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
55 rect->corners[0].x = node->data.shape.x; rect->corners[0].y = node->data.shape.y; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
56 rect->corners[1].x = node->data.shape.x + node->data.shape.w; rect->corners[1].y = node->data.shape.y; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
57 rect->corners[2].x = node->data.shape.x + node->data.shape.w; rect->corners[2].y = node->data.shape.y + node->data.shape.h; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
58 rect->corners[3].x = node->data.shape.x; rect->corners[3].y = node->data.shape.y + node->data.shape.h; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
59 rect->next = *((SDL_ShapeRect**)closure); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
60 *((SDL_ShapeRect**)closure) = rect; |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
61 } |
4813
5b4c7d7d8953
Wrote out the system for breaking shape-masks into quad-trees of rectangles, and added code to conglomerate those quad-trees of rectangles into regions for setting shapes under Win32.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4809
diff
changeset
|
62 } |
5b4c7d7d8953
Wrote out the system for breaking shape-masks into quad-trees of rectangles, and added code to conglomerate those quad-trees of rectangles into regions for setting shapes under Win32.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4809
diff
changeset
|
63 |
4844
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
64 Uint32 num_shape_rects(SDL_ShapeRect* rect) { |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
65 if(rect == NULL) |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
66 return 0; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
67 else |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
68 return 1 + num_shape_rects(rect->next); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
69 } |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
70 |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
71 int |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
72 Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
73 SDL_ShapeData *data; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
74 HRGN mask_region; |
4844
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
75 SDL_ShapeRect* rects = NULL,*old = NULL; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
76 Uint16 num_rects = 0,i = 0; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
77 int* polygonVertexNumbers = NULL; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
78 POINT* polygons = NULL; |
4815
93402b9dd20c
Added Andreas's patch to fix my silly C++-style errors.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4813
diff
changeset
|
79 |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
80 if (shaper == NULL || shape == NULL) |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
81 return SDL_INVALID_SHAPE_ARGUMENT; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
82 if(shape->format->Amask == 0 && shapeMode->mode != ShapeModeColorKey || shape->w != shaper->window->w || shape->h != shaper->window->h) |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
83 return SDL_INVALID_SHAPE_ARGUMENT; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
84 |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
85 data = (SDL_ShapeData*)shaper->driverdata; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
86 if(data->mask_tree != NULL) |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
87 SDL_FreeShapeTree(&data->mask_tree); |
4844
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
88 data->mask_tree = SDL_CalculateShapeTree(*shapeMode,shape); |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
89 |
4844
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
90 SDL_TraverseShapeTree(data->mask_tree,&CombineRectRegions,&rects); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
91 num_rects = num_shape_rects(rects); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
92 polygonVertexNumbers = (int*)SDL_malloc(sizeof(int)*num_rects); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
93 for(i=0;i<num_rects;i++) |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
94 polygonVertexNumbers[i] = 4; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
95 polygons = (POINT*)SDL_malloc(sizeof(POINT)*4*num_rects); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
96 for(i=0;i<num_rects*4;i++) { |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
97 polygons[i] = rects[i / 4].corners[i % 4]; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
98 if(i % 4 == 3) { |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
99 old = rects; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
100 rects = rects->next; |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
101 SDL_free(old); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
102 } |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
103 } |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
104 |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
105 /* |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
106 * Set the new region mask for the window |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
107 */ |
4844
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
108 mask_region = CreatePolyPolygonRgn(polygons,polygonVertexNumbers,num_rects,WINDING); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
109 SetWindowRgn(((SDL_WindowData *)(shaper->window->driverdata))->hwnd, mask_region, TRUE); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
110 |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
111 SDL_free(polygons); |
c4f5bcaf7572
Switched over to poly-polygon region building and shape-tree traversal for Win32.
egottlieb
parents:
4839
diff
changeset
|
112 SDL_free(polygonVertexNumbers); |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
113 |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
114 return 0; |
4785
ef8b32ef9793
Updated test code, updated win32 code a bit (still not complete, but hopefully tonight), and removed the last vestiges of ellipse and polygon drawing support.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4777
diff
changeset
|
115 } |
ef8b32ef9793
Updated test code, updated win32 code a bit (still not complete, but hopefully tonight), and removed the last vestiges of ellipse and polygon drawing support.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4777
diff
changeset
|
116 |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
117 int |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
118 Win32_ResizeWindowShape(SDL_Window *window) { |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
119 SDL_ShapeData* data; |
4815
93402b9dd20c
Added Andreas's patch to fix my silly C++-style errors.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4813
diff
changeset
|
120 |
4838
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
121 if (window == NULL) |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
122 return -1; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
123 data = (SDL_ShapeData *)window->shaper->driverdata; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
124 if (data == NULL) |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
125 return -1; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
126 |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
127 if(data->mask_tree != NULL) |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
128 SDL_FreeShapeTree(&data->mask_tree); |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
129 |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
130 window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN; |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
131 |
1f9915666afd
Reformatting code to match the rest of SDL. Variable names seem OK; replaced tabs with 4 spaces each for indentation.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4822
diff
changeset
|
132 return 0; |
4785
ef8b32ef9793
Updated test code, updated win32 code a bit (still not complete, but hopefully tonight), and removed the last vestiges of ellipse and polygon drawing support.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
4777
diff
changeset
|
133 } |