summaryrefslogtreecommitdiff
path: root/fpdfsdk
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 /fpdfsdk
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 'fpdfsdk')
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp3
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp15
-rw-r--r--fpdfsdk/fpdfview.cpp4
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp10
-rw-r--r--fpdfsdk/pdfwindow/cpwl_icon.cpp3
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.cpp8
6 files changed, 16 insertions, 27 deletions
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index d38c6270f7..882351145e 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -49,8 +49,7 @@ void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget, FX_RECT rect) {
CFX_Matrix page2device;
pPageView->GetCurrentMatrix(page2device);
- CFX_Matrix device2page;
- device2page.SetReverse(page2device);
+ CFX_Matrix device2page = page2device.GetInverse();
CFX_PointF left_top = device2page.Transform(
CFX_PointF(static_cast<float>(rect.left), static_cast<float>(rect.top)));
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 526f4b947d..565d2babdd 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -459,28 +459,19 @@ CFX_FloatRect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) {
}
CFX_FloatRect CFFL_FormFiller::FFLtoPWL(const CFX_FloatRect& rect) {
- CFX_Matrix mt;
- mt.SetReverse(GetCurMatrix());
-
CFX_FloatRect temp = rect;
- mt.TransformRect(temp);
-
+ GetCurMatrix().GetInverse().TransformRect(temp);
return temp;
}
CFX_FloatRect CFFL_FormFiller::PWLtoFFL(const CFX_FloatRect& rect) {
- CFX_Matrix mt = GetCurMatrix();
-
CFX_FloatRect temp = rect;
- mt.TransformRect(temp);
-
+ GetCurMatrix().TransformRect(temp);
return temp;
}
CFX_PointF CFFL_FormFiller::FFLtoPWL(const CFX_PointF& point) {
- CFX_Matrix mt;
- mt.SetReverse(GetCurMatrix());
- return mt.Transform(point);
+ return GetCurMatrix().GetInverse().Transform(point);
}
CFX_PointF CFFL_FormFiller::PWLtoFFL(const CFX_PointF& point) {
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 68ef377dc8..ccd487aa4d 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -1031,10 +1031,8 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
#else // PDF_ENABLE_XFA
CFX_Matrix page2device =
pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
- CFX_Matrix device2page;
- device2page.SetReverse(page2device);
- CFX_PointF pos = device2page.Transform(
+ CFX_PointF pos = page2device.GetInverse().Transform(
CFX_PointF(static_cast<float>(device_x), static_cast<float>(device_y)));
*page_x = pos.x;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 24858f2f1a..87e003e147 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -143,12 +143,10 @@ void CPDFXFA_Page::DeviceToPage(int start_x,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- CFX_Matrix device2page;
- device2page.SetReverse(
- GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate));
-
- CFX_PointF pos = device2page.Transform(
- CFX_PointF(static_cast<float>(device_x), static_cast<float>(device_y)));
+ CFX_PointF pos = GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate)
+ .GetInverse()
+ .Transform(CFX_PointF(static_cast<float>(device_x),
+ static_cast<float>(device_y)));
*page_x = pos.x;
*page_y = pos.y;
diff --git a/fpdfsdk/pdfwindow/cpwl_icon.cpp b/fpdfsdk/pdfwindow/cpwl_icon.cpp
index 6650311915..ebf3b4fc12 100644
--- a/fpdfsdk/pdfwindow/cpwl_icon.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_icon.cpp
@@ -23,8 +23,7 @@ CFX_ByteString CPWL_Image::GetImageAppStream() {
CFX_ByteString sAlias = GetImageAlias();
CFX_FloatRect rcPlate = GetClientRect();
- CFX_Matrix mt;
- mt.SetReverse(GetImageMatrix());
+ CFX_Matrix mt = GetImageMatrix().GetInverse();
float fHScale = 1.0f;
float fVScale = 1.0f;
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.cpp b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
index a8b5c31254..85a610eea5 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
@@ -765,7 +765,9 @@ CFX_PointF CPWL_Wnd::ParentToChild(const CFX_PointF& point) const {
if (mt.IsIdentity())
return point;
- mt.SetReverse(mt);
+ CFX_Matrix inverse = mt.GetInverse();
+ if (!inverse.IsIdentity())
+ mt = inverse;
return mt.Transform(point);
}
@@ -774,7 +776,9 @@ CFX_FloatRect CPWL_Wnd::ParentToChild(const CFX_FloatRect& rect) const {
if (mt.IsIdentity())
return rect;
- mt.SetReverse(mt);
+ CFX_Matrix inverse = mt.GetInverse();
+ if (!inverse.IsIdentity())
+ mt = inverse;
CFX_FloatRect rc = rect;
mt.TransformRect(rc);
return rc;