diff options
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/fx_coordinates.cpp (renamed from core/fxcrt/fx_basic_coords.cpp) | 27 | ||||
-rw-r--r-- | core/fxcrt/fx_system.cpp | 10 |
2 files changed, 12 insertions, 25 deletions
diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_coordinates.cpp index 9c83ddfbd0..ca40a42227 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_coordinates.cpp @@ -4,11 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include <limits.h> +#include "core/fxcrt/fx_coordinates.h" #include <algorithm> -#include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_extension.h" namespace { @@ -38,6 +37,7 @@ void FX_RECT::Normalize() { bottom = temp; } } + void FX_RECT::Intersect(const FX_RECT& src) { FX_RECT src_n = src; src_n.Normalize(); @@ -51,29 +51,6 @@ void FX_RECT::Intersect(const FX_RECT& src) { } } -bool GetIntersection(float low1, - float high1, - float low2, - float high2, - float& interlow, - float& interhigh) { - if (low1 >= high2 || low2 >= high1) { - return false; - } - interlow = low1 > low2 ? low1 : low2; - interhigh = high1 > high2 ? high2 : high1; - return true; -} -extern "C" int FXSYS_round(float d) { - if (d < (float)INT_MIN) { - return INT_MIN; - } - if (d > (float)INT_MAX) { - return INT_MAX; - } - - return (int)round(d); -} CFX_FloatRect::CFX_FloatRect(const FX_RECT& rect) { left = (float)(rect.left); right = (float)(rect.right); diff --git a/core/fxcrt/fx_system.cpp b/core/fxcrt/fx_system.cpp index d2b04f502a..cf1c7e5920 100644 --- a/core/fxcrt/fx_system.cpp +++ b/core/fxcrt/fx_system.cpp @@ -6,6 +6,16 @@ #include "core/fxcrt/fx_system.h" +#include <limits> + +extern "C" int FXSYS_round(float d) { + if (d < static_cast<float>(std::numeric_limits<int>::min())) + return std::numeric_limits<int>::min(); + if (d > static_cast<float>(std::numeric_limits<int>::max())) + return std::numeric_limits<int>::max(); + return static_cast<int>(round(d)); +} + #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ size_t FXSYS_wcsftime(wchar_t* strDest, |