summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/fx_basic_coords.cpp44
-rw-r--r--core/fxcrt/fx_coordinates.h6
2 files changed, 16 insertions, 34 deletions
diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp
index 2664b52e7e..c76e6c9060 100644
--- a/core/fxcrt/fx_basic_coords.cpp
+++ b/core/fxcrt/fx_basic_coords.cpp
@@ -6,6 +6,8 @@
#include <limits.h>
+#include <algorithm>
+
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_ext.h"
@@ -457,33 +459,19 @@ void CFX_Matrix::TransformRect(FX_FLOAT& left,
FX_FLOAT& right,
FX_FLOAT& top,
FX_FLOAT& bottom) const {
- FX_FLOAT x[4], y[4];
- x[0] = left;
- y[0] = top;
- x[1] = left;
- y[1] = bottom;
- x[2] = right;
- y[2] = top;
- x[3] = right;
- y[3] = bottom;
- int i;
- for (i = 0; i < 4; i++) {
- Transform(x[i], y[i], x[i], y[i]);
- }
- right = left = x[0];
- top = bottom = y[0];
- for (i = 1; i < 4; i++) {
- if (right < x[i]) {
- right = x[i];
- }
- if (left > x[i]) {
- left = x[i];
- }
- if (top < y[i]) {
- top = y[i];
- }
- if (bottom > y[i]) {
- bottom = y[i];
- }
+ FX_FLOAT x[4] = {left, left, right, right};
+ FX_FLOAT y[4] = {top, bottom, top, bottom};
+ for (int i = 0; i < 4; i++)
+ TransformPoint(x[i], y[i]);
+
+ right = x[0];
+ left = x[0];
+ top = y[0];
+ bottom = y[0];
+ for (int i = 1; i < 4; i++) {
+ right = std::max(right, x[i]);
+ left = std::min(left, x[i]);
+ top = std::max(top, y[i]);
+ bottom = std::min(bottom, y[i]);
}
}
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h
index 4551a4a5c8..a1638fdbb5 100644
--- a/core/fxcrt/fx_coordinates.h
+++ b/core/fxcrt/fx_coordinates.h
@@ -675,12 +675,6 @@ class CFX_Matrix {
void TransformPoint(FX_FLOAT& x, FX_FLOAT& y) const;
void TransformPoint(int32_t& x, int32_t& y) const;
- void Transform(FX_FLOAT& x, FX_FLOAT& y) const { TransformPoint(x, y); }
- void Transform(FX_FLOAT x, FX_FLOAT y, FX_FLOAT& x1, FX_FLOAT& y1) const {
- x1 = x, y1 = y;
- TransformPoint(x1, y1);
- }
-
void TransformVector(CFX_VectorF& v) const;
void TransformVector(CFX_Vector& v) const;
void TransformRect(CFX_RectF& rect) const;