I tried to fix issue https://github.com/pygame-community/pygame-ce/issues/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.
I tried to fix issue https://github.com/pygame-community/pygame-ce/issues/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
andsrc
sizes as ifsrc
is (30, 50) anddst
is (0, 20), without moving the check, the function would have passed returning a (0, 20) sized surface which would probably cause bugs, bothsrc
anddst
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.