summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_coordinates.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-06-29 12:02:06 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-29 20:50:09 +0000
commitb21f174ad87e46c823c2ef8c11682167e2d12864 (patch)
tree79c3661672cbd2f84ee835f9922231bb90a634b3 /core/fxcrt/fx_coordinates.cpp
parent8ce58f522e046ae3b1561d592ca7b3cd7c894731 (diff)
downloadpdfium-b21f174ad87e46c823c2ef8c11682167e2d12864.tar.xz
Change SetReverse to GetInverse in CFX_Matrix
CFX_Matrix::GetInverse is much clearer. Change-Id: Id10ab1723735332e1a78de853f28415ec3a4d834 Reviewed-on: https://pdfium-review.googlesource.com/7090 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_coordinates.cpp')
-rw-r--r--core/fxcrt/fx_coordinates.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp
index 27c0a95ee4..0b6aed44cc 100644
--- a/core/fxcrt/fx_coordinates.cpp
+++ b/core/fxcrt/fx_coordinates.cpp
@@ -197,18 +197,20 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) {
return CFX_FloatRect(min_x, min_y, max_x, max_y);
}
-void CFX_Matrix::SetReverse(const CFX_Matrix& m) {
- float i = m.a * m.d - m.b * m.c;
+CFX_Matrix CFX_Matrix::GetInverse() const {
+ CFX_Matrix inverse;
+ float i = a * d - b * c;
if (fabs(i) == 0)
- return;
+ return inverse;
float j = -i;
- a = m.d / i;
- b = m.b / j;
- c = m.c / j;
- d = m.a / i;
- e = (m.c * m.f - m.d * m.e) / i;
- f = (m.a * m.f - m.b * m.e) / j;
+ inverse.a = d / i;
+ inverse.b = b / j;
+ inverse.c = c / j;
+ inverse.d = a / i;
+ inverse.e = (c * f - d * e) / i;
+ inverse.f = (a * f - b * e) / j;
+ return inverse;
}
void CFX_Matrix::Concat(const CFX_Matrix& m, bool bPrepended) {
@@ -216,9 +218,7 @@ void CFX_Matrix::Concat(const CFX_Matrix& m, bool bPrepended) {
}
void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, bool bPrepended) {
- CFX_Matrix m;
- m.SetReverse(src);
- Concat(m, bPrepended);
+ Concat(src.GetInverse(), bPrepended);
}
bool CFX_Matrix::Is90Rotated() const {