From 357c5f2974ec5a329c449e700825c7a2e38908c9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 22 Oct 2017 00:46:52 -0700 Subject: [PATCH] Fixed compiling with Visual Studio --- IMG_svg.c | 2 ++ nanosvg.h | 4 ++-- nanosvgrast.h | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) mode change 100644 => 100755 nanosvg.h mode change 100644 => 100755 nanosvgrast.h diff --git a/IMG_svg.c b/IMG_svg.c index 891416d4..c8751bfe 100755 --- a/IMG_svg.c +++ b/IMG_svg.c @@ -29,6 +29,8 @@ #include #include +#include +#include /* Replace C runtime functions with SDL C runtime functions for building on Windows */ #define strtoll SDL_strtoll diff --git a/nanosvg.h b/nanosvg.h old mode 100644 new mode 100755 index 120ba64b..d8c99bd5 --- a/nanosvg.h +++ b/nanosvg.h @@ -1116,7 +1116,7 @@ static double nsvg__atof(const char* s) // Parse integer part if (nsvg__isdigit(*cur)) { // Parse digit sequence - intPart = (double)strtoll(cur, &end, 10); + intPart = strtoll(cur, &end, 10); if (cur != end) { res = (double)intPart; hasIntPart = 1; @@ -2823,8 +2823,8 @@ static void nsvg__content(void* ud, const char* s) static void nsvg__imageBounds(NSVGparser* p, float* bounds) { NSVGshape* shape; - shape = p->image->shapes; int count = 0; + shape = p->image->shapes; bounds[0] = FLT_MAX; bounds[1] = FLT_MAX; diff --git a/nanosvgrast.h b/nanosvgrast.h old mode 100644 new mode 100755 index 2940c1f9..131e471b --- a/nanosvgrast.h +++ b/nanosvgrast.h @@ -850,6 +850,7 @@ static int nsvg__cmpEdge(const void *p, const void *q) static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float startPoint) { NSVGactiveEdge* z; + float dxdy; if (r->freelist != NULL) { // Restore from freelist. @@ -861,7 +862,7 @@ static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float sta if (z == NULL) return NULL; } - float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); + dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); // STBTT_assert(e->y0 <= start_point); // round dx down to avoid going too far if (dxdy < 0) @@ -974,7 +975,7 @@ static unsigned int nsvg__applyOpacity(unsigned int c, float u) return nsvg__RGBA((unsigned char)r, (unsigned char)g, (unsigned char)b, (unsigned char)a); } -static inline int nsvg__div255(int x) +static int nsvg__div255(int x) { return ((x+1) * 257) >> 16; }