< prev index next >

src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp

Print this page

        

@@ -68,10 +68,15 @@
 } MARGINS, *PMARGINS;
 
 #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
 #define GREEN_MASK 0xff00
 #define BLUE_MASK 0xff

@@ -753,15 +758,15 @@
     int dpiX = ::GetDeviceCaps(hDC, LOGPIXELSX);
     int dpiY = ::GetDeviceCaps(hDC, LOGPIXELSY);
 
     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);
 }
 
 /*
< prev index next >