Fixed compiling with Visual Studio
authorSam Lantinga <slouken@libsdl.org>
Sun, 22 Oct 2017 00:46:52 -0700
changeset 527a26235cc1970
parent 526 3191051896e1
child 528 7f9e88f4b45e
Fixed compiling with Visual Studio
IMG_svg.c
nanosvg.h
nanosvgrast.h
     1.1 --- a/IMG_svg.c	Sun Oct 22 00:42:42 2017 -0700
     1.2 +++ b/IMG_svg.c	Sun Oct 22 00:46:52 2017 -0700
     1.3 @@ -29,6 +29,8 @@
     1.4  
     1.5  #include <stdio.h>
     1.6  #include <stdlib.h>
     1.7 +#include <math.h>
     1.8 +#include <float.h>
     1.9  
    1.10  /* Replace C runtime functions with SDL C runtime functions for building on Windows */
    1.11  #define strtoll	SDL_strtoll
     2.1 --- a/nanosvg.h	Sun Oct 22 00:42:42 2017 -0700
     2.2 +++ b/nanosvg.h	Sun Oct 22 00:46:52 2017 -0700
     2.3 @@ -1116,7 +1116,7 @@
     2.4  	// Parse integer part
     2.5  	if (nsvg__isdigit(*cur)) {
     2.6  		// Parse digit sequence
     2.7 -		intPart = (double)strtoll(cur, &end, 10);
     2.8 +		intPart = strtoll(cur, &end, 10);
     2.9  		if (cur != end) {
    2.10  			res = (double)intPart;
    2.11  			hasIntPart = 1;
    2.12 @@ -2823,8 +2823,8 @@
    2.13  static void nsvg__imageBounds(NSVGparser* p, float* bounds)
    2.14  {
    2.15  	NSVGshape* shape;
    2.16 +	int count = 0;
    2.17  	shape = p->image->shapes;
    2.18 -	int count = 0;
    2.19  
    2.20  	bounds[0] = FLT_MAX;
    2.21  	bounds[1] = FLT_MAX;
     3.1 --- a/nanosvgrast.h	Sun Oct 22 00:42:42 2017 -0700
     3.2 +++ b/nanosvgrast.h	Sun Oct 22 00:46:52 2017 -0700
     3.3 @@ -850,6 +850,7 @@
     3.4  static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float startPoint)
     3.5  {
     3.6  	 NSVGactiveEdge* z;
     3.7 +	 float dxdy;
     3.8  
     3.9  	if (r->freelist != NULL) {
    3.10  		// Restore from freelist.
    3.11 @@ -861,7 +862,7 @@
    3.12  		if (z == NULL) return NULL;
    3.13  	}
    3.14  
    3.15 -	float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);
    3.16 +	dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);
    3.17  //	STBTT_assert(e->y0 <= start_point);
    3.18  	// round dx down to avoid going too far
    3.19  	if (dxdy < 0)
    3.20 @@ -974,7 +975,7 @@
    3.21  	return nsvg__RGBA((unsigned char)r, (unsigned char)g, (unsigned char)b, (unsigned char)a);
    3.22  }
    3.23  
    3.24 -static inline int nsvg__div255(int x)
    3.25 +static int nsvg__div255(int x)
    3.26  {
    3.27      return ((x+1) * 257) >> 16;
    3.28  }