From: Jean-Philippe Bruyère Date: Fri, 25 Mar 2022 12:26:48 +0000 (+0100) Subject: SET(CMAKE_C_EXTENSIONS OFF), replace remainings M_PI by defined M_PIF X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=5454492c144aee21a988be8f55da33eda4dfce7c;p=jp%2Fvkvg.git SET(CMAKE_C_EXTENSIONS OFF), replace remainings M_PI by defined M_PIF --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c1f1ae..2a1a47d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.16) SET(LANG "CXX") SET(CMAKE_C_STANDARD 11) SET(CMAKE_CXX_STANDARD 11) +SET(CMAKE_C_EXTENSIONS OFF) OPTION (VKVG_BUILD_SHARED_LIB "Build using shared libraries" ON) diff --git a/src/vkvg_context.c b/src/vkvg_context.c index 67e8b1d..ec18ffc 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -660,13 +660,13 @@ vkvg_status_t vkvg_rounded_rectangle (VkvgContext ctx, float x, float y, float w radius = fmin (w / 2.0f, h / 2.0f); vkvg_move_to(ctx, x, y + radius); - vkvg_arc(ctx, x + radius, y + radius, radius, (float)M_PI, (float)-M_PI_2); + vkvg_arc(ctx, x + radius, y + radius, radius, M_PIF, -M_PIF_2); vkvg_line_to(ctx, x + w - radius, y); - vkvg_arc(ctx, x + w - radius, y + radius, radius, (float)-M_PI_2, 0); + vkvg_arc(ctx, x + w - radius, y + radius, radius, -M_PIF_2, 0); vkvg_line_to(ctx, x + w, y + h - radius); - vkvg_arc(ctx, x + w - radius, y + h - radius, radius, 0, (float)M_PI_2); + vkvg_arc(ctx, x + w - radius, y + h - radius, radius, 0, M_PIF_2); vkvg_line_to(ctx, x + radius, y + h); - vkvg_arc(ctx, x + radius, y + h - radius, radius, (float)M_PI_2, (float)M_PI); + vkvg_arc(ctx, x + radius, y + h - radius, radius, M_PIF_2, M_PIF); vkvg_line_to(ctx, x, y + radius); vkvg_close_path(ctx); diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index 1b0e301..951e254 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -250,8 +250,8 @@ float _get_arc_step (VkvgContext ctx, float radius) { vkvg_matrix_get_scale (&ctx->pushConsts.mat, &sx, &sy); float r = radius * fabsf(fmaxf(sx,sy)); if (r < 30.0f) - return fminf(M_PI / 3.f, M_PI / r); - return fminf(M_PI / 3.f,M_PI / (r * 0.4f)); + return fminf(M_PIF / 3.f, M_PIF / r); + return fminf(M_PIF / 3.f,M_PIF / (r * 0.4f)); } void _create_gradient_buff (VkvgContext ctx){ vkvg_buffer_create (ctx->dev, @@ -1542,7 +1542,7 @@ void _elliptic_arc (VkvgContext ctx, float x1, float y1, float x2, float y2, boo double theta = sa; double ea = sa + delta_theta; - float step = fmaxf(0.001f, fminf(M_PI, _get_arc_step(ctx, fminf (rx, ry))*0.1f)); + float step = fmaxf(0.001f, fminf(M_PIF, _get_arc_step(ctx, fminf (rx, ry))*0.1f)); p = (vec2) { rx * cosf (theta),