summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_formfill.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-13 17:54:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-13 17:54:57 +0000
commitdae73f540c2aac24d94794f63a2142b1a9c91574 (patch)
tree4ce5624e4a6b0968fcc0ac6842c100cb7a67c23e /fpdfsdk/fpdf_formfill.cpp
parentc2b34d2adc6c987d882b4173265697917df74f54 (diff)
downloadpdfium-dae73f540c2aac24d94794f63a2142b1a9c91574.tar.xz
Tidy FFLCommon()
The polymorphic IPDF_Page::GetDocument() allows getting the document without special cases. The subsequent retrieval of the page view via the helper function is equivalent to the inline code in the other branch of the ifdef. Change-Id: I8c7008c18610e11e7dcc4151fa7369cfc3625049 Reviewed-on: https://pdfium-review.googlesource.com/35070 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_formfill.cpp')
-rw-r--r--fpdfsdk/fpdf_formfill.cpp32
1 files changed, 7 insertions, 25 deletions
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index cd4a8c5c32..01bea1cf0a 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -110,8 +110,8 @@ CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) {
}
CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
- FPDF_PAGE page) {
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ FPDF_PAGE fpdf_page) {
+ IPDF_Page* pPage = IPDFPageFromFPDFPage(fpdf_page);
if (!pPage)
return nullptr;
@@ -123,7 +123,7 @@ CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
void FFLCommon(FPDF_FORMHANDLE hHandle,
FPDF_BITMAP bitmap,
FPDF_RECORDER recorder,
- FPDF_PAGE page,
+ FPDF_PAGE fpdf_page,
int start_x,
int start_y,
int size_x,
@@ -133,25 +133,12 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
if (!hHandle)
return;
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ IPDF_Page* pPage = IPDFPageFromFPDFPage(fpdf_page);
if (!pPage)
return;
-#ifdef PDF_ENABLE_XFA
- CPDF_Document::Extension* pExtension =
- pPage->AsXFAPage()->GetDocumentExtension();
- if (!pExtension)
- return;
- CPDF_Document* pPDFDoc = pExtension->GetPDFDoc();
- if (!pPDFDoc)
- return;
- CPDFSDK_FormFillEnvironment* pFormFillEnv =
- HandleToCPDFSDKEnvironment(hHandle);
- if (!pFormFillEnv)
- return;
-#else // PDF_ENABLE_XFA
CPDF_Document* pPDFDoc = pPage->GetDocument();
-#endif // PDF_ENABLE_XFA
+ CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, fpdf_page);
const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
CFX_Matrix matrix = pPage->GetDisplayMatrix(rect, rotate);
@@ -160,6 +147,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
#ifdef _SKIA_SUPPORT_
pDevice->AttachRecorder(static_cast<SkPictureRecorder*>(recorder));
#endif
+
RetainPtr<CFX_DIBitmap> holder(CFXDIBitmapFromFPDFBitmap(bitmap));
pDevice->Attach(holder, false, nullptr, false);
{
@@ -182,16 +170,10 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
options.SetOCContext(
pdfium::MakeRetain<CPDF_OCContext>(pPDFDoc, CPDF_OCContext::View));
-#ifdef PDF_ENABLE_XFA
- CPDFSDK_PageView* pPageView = pFormFillEnv->GetPageView(pPage, true);
-#else // PDF_ENABLE_XFA
- CPDFSDK_PageView* pPageView =
- FormHandleToPageView(hHandle, FPDFPageFromIPDFPage(pPage));
-#endif // PDF_ENABLE_XFA
-
if (pPageView)
pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, rect);
}
+
#ifdef _SKIA_SUPPORT_PATHS_
pDevice->Flush(true);
holder->UnPreMultiply();