diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-09 09:17:20 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-09 15:04:51 +0000 |
commit | 1b08df18300bbc67dabd12fb35ab6ce1732a1024 (patch) | |
tree | 9773931c8d18709860c9fbc1177e290e7713044e /fpdfsdk/fpdfxfa | |
parent | ac2e04797b258115b2dc768a56377d7e78038f42 (diff) | |
download | pdfium-1b08df18300bbc67dabd12fb35ab6ce1732a1024.tar.xz |
Convert Get methods to return instead of using out params.
This Cl changes several Get methods to return their values instead of using
out parameters.
Change-Id: Ie9a930a5c2d0e809f2d7181ca033d801945c1cf9
Reviewed-on: https://pdfium-review.googlesource.com/2556
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_page.cpp | 83 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_page.h | 11 |
2 files changed, 45 insertions, 49 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp index 8011295f96..f39a01078e 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp @@ -101,17 +101,16 @@ FX_FLOAT CPDFXFA_Page::GetPageWidth() const { int nDocType = m_pContext->GetDocType(); switch (nDocType) { case DOCTYPE_DYNAMIC_XFA: { - if (m_pXFAPageView) { - CFX_RectF rect; - m_pXFAPageView->GetPageViewRect(rect); - return rect.width; - } - } break; + if (m_pXFAPageView) + return m_pXFAPageView->GetPageViewRect().width; + break; + } case DOCTYPE_STATIC_XFA: case DOCTYPE_PDF: { if (m_pPDFPage) return m_pPDFPage->GetPageWidth(); - } break; + break; + } default: return 0.0f; } @@ -129,14 +128,13 @@ FX_FLOAT CPDFXFA_Page::GetPageHeight() const { case DOCTYPE_STATIC_XFA: { if (m_pPDFPage) return m_pPDFPage->GetPageHeight(); - } break; + break; + } case DOCTYPE_DYNAMIC_XFA: { - if (m_pXFAPageView) { - CFX_RectF rect; - m_pXFAPageView->GetPageViewRect(rect); - return rect.height; - } - } break; + if (m_pXFAPageView) + return m_pXFAPageView->GetPageViewRect().height; + break; + } default: return 0.0f; } @@ -158,16 +156,14 @@ void CPDFXFA_Page::DeviceToPage(int start_x, FX_FLOAT page_x_f, page_y_f; - CFX_Matrix page2device; - GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate); - CFX_Matrix device2page; - device2page.SetReverse(page2device); - device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f, - page_y_f); + device2page.SetReverse( + GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate)); + device2page.Transform(static_cast<FX_FLOAT>(device_x), + static_cast<FX_FLOAT>(device_y), page_x_f, page_y_f); - *page_x = (page_x_f); - *page_y = (page_y_f); + *page_x = page_x_f; + *page_y = page_y_f; } void CPDFXFA_Page::PageToDevice(int start_x, @@ -182,42 +178,43 @@ void CPDFXFA_Page::PageToDevice(int start_x, if (!m_pPDFPage && !m_pXFAPageView) return; - FX_FLOAT device_x_f, device_y_f; - - CFX_Matrix page2device; - GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate); + FX_FLOAT device_x_f; + FX_FLOAT device_y_f; - page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, - device_y_f); + CFX_Matrix page2device = + GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate); + page2device.Transform(static_cast<FX_FLOAT>(page_x), + static_cast<FX_FLOAT>(page_y), device_x_f, device_y_f); *device_x = FXSYS_round(device_x_f); *device_y = FXSYS_round(device_y_f); } -void CPDFXFA_Page::GetDisplayMatrix(CFX_Matrix& matrix, - int xPos, - int yPos, - int xSize, - int ySize, - int iRotate) const { +CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos, + int yPos, + int xSize, + int ySize, + int iRotate) const { if (!m_pPDFPage && !m_pXFAPageView) - return; + return CFX_Matrix(); int nDocType = m_pContext->GetDocType(); switch (nDocType) { case DOCTYPE_DYNAMIC_XFA: { if (m_pXFAPageView) { - CFX_Rect rect(xPos, yPos, xSize, ySize); - m_pXFAPageView->GetDisplayMatrix(matrix, rect, iRotate); + return m_pXFAPageView->GetDisplayMatrix( + CFX_Rect(xPos, yPos, xSize, ySize), iRotate); } - } break; + break; + } case DOCTYPE_PDF: case DOCTYPE_STATIC_XFA: { - if (m_pPDFPage) { - m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate); - } - } break; + if (m_pPDFPage) + return m_pPDFPage->GetDisplayMatrix(xPos, yPos, xSize, ySize, iRotate); + break; + } default: - return; + return CFX_Matrix(); } + return CFX_Matrix(); } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h index 79158f4ea7..993885d59e 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h @@ -60,12 +60,11 @@ class CPDFXFA_Page { int* device_x, int* device_y); - void GetDisplayMatrix(CFX_Matrix& matrix, - int xPos, - int yPos, - int xSize, - int ySize, - int iRotate) const; + CFX_Matrix GetDisplayMatrix(int xPos, + int yPos, + int xSize, + int ySize, + int iRotate) const; protected: // Refcounted class. |