Mercurial > sdl-ios-xcode
comparison src/video/picogui/SDL_pgvideo.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | 8d9bb0cf2c2a |
children | 4da1ee79c9af |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
34 #include "SDL_pgevents_c.h" | 34 #include "SDL_pgevents_c.h" |
35 | 35 |
36 #define PGVID_DRIVER_NAME "picogui" | 36 #define PGVID_DRIVER_NAME "picogui" |
37 | 37 |
38 /* Initialization/Query functions */ | 38 /* Initialization/Query functions */ |
39 static int PG_VideoInit(_THIS, SDL_PixelFormat *vformat); | 39 static int PG_VideoInit (_THIS, SDL_PixelFormat * vformat); |
40 static SDL_Rect **PG_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); | 40 static SDL_Rect **PG_ListModes (_THIS, SDL_PixelFormat * format, |
41 static SDL_Surface *PG_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | 41 Uint32 flags); |
42 static int PG_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); | 42 static SDL_Surface *PG_SetVideoMode (_THIS, SDL_Surface * current, int width, |
43 static void PG_VideoQuit(_THIS); | 43 int height, int bpp, Uint32 flags); |
44 static int PG_SetColors (_THIS, int firstcolor, int ncolors, | |
45 SDL_Color * colors); | |
46 static void PG_VideoQuit (_THIS); | |
44 | 47 |
45 /* Hardware surface functions */ | 48 /* Hardware surface functions */ |
46 static int PG_AllocHWSurface(_THIS, SDL_Surface *surface); | 49 static int PG_AllocHWSurface (_THIS, SDL_Surface * surface); |
47 static int PG_LockHWSurface(_THIS, SDL_Surface *surface); | 50 static int PG_LockHWSurface (_THIS, SDL_Surface * surface); |
48 static void PG_UnlockHWSurface(_THIS, SDL_Surface *surface); | 51 static void PG_UnlockHWSurface (_THIS, SDL_Surface * surface); |
49 static void PG_FreeHWSurface(_THIS, SDL_Surface *surface); | 52 static void PG_FreeHWSurface (_THIS, SDL_Surface * surface); |
50 | 53 |
51 /* etc. */ | 54 /* etc. */ |
52 static void PG_UpdateRects(_THIS, int numrects, SDL_Rect *rects); | 55 static void PG_UpdateRects (_THIS, int numrects, SDL_Rect * rects); |
53 | 56 |
54 // The implementation dependent data for the window manager cursor | 57 // The implementation dependent data for the window manager cursor |
55 struct WMcursor { | 58 struct WMcursor |
56 /* Our cursor is a PicoGUI theme */ | 59 { |
57 pghandle theme; | 60 /* Our cursor is a PicoGUI theme */ |
58 } ; | 61 pghandle theme; |
62 }; | |
59 | 63 |
60 /* WM functions */ | 64 /* WM functions */ |
61 void PG_SetCaption(_THIS, const char *title, const char *icon); | 65 void PG_SetCaption (_THIS, const char *title, const char *icon); |
62 WMcursor * PG_CreateWMCursor (_THIS,Uint8 * data, Uint8 * mask, | 66 WMcursor *PG_CreateWMCursor (_THIS, Uint8 * data, Uint8 * mask, |
63 int w, int h, int hot_x, int hot_y); | 67 int w, int h, int hot_x, int hot_y); |
64 void PG_FreeWMCursor (_THIS, WMcursor * cursor); | 68 void PG_FreeWMCursor (_THIS, WMcursor * cursor); |
65 void PG_WarpWMCursor(_THIS, Uint16 x, Uint16 y); | 69 void PG_WarpWMCursor (_THIS, Uint16 x, Uint16 y); |
66 int PG_ShowWMCursor (_THIS, WMcursor * cursor); | 70 int PG_ShowWMCursor (_THIS, WMcursor * cursor); |
67 | 71 |
68 /* PicoGUI driver bootstrap functions */ | 72 /* PicoGUI driver bootstrap functions */ |
69 | 73 |
70 static int PG_Available(void) | 74 static int |
71 { | 75 PG_Available (void) |
72 /* FIXME: The current client lib doesn't give a way to see if the picogui | 76 { |
73 * server is reachable without causing a fatal error if it isn't. | 77 /* FIXME: The current client lib doesn't give a way to see if the picogui |
74 * This should be fixed in cli_c2, but until then assume we can | 78 * server is reachable without causing a fatal error if it isn't. |
75 * connect. Since more common drivers like X11 are probed first anyway, | 79 * This should be fixed in cli_c2, but until then assume we can |
76 * this shouldn't be a huge problem. | 80 * connect. Since more common drivers like X11 are probed first anyway, |
77 */ | 81 * this shouldn't be a huge problem. |
78 return(1); | 82 */ |
79 } | 83 return (1); |
80 | 84 } |
81 static void PG_DeleteDevice(SDL_VideoDevice *device) | 85 |
82 { | 86 static void |
83 SDL_free(device->hidden); | 87 PG_DeleteDevice (SDL_VideoDevice * device) |
84 SDL_free(device); | 88 { |
85 } | 89 SDL_free (device->hidden); |
86 | 90 SDL_free (device); |
87 static SDL_VideoDevice *PG_CreateDevice(int devindex) | 91 } |
88 { | 92 |
89 SDL_VideoDevice *device; | 93 static SDL_VideoDevice * |
90 | 94 PG_CreateDevice (int devindex) |
91 /* Initialize all variables that we clean on shutdown */ | 95 { |
92 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); | 96 SDL_VideoDevice *device; |
93 if ( device ) { | 97 |
94 SDL_memset(device, 0, (sizeof *device)); | 98 /* Initialize all variables that we clean on shutdown */ |
95 device->hidden = (struct SDL_PrivateVideoData *) | 99 device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice)); |
96 SDL_malloc((sizeof *device->hidden)); | 100 if (device) { |
97 } | 101 SDL_memset (device, 0, (sizeof *device)); |
98 if ( (device == NULL) || (device->hidden == NULL) ) { | 102 device->hidden = (struct SDL_PrivateVideoData *) |
99 SDL_OutOfMemory(); | 103 SDL_malloc ((sizeof *device->hidden)); |
100 if ( device ) { | 104 } |
101 SDL_free(device); | 105 if ((device == NULL) || (device->hidden == NULL)) { |
102 } | 106 SDL_OutOfMemory (); |
103 return(0); | 107 if (device) { |
104 } | 108 SDL_free (device); |
105 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); | 109 } |
106 | 110 return (0); |
107 /* Set the function pointers */ | 111 } |
108 device->VideoInit = PG_VideoInit; | 112 SDL_memset (device->hidden, 0, (sizeof *device->hidden)); |
109 device->ListModes = PG_ListModes; | 113 |
110 device->SetVideoMode = PG_SetVideoMode; | 114 /* Set the function pointers */ |
111 device->CreateYUVOverlay = NULL; | 115 device->VideoInit = PG_VideoInit; |
112 device->SetColors = PG_SetColors; | 116 device->ListModes = PG_ListModes; |
113 device->UpdateRects = PG_UpdateRects; | 117 device->SetVideoMode = PG_SetVideoMode; |
114 device->VideoQuit = PG_VideoQuit; | 118 device->CreateYUVOverlay = NULL; |
115 device->AllocHWSurface = PG_AllocHWSurface; | 119 device->SetColors = PG_SetColors; |
116 device->CheckHWBlit = NULL; | 120 device->UpdateRects = PG_UpdateRects; |
117 device->FillHWRect = NULL; | 121 device->VideoQuit = PG_VideoQuit; |
118 device->SetHWColorKey = NULL; | 122 device->AllocHWSurface = PG_AllocHWSurface; |
119 device->SetHWAlpha = NULL; | 123 device->CheckHWBlit = NULL; |
120 device->LockHWSurface = PG_LockHWSurface; | 124 device->FillHWRect = NULL; |
121 device->UnlockHWSurface = PG_UnlockHWSurface; | 125 device->SetHWColorKey = NULL; |
122 device->FlipHWSurface = NULL; | 126 device->SetHWAlpha = NULL; |
123 device->FreeHWSurface = PG_FreeHWSurface; | 127 device->LockHWSurface = PG_LockHWSurface; |
124 device->SetCaption = PG_SetCaption; | 128 device->UnlockHWSurface = PG_UnlockHWSurface; |
125 device->SetIcon = NULL; | 129 device->FlipHWSurface = NULL; |
126 device->IconifyWindow = NULL; | 130 device->FreeHWSurface = PG_FreeHWSurface; |
127 device->GrabInput = NULL; | 131 device->SetCaption = PG_SetCaption; |
128 | 132 device->SetIcon = NULL; |
129 device->PumpEvents = PG_PumpEvents; | 133 device->IconifyWindow = NULL; |
130 device->InitOSKeymap = PG_InitOSKeymap; | 134 device->GrabInput = NULL; |
131 | 135 |
132 device->ShowWMCursor = PG_ShowWMCursor; | 136 device->PumpEvents = PG_PumpEvents; |
133 device->CreateWMCursor = PG_CreateWMCursor; | 137 device->InitOSKeymap = PG_InitOSKeymap; |
134 device->FreeWMCursor = PG_FreeWMCursor; | 138 |
135 device->WarpWMCursor = PG_WarpWMCursor; | 139 device->ShowWMCursor = PG_ShowWMCursor; |
136 | 140 device->CreateWMCursor = PG_CreateWMCursor; |
137 device->free = PG_DeleteDevice; | 141 device->FreeWMCursor = PG_FreeWMCursor; |
138 | 142 device->WarpWMCursor = PG_WarpWMCursor; |
139 return device; | 143 |
144 device->free = PG_DeleteDevice; | |
145 | |
146 return device; | |
140 } | 147 } |
141 | 148 |
142 VideoBootStrap PG_bootstrap = { | 149 VideoBootStrap PG_bootstrap = { |
143 PGVID_DRIVER_NAME, "PicoGUI SDL driver", | 150 PGVID_DRIVER_NAME, "PicoGUI SDL driver", |
144 PG_Available, PG_CreateDevice | 151 PG_Available, PG_CreateDevice |
145 }; | 152 }; |
146 | 153 |
147 | 154 |
148 int PG_VideoInit(_THIS, SDL_PixelFormat *vformat) | 155 int |
149 { | 156 PG_VideoInit (_THIS, SDL_PixelFormat * vformat) |
150 /* Connect to the PicoGUI server. No way to process command line args yet, | 157 { |
151 * but since this is based on SHM it's not important to be able to specify | 158 /* Connect to the PicoGUI server. No way to process command line args yet, |
152 * a remote PicoGUI server. | 159 * but since this is based on SHM it's not important to be able to specify |
153 * | 160 * a remote PicoGUI server. |
154 * FIXME: Another nitpick about the current client lib is there's no | 161 * |
155 * clean way to indicate that command line args are not available. | 162 * FIXME: Another nitpick about the current client lib is there's no |
156 */ | 163 * clean way to indicate that command line args are not available. |
157 pgInit(0,(char**)""); | 164 */ |
158 this->hidden->mi = *pgGetVideoMode(); | 165 pgInit (0, (char **) ""); |
159 | 166 this->hidden->mi = *pgGetVideoMode (); |
160 /* Create a picogui application and canvas. We'll populate the canvas later. */ | 167 |
161 this->hidden->wApp = pgRegisterApp(PG_APP_NORMAL,"SDL",0); | 168 /* Create a picogui application and canvas. We'll populate the canvas later. */ |
162 this->hidden->wCanvas = pgNewWidget(PG_WIDGET_CANVAS,0,0); | 169 this->hidden->wApp = pgRegisterApp (PG_APP_NORMAL, "SDL", 0); |
163 pgSetWidget(PGDEFAULT, | 170 this->hidden->wCanvas = pgNewWidget (PG_WIDGET_CANVAS, 0, 0); |
164 PG_WP_SIDE, PG_S_ALL, | 171 pgSetWidget (PGDEFAULT, PG_WP_SIDE, PG_S_ALL, 0); |
165 0); | 172 |
166 | 173 PG_InitEvents (this); |
167 PG_InitEvents(this); | 174 |
168 | 175 /* Determine the current screen size */ |
169 /* Determine the current screen size */ | 176 this->info.current_w = this->hidden->mi.lxres; |
170 this->info.current_w = this->hidden->mi.lxres; | 177 this->info.current_h = this->hidden->mi.lyres; |
171 this->info.current_h = this->hidden->mi.lyres; | 178 |
172 | 179 /* Determine the screen depth. |
173 /* Determine the screen depth. | 180 * We change this during the SDL_SetVideoMode implementation... |
174 * We change this during the SDL_SetVideoMode implementation... | 181 * Round up to the nearest Bytes per pixel |
175 * Round up to the nearest Bytes per pixel | 182 */ |
176 */ | 183 vformat->BitsPerPixel = this->hidden->mi.bpp; |
177 vformat->BitsPerPixel = this->hidden->mi.bpp; | 184 vformat->BytesPerPixel = this->hidden->mi.bpp >> 3; |
178 vformat->BytesPerPixel = this->hidden->mi.bpp >> 3; | 185 if (this->hidden->mi.bpp & 7) |
179 if (this->hidden->mi.bpp & 7) | 186 vformat->BytesPerPixel++; |
180 vformat->BytesPerPixel++; | 187 |
181 | 188 /* We're done! */ |
182 /* We're done! */ | 189 return (0); |
183 return(0); | 190 } |
184 } | 191 |
185 | 192 SDL_Rect ** |
186 SDL_Rect **PG_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) | 193 PG_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags) |
187 { | 194 { |
188 return (SDL_Rect **) -1; | 195 return (SDL_Rect **) - 1; |
189 } | 196 } |
190 | 197 |
191 SDL_Surface *PG_SetVideoMode(_THIS, SDL_Surface *current, | 198 SDL_Surface * |
192 int width, int height, int bpp, Uint32 flags) | 199 PG_SetVideoMode (_THIS, SDL_Surface * current, |
193 { | 200 int width, int height, int bpp, Uint32 flags) |
194 if ( this->hidden->bitmap ) { | 201 { |
195 /* Free old bitmap */ | 202 if (this->hidden->bitmap) { |
196 if (current->pixels) { | 203 /* Free old bitmap */ |
197 shmdt(current->pixels); | 204 if (current->pixels) { |
198 current->pixels = NULL; | 205 shmdt (current->pixels); |
199 } | 206 current->pixels = NULL; |
200 pgDelete(this->hidden->bitmap); | 207 } |
201 } | 208 pgDelete (this->hidden->bitmap); |
202 | 209 } |
203 /* Allocate the new pixel format for the screen */ | 210 |
204 if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) { | 211 /* Allocate the new pixel format for the screen */ |
205 SDL_SetError("Couldn't allocate new pixel format for requested mode"); | 212 if (!SDL_ReallocFormat (current, bpp, 0, 0, 0, 0)) { |
206 return(NULL); | 213 SDL_SetError |
207 } | 214 ("Couldn't allocate new pixel format for requested mode"); |
208 | 215 return (NULL); |
209 /* Create a new picogui bitmap */ | 216 } |
210 this->hidden->bitmap = pgCreateBitmap(width,height); | 217 |
211 this->hidden->shm = *pgMakeSHMBitmap(this->hidden->bitmap); | 218 /* Create a new picogui bitmap */ |
212 current->pixels = shmat(shmget(this->hidden->shm.shm_key, | 219 this->hidden->bitmap = pgCreateBitmap (width, height); |
213 this->hidden->shm.shm_length,0),NULL,0); | 220 this->hidden->shm = *pgMakeSHMBitmap (this->hidden->bitmap); |
214 | 221 current->pixels = shmat (shmget (this->hidden->shm.shm_key, |
215 /* Reset the canvas, and draw persistent and incremental grops. | 222 this->hidden->shm.shm_length, 0), NULL, |
216 * Use mapping and offsets to center it. | 223 0); |
217 */ | 224 |
218 | 225 /* Reset the canvas, and draw persistent and incremental grops. |
219 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_NUKE, 0); | 226 * Use mapping and offsets to center it. |
220 | 227 */ |
221 /* 0. Set the source position during incremental rendering | 228 |
222 */ | 229 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_NUKE, 0); |
223 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROP, 5, PG_GROP_SETSRC,0,0,0,0); | 230 |
224 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROPFLAGS, 1, PG_GROPF_INCREMENTAL); | 231 /* 0. Set the source position during incremental rendering |
225 | 232 */ |
226 /* 1. Incremental bitmap rendering | 233 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_GROP, 5, PG_GROP_SETSRC, 0, 0, |
227 */ | 234 0, 0); |
228 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROP, 6, PG_GROP_BITMAP, | 235 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_GROPFLAGS, 1, |
229 0,0,0,0,this->hidden->bitmap); | 236 PG_GROPF_INCREMENTAL); |
230 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROPFLAGS, 1, PG_GROPF_INCREMENTAL); | 237 |
231 | 238 /* 1. Incremental bitmap rendering |
232 /* 2. Normal bitmap rendering | 239 */ |
233 */ | 240 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_GROP, 6, PG_GROP_BITMAP, |
234 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_GROP, 6, PG_GROP_BITMAP, | 241 0, 0, 0, 0, this->hidden->bitmap); |
235 0,0,this->hidden->shm.width,this->hidden->shm.height,this->hidden->bitmap); | 242 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_GROPFLAGS, 1, |
236 | 243 PG_GROPF_INCREMENTAL); |
237 /* Set up the new mode framebuffer */ | 244 |
238 current->flags = 0; | 245 /* 2. Normal bitmap rendering |
239 current->w = this->hidden->shm.width; | 246 */ |
240 current->h = this->hidden->shm.height; | 247 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_GROP, 6, PG_GROP_BITMAP, |
241 current->pitch = this->hidden->shm.pitch; | 248 0, 0, this->hidden->shm.width, this->hidden->shm.height, |
242 | 249 this->hidden->bitmap); |
243 /* Set up pixel format */ | 250 |
244 current->format->BitsPerPixel = this->hidden->shm.bpp; | 251 /* Set up the new mode framebuffer */ |
245 current->format->BytesPerPixel = this->hidden->shm.bpp >> 3; | 252 current->flags = 0; |
246 if (this->hidden->shm.bpp & 7) | 253 current->w = this->hidden->shm.width; |
247 current->format->BytesPerPixel++; | 254 current->h = this->hidden->shm.height; |
248 current->format->palette = NULL; | 255 current->pitch = this->hidden->shm.pitch; |
249 current->format->Rmask = this->hidden->shm.red_mask; | 256 |
250 current->format->Gmask = this->hidden->shm.green_mask; | 257 /* Set up pixel format */ |
251 current->format->Bmask = this->hidden->shm.blue_mask; | 258 current->format->BitsPerPixel = this->hidden->shm.bpp; |
252 current->format->Amask = this->hidden->shm.alpha_mask; | 259 current->format->BytesPerPixel = this->hidden->shm.bpp >> 3; |
253 current->format->Rshift = this->hidden->shm.red_shift; | 260 if (this->hidden->shm.bpp & 7) |
254 current->format->Gshift = this->hidden->shm.green_shift; | 261 current->format->BytesPerPixel++; |
255 current->format->Bshift = this->hidden->shm.blue_shift; | 262 current->format->palette = NULL; |
256 current->format->Ashift = this->hidden->shm.alpha_shift; | 263 current->format->Rmask = this->hidden->shm.red_mask; |
257 current->format->Rloss = 8 - this->hidden->shm.red_length; | 264 current->format->Gmask = this->hidden->shm.green_mask; |
258 current->format->Gloss = 8 - this->hidden->shm.green_length; | 265 current->format->Bmask = this->hidden->shm.blue_mask; |
259 current->format->Bloss = 8 - this->hidden->shm.blue_length; | 266 current->format->Amask = this->hidden->shm.alpha_mask; |
260 current->format->Aloss = 8 - this->hidden->shm.alpha_length; | 267 current->format->Rshift = this->hidden->shm.red_shift; |
261 | 268 current->format->Gshift = this->hidden->shm.green_shift; |
262 /* Draw the app */ | 269 current->format->Bshift = this->hidden->shm.blue_shift; |
263 pgUpdate(); | 270 current->format->Ashift = this->hidden->shm.alpha_shift; |
264 | 271 current->format->Rloss = 8 - this->hidden->shm.red_length; |
265 /* We're done */ | 272 current->format->Gloss = 8 - this->hidden->shm.green_length; |
266 return(current); | 273 current->format->Bloss = 8 - this->hidden->shm.blue_length; |
274 current->format->Aloss = 8 - this->hidden->shm.alpha_length; | |
275 | |
276 /* Draw the app */ | |
277 pgUpdate (); | |
278 | |
279 /* We're done */ | |
280 return (current); | |
267 } | 281 } |
268 | 282 |
269 /* We don't actually allow hardware surfaces other than the main one */ | 283 /* We don't actually allow hardware surfaces other than the main one */ |
270 static int PG_AllocHWSurface(_THIS, SDL_Surface *surface) | 284 static int |
271 { | 285 PG_AllocHWSurface (_THIS, SDL_Surface * surface) |
272 return(-1); | 286 { |
273 } | 287 return (-1); |
274 static void PG_FreeHWSurface(_THIS, SDL_Surface *surface) | 288 } |
275 { | 289 static void |
276 return; | 290 PG_FreeHWSurface (_THIS, SDL_Surface * surface) |
291 { | |
292 return; | |
277 } | 293 } |
278 | 294 |
279 /* We need to wait for vertical retrace on page flipped displays */ | 295 /* We need to wait for vertical retrace on page flipped displays */ |
280 static int PG_LockHWSurface(_THIS, SDL_Surface *surface) | 296 static int |
281 { | 297 PG_LockHWSurface (_THIS, SDL_Surface * surface) |
282 return(0); | 298 { |
283 } | 299 return (0); |
284 | 300 } |
285 static void PG_UnlockHWSurface(_THIS, SDL_Surface *surface) | 301 |
286 { | 302 static void |
287 return; | 303 PG_UnlockHWSurface (_THIS, SDL_Surface * surface) |
288 } | 304 { |
289 | 305 return; |
290 static void PG_UpdateRects(_THIS, int numrects, SDL_Rect *rects) | 306 } |
291 { | 307 |
292 int i; | 308 static void |
293 | 309 PG_UpdateRects (_THIS, int numrects, SDL_Rect * rects) |
294 for (i = 0; i < numrects; i++) { | 310 { |
295 if (rects[i].w <= 0 || rects[i].h <= 0) | 311 int i; |
296 continue; | 312 |
297 | 313 for (i = 0; i < numrects; i++) { |
298 /* Schedule an incremental update for this rectangle, using | 314 if (rects[i].w <= 0 || rects[i].h <= 0) |
299 * the canvas gropnodes we've loaded beforehand. | 315 continue; |
300 */ | 316 |
301 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_FINDGROP, 1, 0); | 317 /* Schedule an incremental update for this rectangle, using |
302 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_MOVEGROP, 4, | 318 * the canvas gropnodes we've loaded beforehand. |
303 rects[i].x, rects[i].y, | 319 */ |
304 rects[i].w, rects[i].h); | 320 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_FINDGROP, 1, 0); |
305 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_FINDGROP, 1, 1); | 321 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_MOVEGROP, 4, |
306 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_MOVEGROP, 4, | 322 rects[i].x, rects[i].y, rects[i].w, rects[i].h); |
307 rects[i].x, rects[i].y, | 323 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_FINDGROP, 1, 1); |
308 rects[i].w, rects[i].h); | 324 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_MOVEGROP, 4, |
309 | 325 rects[i].x, rects[i].y, rects[i].w, rects[i].h); |
310 /* Go perform the update */ | 326 |
311 pgWriteCmd(this->hidden->wCanvas, PGCANVAS_INCREMENTAL, 0); | 327 /* Go perform the update */ |
312 pgSubUpdate(this->hidden->wCanvas); | 328 pgWriteCmd (this->hidden->wCanvas, PGCANVAS_INCREMENTAL, 0); |
313 } | 329 pgSubUpdate (this->hidden->wCanvas); |
314 } | 330 } |
315 | 331 } |
316 int PG_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) | 332 |
317 { | 333 int |
318 /* do nothing of note. */ | 334 PG_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors) |
319 return(1); | 335 { |
336 /* do nothing of note. */ | |
337 return (1); | |
320 } | 338 } |
321 | 339 |
322 /* Note: If we are terminated, this could be called in the middle of | 340 /* Note: If we are terminated, this could be called in the middle of |
323 another SDL video routine -- notably UpdateRects. | 341 another SDL video routine -- notably UpdateRects. |
324 */ | 342 */ |
325 void PG_VideoQuit(_THIS) | 343 void |
326 { | 344 PG_VideoQuit (_THIS) |
327 if (this->screen->pixels != NULL) | 345 { |
328 { | 346 if (this->screen->pixels != NULL) { |
329 shmdt(this->screen->pixels); | 347 shmdt (this->screen->pixels); |
330 this->screen->pixels = NULL; | 348 this->screen->pixels = NULL; |
331 pgDelete(this->hidden->bitmap); | 349 pgDelete (this->hidden->bitmap); |
332 } | 350 } |
333 pgDelete(this->hidden->wCanvas); | 351 pgDelete (this->hidden->wCanvas); |
334 pgDelete(this->hidden->wApp); | 352 pgDelete (this->hidden->wApp); |
335 } | 353 } |
336 | 354 |
337 void PG_SetCaption(_THIS, const char *title, const char *icon) | 355 void |
338 { | 356 PG_SetCaption (_THIS, const char *title, const char *icon) |
339 if (title != NULL) | 357 { |
340 pgReplaceText(this->hidden->wApp, title); | 358 if (title != NULL) |
341 pgUpdate(); | 359 pgReplaceText (this->hidden->wApp, title); |
360 pgUpdate (); | |
342 } | 361 } |
343 | 362 |
344 /* FIXME: The cursor stuff isn't implemented yet! */ | 363 /* FIXME: The cursor stuff isn't implemented yet! */ |
345 | 364 |
346 WMcursor * PG_CreateWMCursor (_THIS,Uint8 * data, Uint8 * mask, | 365 WMcursor * |
347 int w, int h, int hot_x, int hot_y) | 366 PG_CreateWMCursor (_THIS, Uint8 * data, Uint8 * mask, |
348 { | 367 int w, int h, int hot_x, int hot_y) |
349 static WMcursor dummy; | 368 { |
350 return &dummy; | 369 static WMcursor dummy; |
351 } | 370 return &dummy; |
352 | 371 } |
353 void PG_FreeWMCursor (_THIS, WMcursor * cursor) | 372 |
354 { | 373 void |
355 } | 374 PG_FreeWMCursor (_THIS, WMcursor * cursor) |
356 | 375 { |
357 void PG_WarpWMCursor(_THIS, Uint16 x, Uint16 y) | 376 } |
358 { | 377 |
359 } | 378 void |
360 | 379 PG_WarpWMCursor (_THIS, Uint16 x, Uint16 y) |
361 int PG_ShowWMCursor (_THIS, WMcursor * cursor) | 380 { |
362 { | 381 } |
363 return 1; | 382 |
364 } | 383 int |
384 PG_ShowWMCursor (_THIS, WMcursor * cursor) | |
385 { | |
386 return 1; | |
387 } | |
388 | |
389 /* vi: set ts=4 sw=4 expandtab: */ |