summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/fxcrt/fx_basic_coords.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/src/fxcrt/fx_basic_coords.cpp b/core/src/fxcrt/fx_basic_coords.cpp
index 62061704c7..8e7bb3e751 100644
--- a/core/src/fxcrt/fx_basic_coords.cpp
+++ b/core/src/fxcrt/fx_basic_coords.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <limits.h>
#include "../../include/fxcrt/fx_ext.h"
void FX_RECT::Normalize()
{
@@ -53,15 +54,14 @@ FX_BOOL GetIntersection(FX_FLOAT low1, FX_FLOAT high1, FX_FLOAT low2, FX_FLOAT h
}
extern "C" int FXSYS_round(FX_FLOAT d)
{
- int iRet = 0;
- if (d >= 0.0f) {
- iRet = (int)(d + 0.5f);
- if (iRet >= 0) {
- return iRet;
- }
- return -iRet;
+ if (d < (FX_FLOAT)INT_MIN) {
+ return INT_MIN;
+ }
+ if (d > (FX_FLOAT)INT_MAX) {
+ return INT_MAX;
}
- return (int)(d - 0.5f);
+
+ return (int)round(d);
}
CFX_FloatRect::CFX_FloatRect(const FX_RECT& rect)
{