From e937a513c6c4709bcb85e11be323f7f836c78096 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Tue, 25 Feb 2014 23:03:34 +0200 Subject: [PATCH] Fix for unpremultiply, osx compiling - fixed compiling on osx mavericks - fixed unpremultiply --- premake4.lua | 4 ++-- src/nanosvgrast.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/premake4.lua b/premake4.lua index 491fc05..3869821 100644 --- a/premake4.lua +++ b/premake4.lua @@ -21,7 +21,7 @@ solution "nanosvg" configuration { "macosx" } links { "glfw3" } - linkoptions { "-framework OpenGL", "-framework Cocoa", "-framework IOKit" } + linkoptions { "-framework OpenGL", "-framework Cocoa", "-framework IOKit", "-framework CoreVideo" } configuration "Debug" defines { "DEBUG" } @@ -46,7 +46,7 @@ solution "nanosvg" configuration { "macosx" } links { "glfw3" } - linkoptions { "-framework OpenGL", "-framework Cocoa", "-framework IOKit" } + linkoptions { "-framework OpenGL", "-framework Cocoa", "-framework IOKit", "-framework CoreVideo" } configuration "Debug" defines { "DEBUG" } diff --git a/src/nanosvgrast.h b/src/nanosvgrast.h index 57394de..c489f30 100644 --- a/src/nanosvgrast.h +++ b/src/nanosvgrast.h @@ -620,9 +620,9 @@ static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int str for (x = 0; x < w; x++) { int r = row[0], g = row[1], b = row[2], a = row[3]; if (a != 0) { - r = (r*255/a); - g = (g*255/a); - b = (b*255/a); + row[0] = (int)(r*255/a); + row[1] = (int)(g*255/a); + row[2] = (int)(b*255/a); } row += 4; }