comparison src/video/SDL_renderer_sw.c @ 1971:5432b63cc919

Added window resize support for the software renderer
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Aug 2006 04:57:28 +0000
parents db3ba6c0d0df
children a0e278364188
comparison
equal deleted inserted replaced
1970:db3ba6c0d0df 1971:5432b63cc919
287 287
288 static int 288 static int
289 SW_DisplayModeChanged(SDL_Renderer * renderer) 289 SW_DisplayModeChanged(SDL_Renderer * renderer)
290 { 290 {
291 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; 291 SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
292 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
293 int i, n;
292 294
293 if (data->renderer && data->renderer->DisplayModeChanged) { 295 if (data->renderer && data->renderer->DisplayModeChanged) {
294 if (data->renderer->DisplayModeChanged(data->renderer) < 0) { 296 if (data->renderer->DisplayModeChanged(data->renderer) < 0) {
295 return -1; 297 return -1;
296 } 298 }
299 }
300
301 /* Recreate the textures for the new window size */
302 if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) {
303 n = 2;
304 } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP3) {
305 n = 3;
306 } else {
307 n = 1;
308 }
309 for (i = 0; i < n; ++i) {
310 if (data->texture[i]) {
311 DestroyTexture(data->renderer, data->texture[i]);
312 }
313 data->texture[i] =
314 CreateTexture(data->renderer, data->format, window->w, window->h);
297 } 315 }
298 return 0; 316 return 0;
299 } 317 }
300 318
301 static int 319 static int