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

Using blur on a surface with either width or height equal to 0 won't raise a ValueError #2852

Merged

Conversation

Damus666
Copy link
Contributor

I tried to fix issue #2849 and I tested locally that surfaces with either width == 0 or height == 0 won't raise a misleading error message. I also moved the comparison between dst and src sizes as if src is (30, 50) and dst is (0, 20), without moving the check, the function would have passed returning a (0, 20) sized surface which would probably cause bugs, both src and dst must have the same zero sizes for it to return gracefully.
Why not an exception? Like the issue creator said, all transform functions handle zero sized surfaces which are even returned some times (pygame.Font.render) so this one should be consistent. If you find anything wrong with my changes let me know.
I also modified the docs and added a test.

@Damus666 Damus666 requested a review from a team as a code owner May 13, 2024 13:25
Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the PR 🎉

@ankith26 ankith26 added this to the 2.5.0 milestone May 14, 2024
Copy link
Member

@oddbookworm oddbookworm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@oddbookworm oddbookworm merged commit fdcbd7a into pygame-community:main May 20, 2024
39 checks passed
@Damus666 Damus666 deleted the blur-handle-zero-size-surfaces branch May 20, 2024 21:44
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.

Unhelpful error message in pygame.transform.gaussian_blur() with zero-dimensioned surfaces
3 participants