diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-09 10:16:07 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-09 16:38:46 +0000 |
commit | 118a8e28783f42e089721eac4880f3b3f683e832 (patch) | |
tree | 879d6fb7b0442feff533c265fef3a48c71a4b91e /core/fxcrt | |
parent | 21e954b59fcef1b84fdcdb9ae337e2d4c060b19e (diff) | |
download | pdfium-118a8e28783f42e089721eac4880f3b3f683e832.tar.xz |
Replace rect.Transform(matrix) with matrix.TransformRect(rect)
This Cl removes the rect based transform method which internally just called
the matrix tranform method. The callers have been reversed to make it clearer
the matrix is transforming the rect.
Change-Id: I8ef57ccc2311e4e853b8180a6ff475f8eda2138e
Reviewed-on: https://pdfium-review.googlesource.com/2572
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/fx_basic_coords.cpp | 10 | ||||
-rw-r--r-- | core/fxcrt/fx_coordinates.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index dc207901f6..2664b52e7e 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -105,9 +105,7 @@ void CFX_FloatRect::Union(const CFX_FloatRect& other_rect) { bottom = bottom < other.bottom ? bottom : other.bottom; top = top > other.top ? top : other.top; } -void CFX_FloatRect::Transform(const CFX_Matrix* pMatrix) { - pMatrix->TransformRect(left, right, top, bottom); -} + int CFX_FloatRect::Substract4(CFX_FloatRect& s, CFX_FloatRect* pRects) { Normalize(); s.Normalize(); @@ -374,7 +372,7 @@ void CFX_Matrix::GetUnitRect(CFX_RectF& rect) const { } CFX_FloatRect CFX_Matrix::GetUnitRect() const { CFX_FloatRect rect(0, 0, 1, 1); - rect.Transform((const CFX_Matrix*)this); + TransformRect(rect); return rect; } FX_FLOAT CFX_Matrix::GetUnitArea() const { @@ -434,23 +432,27 @@ void CFX_Matrix::TransformPoint(int32_t& x, int32_t& y) const { x = FXSYS_round(fx); y = FXSYS_round(fy); } + void CFX_Matrix::TransformRect(CFX_RectF& rect) const { FX_FLOAT right = rect.right(), bottom = rect.bottom(); TransformRect(rect.left, right, bottom, rect.top); rect.width = right - rect.left; rect.height = bottom - rect.top; } + void CFX_Matrix::TransformRect(CFX_Rect& rect) const { FX_FLOAT left = (FX_FLOAT)rect.left; FX_FLOAT top = (FX_FLOAT)rect.bottom(); FX_FLOAT right = (FX_FLOAT)rect.right(); FX_FLOAT bottom = (FX_FLOAT)rect.top; + TransformRect(left, right, top, bottom); rect.left = FXSYS_round(left); rect.top = FXSYS_round(bottom); rect.width = FXSYS_round(right - left); rect.height = FXSYS_round(top - bottom); } + void CFX_Matrix::TransformRect(FX_FLOAT& left, FX_FLOAT& right, FX_FLOAT& top, diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 01436c7250..4551a4a5c8 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -498,7 +498,6 @@ class CFX_FloatRect { bool Contains(const CFX_FloatRect& other_rect) const; bool Contains(FX_FLOAT x, FX_FLOAT y) const; - void Transform(const CFX_Matrix* pMatrix); void Intersect(const CFX_FloatRect& other_rect); void Union(const CFX_FloatRect& other_rect); @@ -701,7 +700,6 @@ class CFX_Matrix { FX_FLOAT GetE() const { return e; } FX_FLOAT GetF() const { return f; } - public: FX_FLOAT a; FX_FLOAT b; FX_FLOAT c; |