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

Unified Diff: fpdfsdk/fpdfformfill.cpp

Issue 2010813003: Remove default arguments from CFX_FxgeDevice. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@fxgeclean2_textrenderer
Patch Set: rebase Created 4 years, 7 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 | « fpdfsdk/fpdf_progressive.cpp ('k') | fpdfsdk/fpdfview.cpp » ('j') | 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 6bcb605794b237ffe92e2825f9b11d1ce6aab666..2631eb3e4f3b6211c6b67c85deb1a2c7ddcacacf 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -55,6 +55,94 @@ FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<CFX_ByteString>* strings) {
}
#endif // PDF_ENABLE_XFA
+void FFLCommon(FPDF_FORMHANDLE hHandle,
+ FPDF_BITMAP bitmap,
+ FPDF_RECORDER recorder,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags) {
+ if (!hHandle)
+ return;
+
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
+ 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
+ CPDFXFA_Document* pDocument = pPage->GetDocument();
+ if (!pDocument)
+ return;
+ CPDF_Document* pPDFDoc = pDocument->GetPDFDoc();
+ if (!pPDFDoc)
+ return;
+ CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle;
+ CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument();
+ if (!pFXDoc)
+ return;
+#endif // PDF_ENABLE_XFA
+
+ CFX_Matrix matrix;
+ pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate);
+
+ FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y);
+
+ std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
+#ifdef _SKIA_SUPPORT_
+ pDevice->AttachRecorder(static_cast<SkPictureRecorder*>(recorder));
+#endif
+ pDevice->Attach(CFXBitmapFromFPDFBitmap(bitmap), false, nullptr, false);
+ 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;
+ 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(pPDFDoc, CPDF_OCContext::View);
+
+ if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage))
+ pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip);
+#endif // PDF_ENABLE_XFA
+
+ pDevice->RestoreState(false);
+ delete options.m_pOCContext;
+#ifdef PDF_ENABLE_XFA
+ options.m_pOCContext = NULL;
+#endif // PDF_ENABLE_XFA
+}
+
} // namespace
DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
@@ -293,94 +381,6 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) {
return pSDKDoc->KillFocusAnnot(0);
}
-static void FFLCommon(FPDF_FORMHANDLE hHandle,
- FPDF_BITMAP bitmap,
- FPDF_RECORDER recorder,
- FPDF_PAGE page,
- int start_x,
- int start_y,
- int size_x,
- int size_y,
- int rotate,
- int flags) {
- if (!hHandle)
- return;
-
- UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
- 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
- CPDFXFA_Document* pDocument = pPage->GetDocument();
- if (!pDocument)
- return;
- CPDF_Document* pPDFDoc = pDocument->GetPDFDoc();
- if (!pPDFDoc)
- return;
- CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle;
- CPDFSDK_Document* pFXDoc = pEnv->GetSDKDocument();
- if (!pFXDoc)
- return;
-#endif // PDF_ENABLE_XFA
-
- CFX_Matrix matrix;
- pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate);
-
- FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y);
-
- std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
-#ifdef _SKIA_SUPPORT_
- pDevice->AttachRecorder(static_cast<SkPictureRecorder*>(recorder));
-#endif
- pDevice->Attach((CFX_DIBitmap*)bitmap);
- 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;
- 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(pPDFDoc, CPDF_OCContext::View);
-
- if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage))
- pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip);
-#endif // PDF_ENABLE_XFA
-
- pDevice->RestoreState(false);
- delete options.m_pOCContext;
-#ifdef PDF_ENABLE_XFA
- options.m_pOCContext = NULL;
-#endif // PDF_ENABLE_XFA
-}
-
DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
FPDF_BITMAP bitmap,
FPDF_PAGE page,
@@ -464,7 +464,7 @@ DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document,
CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
- if (wsText == NULL) {
+ if (!wsText) {
*size = len;
return;
}
@@ -483,8 +483,9 @@ DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document,
FPDF_WIDGET hWidget,
FPDF_WIDESTRING wsText,
FPDF_DWORD* size) {
- if (NULL == hWidget || NULL == document)
+ if (!hWidget || !document)
return;
+
CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
pDocument->GetDocType() != XFA_DOCTYPE_Static)
« no previous file with comments | « fpdfsdk/fpdf_progressive.cpp ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698