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
0 sized masks are now possible #493
Conversation
Looks like a few builds are failing. You can see them by clicking the "Details" link next to Appveyor and TravisCI. Here's one issue on a 32bit python: https://ci.appveyor.com/project/pygame/pygame/build/1.0.584/job/wi2o2m3smiuim2wq
|
src_c/mask.c
Outdated
@@ -467,6 +470,11 @@ static PyObject* mask_from_surface(PyObject* self, PyObject* args) | |||
return NULL; | |||
} | |||
|
|||
if (surf->w < 0 || surf->h < 0) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
size_t size; | ||
|
||
size = offsetof(bitmask_t,bits); | ||
if (w && h) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@augusto2112 I think it's good. Thanks :) However, we don't have tests for the different methods operating on zero sized masks. If you want to add tests for those I can leave it open? Otherwise I'll merge it in? |
@illume I'll add the tests 😄 |
@illume I'll do it tomorrow though because today I won't have enough time. Or you prefer, you can accept it and tomorrow I submit a new PR with the tests. |
@illume I added a bunch of tests. I'm not sure what should happen when trying to scale a (0, 100) mask by (0, 2) for example. Currently it stays (0, 100). |
test/mask_test.py
Outdated
|
||
for size in sizes: | ||
mask = pygame.mask.Mask(size) | ||
mask.scale((2, 3)) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Issue: #491