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 2504 - An empty cliprect causes clipping to be disabled
Summary: An empty cliprect causes clipping to be disabled
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.3
Hardware: All All
: P2 major
Assignee: (disabled) Jørgen Tjernø
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-19 19:44 UTC by (disabled) Jørgen Tjernø
Modified: 2014-04-19 21:48 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description (disabled) Jørgen Tjernø 2014-04-19 19:44:56 UTC
Doing the following does not do what is expected:


    SDL_Rect rect = { 0, 0, 0, 0 };
    SDL_RenderSetClipRect(pRenderer, &rect);


Expected behavior:

 - Clip every draw, preventing any rendering from happening.

Actual behavior:

 - Disable clipping entirely, allowing every render to render to each pixel.


The comments for SDL_RenderSetClipRect's second parameter say: "A pointer to the rectangle to set as the clip rectangle, or NULL to disable clipping."

This seems to just be a bug, since it internally sets the clip rect to a zero rect when you disable clipping, so the underlying subsystems can't distinguish from an empty rect and clipping disabled.
Comment 1 (disabled) Jørgen Tjernø 2014-04-19 19:45:14 UTC
I'll be fixing this.
Comment 2 (disabled) Jørgen Tjernø 2014-04-19 20:22:43 UTC
Fixed in https://hg.libsdl.org/SDL/rev/c7174f961388

Sam: Can you review the change and close the bug if it looks good?
Comment 3 Sam Lantinga 2014-04-19 21:48:34 UTC
Looks good, thanks!