From: bungeman Date: Tue, 21 Jul 2015 21:14:30 +0000 (-0700) Subject: Compile with VS2015. X-Git-Tag: submit/tizen/20180928.044319~1632 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b7069e9c1f65d11f9581be0adbffa968257afc33;p=platform%2Fupstream%2FlibSkiaSharp.git Compile with VS2015. Visual Studio 2015 has additional warnings around noexcept and disabling exceptions, which can be worked around with the (undocumented) _HAS_EXCEPTIONS macro. Visual Studio 2013 and 2015 have roundf in math.h, so use it to avoid extra work and casts. We avoid using cmath, as it undefs isfinite on gcc, but Visual Studio 2015 no longer provides overloads of copysign from math.h (which is actually correct). As a result, use copysignf (which is available in math.h in 2013 and 2015) directly. Review URL: https://codereview.chromium.org/1244173005 --- diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi index b088b7a06d..ba4337403d 100644 --- a/gyp/common_conditions.gypi +++ b/gyp/common_conditions.gypi @@ -46,6 +46,7 @@ 'SK_BUILD_FOR_WIN32', '_CRT_SECURE_NO_WARNINGS', 'GR_GL_FUNCTION_TYPE=__stdcall', + '_HAS_EXCEPTIONS=0', ], 'msvs_disabled_warnings': [ 4275, # An exported class was derived from a class that was not exported diff --git a/include/core/SkFloatingPoint.h b/include/core/SkFloatingPoint.h index 432f53d22a..ad1669c4ee 100644 --- a/include/core/SkFloatingPoint.h +++ b/include/core/SkFloatingPoint.h @@ -38,7 +38,7 @@ static inline float sk_float_copysign(float x, float y) { # define SK_BUILD_WITH_CLANG_CL 0 #endif #if (!SK_BUILD_WITH_CLANG_CL && __cplusplus >= 201103L) || (_MSC_VER >= 1800) - return copysign(x, y); + return copysignf(x, y); // Posix has demanded 'float copysignf(float, float)' (from C99) since Issue 6. #elif defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp index 3c5fc2e35c..8047844307 100644 --- a/samplecode/SampleRegion.cpp +++ b/samplecode/SampleRegion.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2011 Google Inc. * @@ -15,6 +14,8 @@ #include "SkUtils.h" #include "SkImageDecoder.h" +#include + static void test_strokerect(SkCanvas* canvas) { int width = 100; int height = 100; @@ -115,11 +116,6 @@ static void test_text(SkCanvas* canvas) { drawFadingText(canvas, str, len, x, y, paint); } -#ifdef SK_BUILD_FOR_WIN -// windows doesn't have roundf -inline float roundf(float x) { return (x-floor(x))>0.5 ? ceil(x) : floor(x); } -#endif - #ifdef SK_DEBUG static void make_rgn(SkRegion* rgn, int left, int top, int right, int bottom, int count, int32_t runs[]) {