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 3117 - SDL_RenderSetClipRect flipped Y orientation
Summary: SDL_RenderSetClipRect flipped Y orientation
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: don't know
Hardware: ARM iOS (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.4
: 3123 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-09-12 12:16 UTC by Stephen French
Modified: 2016-01-06 05:52 UTC (History)
6 users (show)

See Also:


Attachments
repro for the problem (1.10 KB, text/plain)
2015-09-12 12:16 UTC, Stephen French
Details
patch that fixes it for me (762 bytes, patch)
2015-09-12 12:17 UTC, Stephen French
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen French 2015-09-12 12:16:19 UTC
Created attachment 2262 [details]
repro for the problem

SDL_RenderSetClipRect() works on SDL 2.0.3 but in the current development branch the clipping rectangle is flipped in the Y direction for iOS and Android targets.

Bug 2700 describes a similar problem, but I've reported this when rendering to the device not a texture.  It affects iOS and Android and probably other GLES targets.

Attached a repro.  The red rectangle should be at the top of the screen, but is instead at the bottom due to the flipped clipping rectangle.

Also attached a patch which fixes the problem for GLES2 renderer, but a glance at the GLES1 renderer, looks like it contains the same code and is presumably similarly broken.  I'm not certain my fix is correct but it works in my test case and app.
Comment 1 Stephen French 2015-09-12 12:17:12 UTC
Created attachment 2263 [details]
patch that fixes it for me
Comment 2 Philipp Wiesemann 2015-09-16 20:20:47 UTC
Maybe related to bug 2700.
Comment 3 Davide Coppola 2015-09-16 20:37:20 UTC
*** Bug 3123 has been marked as a duplicate of this bug. ***
Comment 4 Martin Gerhardy 2015-10-27 20:02:39 UTC
The same code is also used for the opengl renderer, not only the gles renderers.
Comment 5 Martin Gerhardy 2015-10-27 20:04:24 UTC
https://hg.libsdl.org/SDL/rev/1d13a878b066 <--- this broke it btw.
Comment 6 Martin Gerhardy 2015-10-27 20:16:33 UTC
pushed a fix into my copy of sdl: https://github.com/mgerhardy/caveexpress/commit/13541e154729f124fbe4331fbd1674dd0eb8b62f
Comment 7 Ryan C. Gordon 2015-12-29 00:53:39 UTC
I believe this fixes it, which I just pushed for Bug #2700: 

    https://hg.libsdl.org/SDL/rev/f9cd179cf50e

...I think it's identical code to your solution, but if you want to sanity check with the latest in Mercurial, I'd appreciate it. If it's still broken, please reopen this bug!

--ryan.
Comment 8 Stephen French 2016-01-06 05:52:51 UTC
I checked the released version of 2.0.4 and it is working fine (in my app anyway). Thanks!