From c4242b24262d082f3ad70805aca779a3ff540c2c Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 12 Apr 2018 15:50:49 +0000 Subject: Change GetDisplayMatrix methods to take FX_RECT. Change-Id: I079bc3bf1242fd28fdd51930d9deb6efa34d7509 Reviewed-on: https://pdfium-review.googlesource.com/30055 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- fpdfsdk/fpdfxfa/cpdfxfa_page.cpp | 18 +++++++----------- fpdfsdk/fpdfxfa/cpdfxfa_page.h | 7 ++----- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'fpdfsdk/fpdfxfa') diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp index 0b4e8f60ee..a43707a9cf 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp @@ -138,7 +138,8 @@ void CPDFXFA_Page::DeviceToPage(int start_x, if (!m_pPDFPage && !m_pXFAPageView) return; - CFX_PointF pos = GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate) + const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y); + CFX_PointF pos = GetDisplayMatrix(rect, rotate) .GetInverse() .Transform(CFX_PointF(static_cast(device_x), static_cast(device_y))); @@ -159,8 +160,8 @@ void CPDFXFA_Page::PageToDevice(int start_x, if (!m_pPDFPage && !m_pXFAPageView) return; - CFX_Matrix page2device = - GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate); + const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y); + CFX_Matrix page2device = GetDisplayMatrix(rect, rotate); CFX_PointF pos = page2device.Transform( CFX_PointF(static_cast(page_x), static_cast(page_y))); @@ -169,10 +170,7 @@ void CPDFXFA_Page::PageToDevice(int start_x, *device_y = FXSYS_round(pos.y); } -CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos, - int yPos, - int xSize, - int ySize, +CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(const FX_RECT& rect, int iRotate) const { if (!m_pPDFPage && !m_pXFAPageView) return CFX_Matrix(); @@ -182,13 +180,11 @@ CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos, case FormType::kAcroForm: case FormType::kXFAForeground: if (m_pPDFPage) - return m_pPDFPage->GetDisplayMatrix(xPos, yPos, xSize, ySize, iRotate); + return m_pPDFPage->GetDisplayMatrix(rect, iRotate); FX_FALLTHROUGH; case FormType::kXFAFull: - if (m_pXFAPageView) { - FX_RECT rect = FX_RECT(xPos, yPos, xPos + xSize, yPos + ySize); + if (m_pXFAPageView) return m_pXFAPageView->GetDisplayMatrix(rect, iRotate); - } break; } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h index f64d66b10c..bdb4791c87 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h @@ -18,6 +18,7 @@ class CPDFXFA_Context; class CPDF_Dictionary; class CPDF_Page; class CXFA_FFPageView; +struct FX_RECT; class CPDFXFA_Page : public Retainable { public: @@ -57,11 +58,7 @@ class CPDFXFA_Page : public Retainable { int* device_x, int* device_y); - CFX_Matrix GetDisplayMatrix(int xPos, - int yPos, - int xSize, - int ySize, - int iRotate) const; + CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const; protected: // Refcounted class. -- cgit v1.2.3