From 9325b22ef03302d80b6ab9a4eade362f22f9657e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 29 May 2020 21:26:32 -0700 Subject: [PATCH] Fixed bug 5113 - SDL_UpdateWindowSurfaceRects BitBlt the entire surface on Win32 Ryan C. Gordon As discussed here: https://discourse.libsdl.org/t/question-about-implementation-of-sdl-updatewindowsurfacerects/27561 "As you can see this function [WIN_UpdateWindowFramebuffer, in src/video/windows/SDL_windowsframebuffer.c] calls BitBlt on entire screen, even though it accepts the rects. Rects variable is not even used in this function at all. Now my question is why is that the case?" --- src/video/windows/SDL_windowsframebuffer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowsframebuffer.c b/src/video/windows/SDL_windowsframebuffer.c index 509233ea4c656..e45e7961e9969 100644 --- a/src/video/windows/SDL_windowsframebuffer.c +++ b/src/video/windows/SDL_windowsframebuffer.c @@ -99,8 +99,12 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi int WIN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + int i; - BitBlt(data->hdc, 0, 0, window->w, window->h, data->mdc, 0, 0, SRCCOPY); + for (i = 0; i < numrects; ++i) { + BitBlt(data->hdc, rects[i].x, rects[i].y, rects[i].w, rects[i].h, + data->mdc, rects[i].x, rects[i].y, SRCCOPY); + } return 0; }