Don't modify the math functions in nanosvgrast.h
authorSam Lantinga <slouken@libsdl.org>
Sat, 24 Feb 2018 09:58:50 -0800
changeset 573a07b331fd1aa
parent 572 a06fe49245a3
child 574 ba420079c85f
Don't modify the math functions in nanosvgrast.h
IMG_svg.c
nanosvgrast.h
     1.1 --- a/IMG_svg.c	Sat Feb 24 09:53:25 2018 -0800
     1.2 +++ b/IMG_svg.c	Sat Feb 24 09:58:50 2018 -0800
     1.3 @@ -31,8 +31,10 @@
     1.4  #define acosf   SDL_acosf
     1.5  #define atan2f  SDL_atan2f
     1.6  #define cosf    SDL_cosf
     1.7 +#define ceilf   SDL_ceilf
     1.8  #define fabs    SDL_fabs
     1.9  #define fabsf   SDL_fabsf
    1.10 +#define floorf  SDL_floorf
    1.11  #define fmodf   SDL_fmodf
    1.12  #define free    SDL_free
    1.13  #define malloc  SDL_malloc
     2.1 --- a/nanosvgrast.h	Sat Feb 24 09:53:25 2018 -0800
     2.2 +++ b/nanosvgrast.h	Sat Feb 24 09:58:50 2018 -0800
     2.3 @@ -553,7 +553,7 @@
     2.4  	if (da < NSVG_PI) da += NSVG_PI*2;
     2.5  	if (da > NSVG_PI) da -= NSVG_PI*2;
     2.6  
     2.7 -	n = (int)SDL_ceilf((nsvg__absf(da) / NSVG_PI) * (float)ncap);
     2.8 +	n = (int)ceilf((nsvg__absf(da) / NSVG_PI) * (float)ncap);
     2.9  	if (n < 2) n = 2;
    2.10  	if (n > ncap) n = ncap;
    2.11  
    2.12 @@ -596,7 +596,7 @@
    2.13  static int nsvg__curveDivs(float r, float arc, float tol)
    2.14  {
    2.15  	float da = acosf(r / (r + tol)) * 2.0f;
    2.16 -	int divs = (int)SDL_ceilf(arc / da);
    2.17 +	int divs = (int)ceilf(arc / da);
    2.18  	if (divs < 2) divs = 2;
    2.19  	return divs;
    2.20  }
    2.21 @@ -868,10 +868,10 @@
    2.22  //	STBTT_assert(e->y0 <= start_point);
    2.23  	// round dx down to avoid going too far
    2.24  	if (dxdy < 0)
    2.25 -		z->dx = (int)(-SDL_floorf(NSVG__FIX * -dxdy));
    2.26 +		z->dx = (int)(-floorf(NSVG__FIX * -dxdy));
    2.27  	else
    2.28 -		z->dx = (int)SDL_floorf(NSVG__FIX * dxdy);
    2.29 -	z->x = (int)SDL_floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
    2.30 +		z->dx = (int)floorf(NSVG__FIX * dxdy);
    2.31 +	z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
    2.32  //	z->x -= off_x * FIX;
    2.33  	z->ey = e->y1;
    2.34  	z->next = 0;