summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-25 10:29:58 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-25 17:44:29 +0000
commit6302288dec6111120749754ba8ec2d249b63404b (patch)
treeea760932b163690fe5274716735b5c5d538615b2
parentd1e01de5f0776700cd52f06569f4fc0bd34e74d6 (diff)
downloadpdfium-6302288dec6111120749754ba8ec2d249b63404b.tar.xz
Rename core/fxcrt/fx_basic_coords.cpp to fx_coordinates.cpp
Its contents are delcared in fx_coordinates.h Remove unused GetIntersection(). Move FXSYS_round to fx_system.cpp. Change-Id: I70749581d1321dd919e35fa2daab9591098f68e9 Reviewed-on: https://pdfium-review.googlesource.com/4479 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
-rw-r--r--BUILD.gn2
-rw-r--r--core/fxcrt/fx_coordinates.cpp (renamed from core/fxcrt/fx_basic_coords.cpp)27
-rw-r--r--core/fxcrt/fx_system.cpp10
3 files changed, 13 insertions, 26 deletions
diff --git a/BUILD.gn b/BUILD.gn
index ba36cfbc74..3b48762407 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -766,7 +766,6 @@ static_library("fxcrt") {
"core/fxcrt/cfx_widestring.h",
"core/fxcrt/fx_basic.h",
"core/fxcrt/fx_basic_buffer.cpp",
- "core/fxcrt/fx_basic_coords.cpp",
"core/fxcrt/fx_basic_gcc.cpp",
"core/fxcrt/fx_basic_memmgr.cpp",
"core/fxcrt/fx_basic_utf.cpp",
@@ -774,6 +773,7 @@ static_library("fxcrt") {
"core/fxcrt/fx_bidi.cpp",
"core/fxcrt/fx_bidi.h",
"core/fxcrt/fx_codepage.h",
+ "core/fxcrt/fx_coordinates.cpp",
"core/fxcrt/fx_coordinates.h",
"core/fxcrt/fx_extension.cpp",
"core/fxcrt/fx_extension.h",
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,