提交 d8742954 编写于 作者: A alexsch

8151998: VS2010 ThemeReader.cpp(758) : error C3861: 'round': identifier not found

Reviewed-by: serb, ssadetsky
上级 7858429e
...@@ -70,6 +70,11 @@ typedef struct _MARGINS ...@@ -70,6 +70,11 @@ typedef struct _MARGINS
#define TMT_TRANSPARENT 2201 #define TMT_TRANSPARENT 2201
#endif // _UXTHEME_H_ #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 ALPHA_MASK 0xff000000
#define RED_MASK 0xff0000 #define RED_MASK 0xff0000
...@@ -755,11 +760,11 @@ void rescale(SIZE *size) { ...@@ -755,11 +760,11 @@ void rescale(SIZE *size) {
if (dpiX !=0 && dpiX != 96) { if (dpiX !=0 && dpiX != 96) {
float invScaleX = 96.0f / dpiX; 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) { if (dpiY != 0 && dpiY != 96) {
float invScaleY = 96.0f / dpiY; float invScaleY = 96.0f / dpiY;
size->cy = (int)round(size->cy * invScaleY); size->cy = ROUND_TO_INT(size->cy * invScaleY);
} }
::ReleaseDC(hWnd, hDC); ::ReleaseDC(hWnd, hDC);
} }
......
...@@ -37,6 +37,12 @@ ...@@ -37,6 +37,12 @@
#include "math.h" #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 // WDesktopProperties fields
jfieldID AwtDesktopProperties::pDataID = 0; jfieldID AwtDesktopProperties::pDataID = 0;
jmethodID AwtDesktopProperties::setBooleanPropertyID = 0; jmethodID AwtDesktopProperties::setBooleanPropertyID = 0;
...@@ -92,7 +98,7 @@ void getInvScale(float &invScaleX, float &invScaleY) { ...@@ -92,7 +98,7 @@ void getInvScale(float &invScaleX, float &invScaleY) {
} }
int rescale(int value, float invScale){ 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() { void AwtDesktopProperties::GetSystemProperties() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册