diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 269925043..0c5bccd9a 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -1137,6 +1137,13 @@ void Graphics::rectangle(DrawMode mode, float x, float y, float w, float h, floa return; } + // Radius values that are more than half the rectangle's size aren't handled + // correctly (for now)... + if (w >= 0.02f) + rx = std::min(rx, w / 2.0f - 0.01f); + if (h >= 0.02f) + ry = std::min(ry, h / 2.0f - 0.01f); + points = std::max(points, 1); const float half_pi = static_cast(LOVE_M_PI / 2); diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index ba894e813..a27e333f4 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -1592,11 +1592,6 @@ int w_rectangle(lua_State *L) float rx = (float)luaL_optnumber(L, 6, 0.0); float ry = (float)luaL_optnumber(L, 7, rx); - if (w > 0.0 && rx >= w / 2.0) - return luaL_error(L, "Invalid rectangle x-axis radius (must be less than half the width)"); - if (h > 0.0 && ry >= h / 2.0) - return luaL_error(L, "Invalid rectangle y-axis radius (must be less than half the height)"); - int points; if (lua_isnoneornil(L, 8)) points = std::max(rx, ry) > 20.0 ? (int)(std::max(rx, ry) / 2) : 10;