| Summary: | Clipping rectangle behaving incorrectly | ||
|---|---|---|---|
| Product: | SDL | Reporter: | sieng |
| Component: | *don't know* | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.3 | ||
| Hardware: | x86_64 | ||
| OS: | Windows 7 | ||
| Attachments: | Program, image and screenshot | ||
UPDATE: I think I found a fix. In file SDL_render.c, SDL_RenderSetClipRect, the following lines: renderer->clip_rect.x = (int)SDL_floor(rect->x * renderer->scale.x); renderer->clip_rect.y = (int)SDL_floor(rect->y * renderer->scale.y); should be: renderer->clip_rect.x = (int)SDL_floor(rect->x * renderer->scale.x + renderer->viewport.x); renderer->clip_rect.y = (int)SDL_floor(rect->y * renderer->scale.y + renderer->viewport.y); I modified my program so that I could better visualize the clipping rectangle and then experimented with all sorts of resolutions and clipping rectangles, with both SDL_WINDOW_FULLSCREEN_DESKTOP and SDL_WINDOW_FULLSCREEN, with SetLogicalSize and without it, and it seems to work fine. I'm not familiar with SDL's codebase though, so I may have messed something around. Fixed, thanks! https://hg.libsdl.org/SDL/rev/1d13a878b066 |
Created attachment 2100 [details] Program, image and screenshot When running the attached program, the clipping rectangle behaves incorrectly. The right border of the clipping rectangle is 16 or 17 logical pixels to the left of where it should be. The top, bottom and left borders of the clipping rectangle work as expected.