changeset 11522:948afa0c0057

8151998: VS2010 ThemeReader.cpp(758) : error C3861: 'round': identifier not found Reviewed-by: serb, ssadetsky
author alexsch
date Mon, 11 Apr 2016 15:00:37 +0400
parents 411e42b16d22
children b839c9068d11 fc52c90e812f
files src/windows/native/sun/windows/ThemeReader.cpp src/windows/native/sun/windows/awt_DesktopProperties.cpp
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/windows/ThemeReader.cpp	Mon Apr 11 14:56:20 2016 +0400
+++ b/src/windows/native/sun/windows/ThemeReader.cpp	Mon Apr 11 15:00:37 2016 +0400
@@ -70,6 +70,11 @@
 #define TMT_TRANSPARENT 2201
 #endif // _UXTHEME_H_
 
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#  define ROUND_TO_INT(num)    ((int) round(num))
+#else
+#  define ROUND_TO_INT(num)    ((int) floor((num) + 0.5))
+#endif
 
 #define ALPHA_MASK 0xff000000
 #define RED_MASK 0xff0000
@@ -755,11 +760,11 @@
 
     if (dpiX !=0 && dpiX != 96) {
         float invScaleX = 96.0f / dpiX;
-        size->cx = (int)round(size->cx * invScaleX);
+        size->cx = ROUND_TO_INT(size->cx * invScaleX);
     }
     if (dpiY != 0 && dpiY != 96) {
         float invScaleY = 96.0f / dpiY;
-        size->cy = (int)round(size->cy * invScaleY);
+        size->cy = ROUND_TO_INT(size->cy * invScaleY);
     }
     ::ReleaseDC(hWnd, hDC);
 }
--- a/src/windows/native/sun/windows/awt_DesktopProperties.cpp	Mon Apr 11 14:56:20 2016 +0400
+++ b/src/windows/native/sun/windows/awt_DesktopProperties.cpp	Mon Apr 11 15:00:37 2016 +0400
@@ -37,6 +37,12 @@
 
 #include "math.h"
 
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#  define ROUND_TO_INT(num)    ((int) round(num))
+#else
+#  define ROUND_TO_INT(num)    ((int) floor((num) + 0.5))
+#endif
+
 // WDesktopProperties fields
 jfieldID AwtDesktopProperties::pDataID = 0;
 jmethodID AwtDesktopProperties::setBooleanPropertyID = 0;
@@ -92,7 +98,7 @@
 }
 
 int rescale(int value, float invScale){
-    return invScale == 1.0f ? value : (int)round(value * invScale);
+    return invScale == 1.0f ? value : ROUND_TO_INT(value * invScale);
 }
 
 void AwtDesktopProperties::GetSystemProperties() {