From afb44560a21298b3588b36cbaf45e2be50f2e75b Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 9 Feb 2017 13:07:43 -0500 Subject: Remove Transform in favour of TransformPoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxcrt/fx_basic_coords.cpp | 44 +++++++++++++++--------------------------- core/fxcrt/fx_coordinates.h | 6 ------ 2 files changed, 16 insertions(+), 34 deletions(-) (limited to 'core/fxcrt') 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 +#include + #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; -- cgit v1.2.3