summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp11
-rw-r--r--core/fpdfapi/page/cpdf_page.h3
-rw-r--r--fpdfsdk/fpdf_view.cpp3
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp11
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.h3
5 files changed, 14 insertions, 17 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 259e8ce0fb..d679766273 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -126,13 +126,12 @@ Optional<CFX_PointF> CPDF_Page::DeviceToPage(
return page2device.GetInverse().Transform(device_point);
}
-Optional<CFX_PointF> CPDF_Page::PageToDevice(const FX_RECT& rect,
- int rotate,
- double page_x,
- double page_y) const {
+Optional<CFX_PointF> CPDF_Page::PageToDevice(
+ const FX_RECT& rect,
+ int rotate,
+ const CFX_PointF& page_point) const {
CFX_Matrix page2device = GetDisplayMatrix(rect, rotate);
- return page2device.Transform(
- CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)));
+ return page2device.Transform(page_point);
}
CFX_Matrix CPDF_Page::GetDisplayMatrix(const FX_RECT& rect, int iRotate) const {
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index 34c9ef45a8..0f401ea9b9 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -39,8 +39,7 @@ class CPDF_Page : public CPDF_PageObjectHolder {
const CFX_PointF& device_point) const;
Optional<CFX_PointF> PageToDevice(const FX_RECT& rect,
int rotate,
- double page_x,
- double page_y) const;
+ const CFX_PointF& page_point) const;
CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const;
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index f2fa43f369..cd8edbbdd2 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -771,7 +771,8 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_PageToDevice(FPDF_PAGE page,
UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
- Optional<CFX_PointF> pos = pPage->PageToDevice(rect, rotate, page_x, page_y);
+ CFX_PointF page_point(static_cast<float>(page_x), static_cast<float>(page_y));
+ Optional<CFX_PointF> pos = pPage->PageToDevice(rect, rotate, page_point);
if (!pos)
return false;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 8fea85d72b..8268ed8759 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -138,16 +138,15 @@ Optional<CFX_PointF> CPDFXFA_Page::DeviceToPage(
return pos;
}
-Optional<CFX_PointF> CPDFXFA_Page::PageToDevice(const FX_RECT& rect,
- int rotate,
- double page_x,
- double page_y) const {
+Optional<CFX_PointF> CPDFXFA_Page::PageToDevice(
+ const FX_RECT& rect,
+ int rotate,
+ const CFX_PointF& page_point) const {
if (!m_pPDFPage && !m_pXFAPageView)
return {};
CFX_Matrix page2device = GetDisplayMatrix(rect, rotate);
- return page2device.Transform(
- CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)));
+ return page2device.Transform(page_point);
}
CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(const FX_RECT& rect,
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index 131e811b66..0a5e3fcc14 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -44,8 +44,7 @@ class CPDFXFA_Page : public Retainable {
const CFX_PointF& device_point) const;
Optional<CFX_PointF> PageToDevice(const FX_RECT& rect,
int rotate,
- double page_x,
- double page_y) const;
+ const CFX_PointF& page_point) const;
CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const;