summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-02 13:27:54 -0800
committerLei Zhang <thestig@chromium.org>2015-11-02 13:27:54 -0800
commitf0e2e1b09cf1ce0e537888a99f04be6f10edcada (patch)
tree84885b475c64237e2a26668c8a1b4f67421fc51d /fpdfsdk
parentbd55239e7825b8d10255093d8c3fa03b43620a98 (diff)
downloadpdfium-f0e2e1b09cf1ce0e537888a99f04be6f10edcada.tar.xz
XFA: Simplify CPDFSDK_PageView::PageView_OnDraw().
The clip parameter is never NULL. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1417983006 .
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/fsdk_mgr.h2
-rw-r--r--fpdfsdk/src/fpdfformfill.cpp2
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp16
3 files changed, 9 insertions, 11 deletions
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index 615b585b51..1c0a48ded5 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -537,7 +537,7 @@ class CPDFSDK_PageView final {
void PageView_OnDraw(CFX_RenderDevice* pDevice,
CPDF_Matrix* pUser2Device,
CPDF_RenderOptions* pOptions,
- FX_RECT* pClip = NULL);
+ const FX_RECT& pClip);
const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp
index dc740edfc5..f6a4f0a488 100644
--- a/fpdfsdk/src/fpdfformfill.cpp
+++ b/fpdfsdk/src/fpdfformfill.cpp
@@ -317,7 +317,7 @@ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
options.m_pOCContext = new CPDF_OCContext(pPDFDoc);
if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView((CPDFXFA_Page*)page))
- pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, &clip);
+ pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip);
pDevice->RestoreState();
delete options.m_pOCContext;
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index f12e8fb595..1b09714dfa 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -654,7 +654,7 @@ CPDFSDK_PageView::~CPDFSDK_PageView() {
void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
CPDF_Matrix* pUser2Device,
CPDF_RenderOptions* pOptions,
- FX_RECT* pClip) {
+ const FX_RECT& pClip) {
m_curMatrix = *pUser2Device;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
CPDFXFA_Page* pPage = GetPDFXFAPage();
@@ -666,14 +666,12 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
if (pPage->GetDocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) {
CFX_Graphics gs;
gs.Create(pDevice);
- if (pClip) {
- CFX_RectF rectClip;
- rectClip.Set(static_cast<FX_FLOAT>(pClip->left),
- static_cast<FX_FLOAT>(pClip->top),
- static_cast<FX_FLOAT>(pClip->Width()),
- static_cast<FX_FLOAT>(pClip->Height()));
- gs.SetClipRect(rectClip);
- }
+ CFX_RectF rectClip;
+ rectClip.Set(static_cast<FX_FLOAT>(pClip.left),
+ static_cast<FX_FLOAT>(pClip.top),
+ static_cast<FX_FLOAT>(pClip.Width()),
+ static_cast<FX_FLOAT>(pClip.Height()));
+ gs.SetClipRect(rectClip);
IXFA_RenderContext* pRenderContext = XFA_RenderContext_Create();
if (!pRenderContext)
return;