Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: fpdfsdk/fpdfformfill.cpp

Issue 2307243002: Clean up redundant code in PDF_ENABLE_XFA guards in FFLCommon. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfformfill.cpp
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 263f5bbc593405e58995feb26044671431272fc4..449eac0870ec8d784624d451ee02ea152ee5b2d2 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -75,22 +75,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
if (!pPage)
return;
-#ifndef PDF_ENABLE_XFA
- CPDF_RenderOptions options;
- if (flags & FPDF_LCD_TEXT)
- options.m_Flags |= RENDER_CLEARTYPE;
- else
- options.m_Flags &= ~RENDER_CLEARTYPE;
- // Grayscale output
- if (flags & FPDF_GRAYSCALE) {
- options.m_ColorMode = RENDER_COLOR_GRAY;
- options.m_ForeColor = 0;
- options.m_BackColor = 0xffffff;
- }
- options.m_AddFlags = flags >> 8;
- options.m_pOCContext =
- new CPDF_OCContext(pPage->m_pDocument, CPDF_OCContext::View);
-#else // PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA
CPDFXFA_Document* pDocument = pPage->GetDocument();
if (!pDocument)
return;
@@ -116,10 +101,6 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
pDevice->SaveState();
pDevice->SetClip_Rect(clip);
-#ifndef PDF_ENABLE_XFA
- if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage))
- pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options);
-#else // PDF_ENABLE_XFA
CPDF_RenderOptions options;
if (flags & FPDF_LCD_TEXT)
options.m_Flags |= RENDER_CLEARTYPE;
@@ -133,17 +114,21 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
options.m_BackColor = 0xffffff;
}
options.m_AddFlags = flags >> 8;
- options.m_pOCContext = new CPDF_OCContext(pPDFDoc, CPDF_OCContext::View);
+#ifdef PDF_ENABLE_XFA
+ options.m_pOCContext = new CPDF_OCContext(pPDFDoc, CPDF_OCContext::View);
if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage, true))
pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip);
+#else // PDF_ENABLE_XFA
+ options.m_pOCContext =
+ new CPDF_OCContext(pPage->m_pDocument, CPDF_OCContext::View);
+ if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage))
+ pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options);
#endif // PDF_ENABLE_XFA
pDevice->RestoreState(false);
delete options.m_pOCContext;
-#ifdef PDF_ENABLE_XFA
options.m_pOCContext = nullptr;
-#endif // PDF_ENABLE_XFA
}
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698