# This bug report was migrated from our old Bugzilla tracker.
These attachments… are available in the static archive:
* ~~[Example showing the problem (sdl_software_renderer_logical_size_problems.cpp, text/x-c++src, 2014-07-16 10:40:08 +0000, 3914 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1761)~~
* ~~[Example showing the problem (sdl_software_renderer_logical_size_problems.cpp, text/x-c++src, 2014-07-16 11:50:54 +0000, 3928 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1762)~~
* [Screenshot of bug (bug.png, image/png, 2014-07-16 11:52:11 +0000, 17873 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1763)
* ~~[SetLogicalSize patch (sdl-sw-logicalsize.patch, text/plain, 2014-07-17 10:49:05 +0000, 7756 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1767)~~
* ~~[Example showing the problem (sdl_software_renderer_logical_size_problems.cpp, text/plain, 2014-07-17 11:49:09 +0000, 3949 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1769)~~
* ~~[SetLogicalSize patch - v2 (sdl-sw-logicalsize.patch, text/plain, 2014-07-18 21:02:38 +0000, 8402 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1774)~~
* [Example showing the problem (sdl_software_renderer_logical_size_problems.cpp, text/x-c++src, 2014-07-18 22:33:42 +0000, 4026 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1775)
* ~~[SetLogicalSize patch - v3 (sdl-sw-logicalsize.patch, text/plain, 2014-07-18 23:04:33 +0000, 8418 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1776)~~
* [SetLogicalSize patch - v4 (sdl-sw-logicalsize.patch, text/plain, 2014-07-19 16:52:45 +0000, 7878 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1777)
* ~~[Patch for current SDL2 version (patch_for_2646.diff, text/plain, 2016-04-03 00:33:50 +0000, 754 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=2405)~~
* [SetLogicalSize patch - v5 (SetLogicalSize patch - v5.diff, text/plain, 2016-04-03 00:44:32 +0000, 1230 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=2406)
**Reported in version:** HG 2.0
**Reported for operating system, platform:** Linux, x86_64
# Comments on the original bug report:
On 2014-07-16 10:40:08 +0000, Damian Kaczmarek wrote:
> Created attachment 1761
> Example showing the problem
>
> When SDL_RenderSetLogicalSize is set the behavior of software renderer is buggy:
>
> Couple of problems:
> 1) Weird software renderer texture contraption while rendering textures on edges
> 2) Software renderer does not add black borders at all which makes it not viable to use with resizeable windows at all.
>
> Also there is an accidentally discovered problem with black borders on hardware renderer - see Hardware window # 2 in the demo
>
>
> Note: requires latest HG since the test is based on other bugs being fixed
>
>
> Compile and run with:
> g++ sdl_software_renderer_logical_size_problems.cpp -lSDL2 && ./a.out
On 2014-07-16 11:50:54 +0000, Damian Kaczmarek wrote:
> Created attachment 1762
> Example showing the problem
On 2014-07-16 11:52:11 +0000, Damian Kaczmarek wrote:
> Created attachment 1763
> Screenshot of bug
On 2014-07-17 10:49:05 +0000, Melker Narikka wrote:
> Created attachment 1767
> SetLogicalSize patch
>
> (Note that this patch also includes patches 1754 and 1755 from bug # 2198.)
>
> This patch seems to fix the behaviour of the test case.
>
> I also added these lines to the test case after the RenderCopy call to
> test the RenderCopyEx clipping (which this patch addresses as well):
>
> SDL_SetTextureColorMod(semiTransparentTexture, 255, 0, 255);
> SDL_RenderCopyEx(renderer, semiTransparentTexture, &a, &b, 45.0, NULL, SDL_FLIP_NONE);
> SDL_SetTextureColorMod(semiTransparentTexture, 255, 255, 255);
On 2014-07-17 11:49:09 +0000, Damian Kaczmarek wrote:
> Created attachment 1769
> Example showing the problem
>
> Updated test case to show problems when rendering the texture at x < 0
On 2014-07-18 21:02:38 +0000, Melker Narikka wrote:
> Created attachment 1774
> SetLogicalSize patch - v2
>
> Here's an updated patch that should work, mostly at the very least. There's a weird offset issue with this patch with RenderCopyEx and rotated surfaces though, where I'm getting results that are (1px, 2px) off. This might be due to lossy integer arithmetic.
On 2014-07-18 22:21:52 +0000, Damian Kaczmarek wrote:
> Thanks for the latest patch. It is much better but I still find a lot of issues .. need to think how to update the test code.
On 2014-07-18 22:33:42 +0000, Damian Kaczmarek wrote:
> Created attachment 1775
> Example showing the problem
>
> Two problems, first see the difference of rendering at the beginning of the rendering code. The rectangle is displayed well .. kind of shifted at the beginning. Second problem is triggered by playing with the size of the window with the mouse, lots of artifacts are being created when resizing the software windows with the mouse.
On 2014-07-18 23:04:33 +0000, Melker Narikka wrote:
> Created attachment 1776
> SetLogicalSize patch - v3
>
> I was supposed to make the if/elif/else blocks if+if/else. Hmm, here I thought I had done just that. Anyway, that addresses the shifted rectangle issue, which was caused by ignoring some fairly important offsets when the rectangle was rendered at negative coordinates.
>
> As for the visual artifact issue, I think that's due to not clearing the renderer between frames. I'm getting some really nasty window damage when resizing the hardware-backed renderer[1]. Curiously enough, the software renderer doesn't do this on my system...
> Is this similar to what you're seeing?
>
> [1] http://i.imgur.com/9tBag9t.png
On 2014-07-18 23:11:49 +0000, Damian Kaczmarek wrote:
> I confirm the newest patch fixes the shift. For me hardware renderer works properly and only software leaves the window damage [1] I am using NVIDIA blob drivers.
>
> [1] http://x.rushbase.net/ebb4c6f9a824f424944497e1f78572b560f13c7e/damage.png
On 2014-07-19 16:52:45 +0000, Melker Narikka wrote:
> Created attachment 1777
> SetLogicalSize patch - v4
>
> Here's an updated patch with some silliness removed. Should behave identically to v3.
On 2016-04-03 00:33:50 +0000, Roberto Prieto wrote:
> Created attachment 2405
> Patch for current SDL2 version
>
> Minimum patch file for fixing this bug on current SDL2 version (as of 29-March-2016), based on SetLogicalSize patch - v4
On 2016-04-03 00:44:32 +0000, Roberto Prieto wrote:
> Created attachment 2406
> SetLogicalSize patch - v5
>
> (Now with the right format)
>
> Minimum patch file for fixing this bug on current SDL2 version (as of 29-March-2016), based on SetLogicalSize patch - v4.
>
> It passed the example attached to this bug report and the issues I found during my developement.
>
> Many thanks to the original author (Melker Narikka)!!!
>
> Cheers
> Roberto
On 2017-08-14 05:50:41 +0000, Sam Lantinga wrote:
> Fixed, thanks!
> https://hg.libsdl.org/SDL/rev/42b62c737891