Make CPDFSDK_PageView::GetCurrentMatrix() a normal getter.
Return the matrix instead of setting an out parameter. Simplify callers
along the way.
Change-Id: Ia9b64c06a9cdab0d0a020c4c99d1a76e98ffc007
Reviewed-on: https://pdfium-review.googlesource.com/c/47430
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index fae3282..42d1970 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -35,11 +35,7 @@
if (!pPage || !pPageView)
return;
- CFX_Matrix page2device;
- pPageView->GetCurrentMatrix(page2device);
-
- CFX_Matrix device2page = page2device.GetInverse();
-
+ CFX_Matrix device2page = pPageView->GetCurrentMatrix().GetInverse();
CFX_PointF left_top = device2page.Transform(CFX_PointF(rect.left, rect.top));
CFX_PointF right_bottom =
device2page.Transform(CFX_PointF(rect.right, rect.bottom));
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index c3cbbc6..d877a70 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -82,7 +82,7 @@
const CFX_PointF& point,
int nFlag);
- void GetCurrentMatrix(CFX_Matrix& matrix) { matrix = m_curMatrix; }
+ const CFX_Matrix& GetCurrentMatrix() const { return m_curMatrix; }
void UpdateRects(const std::vector<CFX_FloatRect>& rects);
void UpdateView(CPDFSDK_Annot* pAnnot);
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index c3e1eb9..377e068 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -673,9 +673,7 @@
if (!m_pInteractiveForm->IsNeedHighLight(fieldType))
return;
- CFX_Matrix page2device;
- pPageView->GetCurrentMatrix(page2device);
-
+ CFX_Matrix page2device = pPageView->GetCurrentMatrix();
CFX_FloatRect rcDevice = GetRect();
CFX_PointF tmp =
page2device.Transform(CFX_PointF(rcDevice.left, rcDevice.bottom));
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 91e16e8..50787b2 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -424,10 +424,8 @@
if (!pPrivateData || !pPrivateData->pPageView)
return mt;
- CFX_Matrix mtPageView;
- pPrivateData->pPageView->GetCurrentMatrix(mtPageView);
mt = GetCurMatrix();
- mt.Concat(mtPageView);
+ mt.Concat(pPrivateData->pPageView->GetCurrentMatrix());
return mt;
}