Mercurial > sdl-ios-xcode
diff 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 |
line wrap: on
line diff
--- a/src/video/SDL_renderer_sw.c Sun Aug 06 04:39:13 2006 +0000 +++ b/src/video/SDL_renderer_sw.c Sun Aug 06 04:57:28 2006 +0000 @@ -289,12 +289,30 @@ SW_DisplayModeChanged(SDL_Renderer * renderer) { SW_RenderData *data = (SW_RenderData *) renderer->driverdata; + SDL_Window *window = SDL_GetWindowFromID(renderer->window); + int i, n; if (data->renderer && data->renderer->DisplayModeChanged) { if (data->renderer->DisplayModeChanged(data->renderer) < 0) { return -1; } } + + /* Recreate the textures for the new window size */ + if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) { + n = 2; + } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP3) { + n = 3; + } else { + n = 1; + } + for (i = 0; i < n; ++i) { + if (data->texture[i]) { + DestroyTexture(data->renderer, data->texture[i]); + } + data->texture[i] = + CreateTexture(data->renderer, data->format, window->w, window->h); + } return 0; }