We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5113 - SDL_UpdateWindowSurfaceRects BitBlt the entire surface on Win32.
Summary: SDL_UpdateWindowSurfaceRects BitBlt the entire surface on Win32.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86_64 Windows (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-27 03:46 UTC by Ryan C. Gordon
Modified: 2020-05-30 08:38 UTC (History)
3 users (show)

See Also:


Attachments
Windows SDL_UpdateWindowSurfaceRects to only do updates of rects passed in. (744 bytes, patch)
2020-05-17 20:56 UTC, Rene Dudfield
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan C. Gordon 2020-04-27 03:46:02 UTC
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?"

--ryan.
Comment 1 Jay Petacat 2020-04-27 16:36:55 UTC
From a porter's perspective, I'd be curious to know what UpdateWindowFramebuffer ought to do if the platform does not cleanly support partial updates to the screen. Is the Rects argument intended to be only a hint for optimization, or is it a requirement that the function not "color outside the lines" defined by Rects?

Like Win32, my DOS port ignores the Rects argument, copies the entire surface to the back buffer, then does a page flip. If the area outside of Rects is not supposed to be mutated, there's a potential problem where the back buffer may not match the front buffer. I could first copy that area of the front buffer to the back buffer before the page flip, but that seems counter-productive from a performance perspective.
Comment 2 Sam Lantinga 2020-04-29 21:30:03 UTC
The rects argument is just supposed to be an optimization. Conceptually the entire back buffer is reflected to the front buffer.
Comment 3 Rene Dudfield 2020-05-17 20:56:47 UTC
Created attachment 4346 [details]
Windows SDL_UpdateWindowSurfaceRects to only do updates of rects passed in.

Here's a patch.
Comment 4 Josip Komljenović 2020-05-18 16:06:05 UTC
Hi, I am the original poster of the bug on the forum and if I install the patch  Rene Dudfield did I get the correct results for SDL_UpdateWindowSurfaceRects function. If this passes your tests I would be glad if you merge it in the next SDL official release. Thank you all for your work on this bug, I know this function is not used very much, so I am really glad you managed to fix it so soon.
Comment 5 Sam Lantinga 2020-05-30 04:27:33 UTC
That patch would not have compiled as-is, so I fixed and committed it:
https://hg.libsdl.org/SDL/rev/ba1ed72249c0

Thanks!
Comment 6 Rene Dudfield 2020-05-30 08:38:39 UTC
Thanks :)