From 76850c7caf57fb231ddbad8c80d5e5698673fa86 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 24 Feb 2018 09:58:50 -0800 Subject: [PATCH] Don't modify the math functions in nanosvgrast.h --- IMG_svg.c | 2 ++ nanosvgrast.h | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/IMG_svg.c b/IMG_svg.c index e3cdd5c4..d0de8950 100755 --- a/IMG_svg.c +++ b/IMG_svg.c @@ -31,8 +31,10 @@ #define acosf SDL_acosf #define atan2f SDL_atan2f #define cosf SDL_cosf +#define ceilf SDL_ceilf #define fabs SDL_fabs #define fabsf SDL_fabsf +#define floorf SDL_floorf #define fmodf SDL_fmodf #define free SDL_free #define malloc SDL_malloc diff --git a/nanosvgrast.h b/nanosvgrast.h index f5abe86d..c5059841 100755 --- a/nanosvgrast.h +++ b/nanosvgrast.h @@ -553,7 +553,7 @@ static void nsvg__roundJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right if (da < NSVG_PI) da += NSVG_PI*2; if (da > NSVG_PI) da -= NSVG_PI*2; - n = (int)SDL_ceilf((nsvg__absf(da) / NSVG_PI) * (float)ncap); + n = (int)ceilf((nsvg__absf(da) / NSVG_PI) * (float)ncap); if (n < 2) n = 2; if (n > ncap) n = ncap; @@ -596,7 +596,7 @@ static void nsvg__straightJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* ri static int nsvg__curveDivs(float r, float arc, float tol) { float da = acosf(r / (r + tol)) * 2.0f; - int divs = (int)SDL_ceilf(arc / da); + int divs = (int)ceilf(arc / da); if (divs < 2) divs = 2; return divs; } @@ -868,10 +868,10 @@ static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float sta // STBTT_assert(e->y0 <= start_point); // round dx down to avoid going too far if (dxdy < 0) - z->dx = (int)(-SDL_floorf(NSVG__FIX * -dxdy)); + z->dx = (int)(-floorf(NSVG__FIX * -dxdy)); else - z->dx = (int)SDL_floorf(NSVG__FIX * dxdy); - z->x = (int)SDL_floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0))); + z->dx = (int)floorf(NSVG__FIX * dxdy); + z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0))); // z->x -= off_x * FIX; z->ey = e->y1; z->next = 0;