diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-18 21:16:37 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-18 21:16:37 +0000 |
commit | 84febc1ce83be4e6d5fa7686e4e4af83ba621692 (patch) | |
tree | 522fafd05fe6e13e40514c3d44a6da4d0f223bae | |
parent | 31beedc1e833842385b20b40d0ef27dbfc979443 (diff) | |
download | pdfium-84febc1ce83be4e6d5fa7686e4e4af83ba621692.tar.xz |
Remove unused form of CFX_Matrix::TransformRect().
Change-Id: I8e6c5fdf301ca408e76d9acfe6e62db9afd3d7a7
Reviewed-on: https://pdfium-review.googlesource.com/c/43575
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r-- | core/fxcrt/fx_coordinates.cpp | 46 | ||||
-rw-r--r-- | core/fxcrt/fx_coordinates.h | 6 |
2 files changed, 16 insertions, 36 deletions
diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp index f85394ca5c..7d0d104122 100644 --- a/core/fxcrt/fx_coordinates.cpp +++ b/core/fxcrt/fx_coordinates.cpp @@ -416,45 +416,31 @@ CFX_PointF CFX_Matrix::Transform(const CFX_PointF& point) const { return CFX_PointF(a * point.x + c * point.y + e, b * point.x + d * point.y + f); } -std::tuple<float, float, float, float> CFX_Matrix::TransformRect( - const float& left, - const float& right, - const float& top, - const float& bottom) const { - CFX_PointF points[] = { - {left, top}, {left, bottom}, {right, top}, {right, bottom}}; - for (int i = 0; i < 4; i++) - points[i] = Transform(points[i]); + +CFX_RectF CFX_Matrix::TransformRect(const CFX_RectF& rect) const { + CFX_FloatRect result_rect = TransformRect(rect.ToFloatRect()); + return CFX_RectF(result_rect.left, result_rect.bottom, result_rect.Width(), + result_rect.Height()); +} + +CFX_FloatRect CFX_Matrix::TransformRect(const CFX_FloatRect& rect) const { + CFX_PointF points[] = {{rect.left, rect.top}, + {rect.left, rect.bottom}, + {rect.right, rect.top}, + {rect.right, rect.bottom}}; + for (CFX_PointF& point : points) + point = Transform(point); float new_right = points[0].x; float new_left = points[0].x; float new_top = points[0].y; float new_bottom = points[0].y; - for (int i = 1; i < 4; i++) { + for (size_t i = 1; i < FX_ArraySize(points); i++) { new_right = std::max(new_right, points[i].x); new_left = std::min(new_left, points[i].x); new_top = std::max(new_top, points[i].y); new_bottom = std::min(new_bottom, points[i].y); } - return std::make_tuple(new_left, new_right, new_top, new_bottom); -} -CFX_RectF CFX_Matrix::TransformRect(const CFX_RectF& rect) const { - float left; - float right; - float bottom; - float top; - std::tie(left, right, bottom, top) = - TransformRect(rect.left, rect.right(), rect.bottom(), rect.top); - return CFX_RectF(left, top, right - left, bottom - top); -} - -CFX_FloatRect CFX_Matrix::TransformRect(const CFX_FloatRect& rect) const { - float left; - float right; - float top; - float bottom; - std::tie(left, right, top, bottom) = - TransformRect(rect.left, rect.right, rect.top, rect.bottom); - return CFX_FloatRect(left, bottom, right, top); + return CFX_FloatRect(new_left, new_bottom, new_right, new_top); } diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 4a63a6ca37..08dbd08903 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -8,7 +8,6 @@ #define CORE_FXCRT_FX_COORDINATES_H_ #include <algorithm> -#include <tuple> #include "core/fxcrt/fx_system.h" #include "third_party/base/numerics/safe_math.h" @@ -590,11 +589,6 @@ class CFX_Matrix { CFX_PointF Transform(const CFX_PointF& point) const; - std::tuple<float, float, float, float> TransformRect( - const float& left, - const float& right, - const float& top, - const float& bottom) const; CFX_RectF TransformRect(const CFX_RectF& rect) const; CFX_FloatRect TransformRect(const CFX_FloatRect& rect) const; |