From 9ea2fa5caa3e15e20c138d58703e11f02b8952fe Mon Sep 17 00:00:00 2001 From: Marko Zivic Date: Sun, 10 Nov 2024 00:02:24 +0100 Subject: [PATCH] Fix wrong return rect aacircle is returning different return rect from aaellipse when it is off-surface --- src_c/draw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src_c/draw.c b/src_c/draw.c index 7d785c6e51..420c5ff863 100644 --- a/src_c/draw.c +++ b/src_c/draw.c @@ -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; }