# HG changeset patch # User Sam Lantinga # Date 1154840248 0 # Node ID 5432b63cc919d776d71e420753d2cc70bb68d756 # Parent db3ba6c0d0dffd18c87801e1ac87b9c7b5644a8e Added window resize support for the software renderer diff -r db3ba6c0d0df -r 5432b63cc919 src/video/SDL_renderer_sw.c --- 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; }