Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't modify the math functions in nanosvgrast.h
  • Loading branch information
slouken committed Feb 24, 2018
1 parent 6c8710f commit 76850c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions IMG_svg.c
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions nanosvgrast.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 76850c7

Please sign in to comment.