Skip to content

Commit

Permalink
Fix wrong return rect
Browse files Browse the repository at this point in the history
aacircle is returning different return rect from aaellipse when it is 
off-surface
  • Loading branch information
mzivic7 committed Nov 9, 2024
1 parent 1bac0fc commit 9ea2fa5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src_c/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,17 +1037,20 @@ aaellipse(PyObject *self, PyObject *arg, PyObject *kwargs)
}
else if (rect->h == rect->w) {
int radius = (int)(rect->w / 2);
SDL_Rect *ret_rect = NULL;
PyObject *ret = NULL;
PyObject *center = pg_tuple_couple_from_values_int(rect->x + radius,
rect->y + radius);
PyObject *args =
Py_BuildValue("(OOOii)", surfobj, colorobj, center, radius, width);

if (!args) {
return NULL; /* Exception already set. */
}

ret = aacircle(NULL, args, NULL);
ret_rect = pgRect_FromObject(ret, &temp);
if (ret_rect->w == 0 && ret_rect->h == 0) {
ret = pgRect_New4(rect->x, rect->y, 0, 0);
}
Py_DECREF(args);
return ret;
}
Expand Down

0 comments on commit 9ea2fa5

Please sign in to comment.