From d06cc38b76685b002c51b227ae43b8314d926ad8 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 30 May 2018 18:11:51 +0000 Subject: Make common page base class for XFA and non-XFA. Now that both are ref-counted, we can replace ifdef's with some polymorphism. Bug: pdfium:760 Change-Id: Ie22ea259c9af56fa569f0af268b8e7065789a3f2 Reviewed-on: https://pdfium-review.googlesource.com/32892 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- fpdfsdk/fpdf_view.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'fpdfsdk/fpdf_view.cpp') diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index 9af0ca4755..806b9d2b98 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -345,7 +345,7 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document, #ifdef PDF_ENABLE_XFA auto* pContext = static_cast(pDoc->GetExtension()); if (pContext) - return FPDFPageFromUnderlying(pContext->GetXFAPage(page_index).Leak()); + return FPDFPageFromIPDFPage(pContext->GetXFAPage(page_index).Leak()); // Eventually, fallthrough into non-xfa case once page type made consistent. return nullptr; @@ -355,17 +355,17 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document, return nullptr; RetainPtr pPage = pDoc->GetOrCreatePDFPage(pDict); - return FPDFPageFromUnderlying(pPage.Leak()); + return FPDFPageFromIPDFPage(pPage.Leak()); #endif // PDF_ENABLE_XFA } FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageWidth(FPDF_PAGE page) { - UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); + IPDF_Page* pPage = IPDFPageFromFPDFPage(page); return pPage ? pPage->GetPageWidth() : 0.0; } FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageHeight(FPDF_PAGE page) { - UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); + IPDF_Page* pPage = IPDFPageFromFPDFPage(page); return pPage ? pPage->GetPageHeight() : 0.0; } @@ -725,12 +725,12 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page) { return; // Take it back across the API and hold for duration of this function. - RetainPtr pPage; - pPage.Unleak(UnderlyingFromFPDFPage(page)); + RetainPtr pPage; + pPage.Unleak(IPDFPageFromFPDFPage(page)); #ifndef PDF_ENABLE_XFA CPDFSDK_PageView* pPageView = - static_cast(pPage->GetView()); + static_cast(pPage->AsPDFPage()->GetView()); if (!pPageView || pPageView->IsBeingDestroyed()) return; @@ -777,7 +777,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_DeviceToPage(FPDF_PAGE page, if (!page || !page_x || !page_y) return false; - UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); + IPDF_Page* pPage = IPDFPageFromFPDFPage(page); const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y); Optional pos = pPage->DeviceToPage(rect, rotate, CFX_PointF(device_x, device_y)); @@ -802,7 +802,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_PageToDevice(FPDF_PAGE page, if (!page || !device_x || !device_y) return false; - UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); + IPDF_Page* pPage = IPDFPageFromFPDFPage(page); const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y); CFX_PointF page_point(static_cast(page_x), static_cast(page_y)); Optional pos = pPage->PageToDevice(rect, rotate, page_point); -- cgit v1.2.3