Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ClippingRect #1450

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jagprog5
Copy link

@jagprog5 jagprog5 commented Jan 2, 2025

in rust-sdl2, Rect can't have a zero width or height. This is instead represented with Option, where None covers this case.

The Canvas set_clip_rect and clip_rect function work with Option as well. However, for those functions None instead represents the lack of a clipping rect. This is distinctly differently, as clearing the clipping rect is like setting a Rect with an infinite area, and not a zero area (which would instead disable drawing).

This is value aliasing which can be corrected with a better type representation; it's impossible with current API to set a clipping rect with a zero area, which is a valid request that disables drawing. Since this has been fixed in sdl2, this MR keep in sync with upstream.

This is not backwards compatible. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant