diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-09 13:07:43 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-09 19:02:55 +0000 |
commit | afb44560a21298b3588b36cbaf45e2be50f2e75b (patch) | |
tree | 21f3ececad017e6be64a19c4370cfe9fd7f9c29c /core/fxcrt | |
parent | 67e4faaf8be0aebc67ebfb96d33933d9f9119d20 (diff) | |
download | pdfium-afb44560a21298b3588b36cbaf45e2be50f2e75b.tar.xz |
Remove Transform in favour of TransformPoint
This CL removes the two Transform() overrides from CFX_Matrix and calls the
TransformPoint methods directly. In the case of the 4 param version the
values were assigned to the out values before calling.
Change-Id: Id633826caec75b848774dcda6cfdcef2dbf5a7db
Reviewed-on: https://pdfium-review.googlesource.com/2573
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/fx_basic_coords.cpp | 44 | ||||
-rw-r--r-- | core/fxcrt/fx_coordinates.h | 6 |
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; |