From 2b6e2a7c92a8c2756364a40a22e6f91b910fc514 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 28 Aug 2017 11:34:16 -0700 Subject: Pass more const CFX_Matrix* params in CFFL_FormFiller. Remove some useless overrides. Change-Id: Icf4d8bfcca6358ef3f59f768c2d60759d4b05243 Reviewed-on: https://pdfium-review.googlesource.com/10854 Commit-Queue: Lei Zhang Reviewed-by: Henrique Nakashima Reviewed-by: dsinclair --- fpdfsdk/formfiller/cffl_button.cpp | 18 +++++++++--------- fpdfsdk/formfiller/cffl_button.h | 4 ++-- fpdfsdk/formfiller/cffl_formfiller.cpp | 10 +++++----- fpdfsdk/formfiller/cffl_formfiller.h | 4 ++-- fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 4 ++-- fpdfsdk/formfiller/cffl_pushbutton.cpp | 13 ------------- fpdfsdk/formfiller/cffl_pushbutton.h | 5 ----- 7 files changed, 20 insertions(+), 38 deletions(-) diff --git a/fpdfsdk/formfiller/cffl_button.cpp b/fpdfsdk/formfiller/cffl_button.cpp index 4fd02ae178..dab0045373 100644 --- a/fpdfsdk/formfiller/cffl_button.cpp +++ b/fpdfsdk/formfiller/cffl_button.cpp @@ -62,42 +62,42 @@ bool CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { + const CFX_Matrix& mtUser2Device) { ASSERT(pPageView); CPDFSDK_Widget* pWidget = static_cast(pAnnot); CPDF_FormControl* pCtrl = pWidget->GetFormControl(); if (pCtrl->GetHighlightingMode() != CPDF_FormControl::Push) { - pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Normal, + pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal, nullptr); return; } if (m_bMouseDown) { if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) { - pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Down, + pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Down, nullptr); } else { - pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Normal, + pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal, nullptr); } return; } if (m_bMouseIn) { if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover)) { - pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Rollover, + pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Rollover, nullptr); } else { - pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Normal, + pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal, nullptr); } return; } - pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Normal, nullptr); + pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal, nullptr); } void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - OnDraw(pPageView, pAnnot, pDevice, pUser2Device); + const CFX_Matrix& mtUser2Device) { + OnDraw(pPageView, pAnnot, pDevice, mtUser2Device); } diff --git a/fpdfsdk/formfiller/cffl_button.h b/fpdfsdk/formfiller/cffl_button.h index 37c294dbf0..ad2eb5bd27 100644 --- a/fpdfsdk/formfiller/cffl_button.h +++ b/fpdfsdk/formfiller/cffl_button.h @@ -42,11 +42,11 @@ class CFFL_Button : public CFFL_FormFiller { void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; + const CFX_Matrix& mtUser2Device) override; void OnDrawDeactive(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; + const CFX_Matrix& mtUser2Device) override; private: bool m_bMouseIn; diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 3e2e0c74e0..e2a8c4e931 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -82,12 +82,12 @@ FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { + const CFX_Matrix& mtUser2Device) { ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { CFX_Matrix mt = GetCurMatrix(); - mt.Concat(*pUser2Device); + mt.Concat(mtUser2Device); pWnd->DrawAppearance(pDevice, mt); return; } @@ -96,14 +96,14 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, if (!CFFL_InteractiveFormFiller::IsVisible(pWidget)) return; - pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Normal, nullptr); + pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal, nullptr); } void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CPDFSDKAnnotToWidget(pAnnot)->DrawAppearance(pDevice, *pUser2Device, + const CFX_Matrix& mtUser2Device) { + CPDFSDKAnnotToWidget(pAnnot)->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal, nullptr); } diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index 4769716be5..2b276c242e 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -30,11 +30,11 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { virtual void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device); + const CFX_Matrix& mtUser2Device); virtual void OnDrawDeactive(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device); + const CFX_Matrix& mtUser2Device); virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); virtual void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 27a4560581..e4e06d81dd 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -63,7 +63,7 @@ void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView, CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false); if (pFormFiller && pFormFiller->IsValid()) { - pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); + pFormFiller->OnDraw(pPageView, pAnnot, pDevice, *pUser2Device); pAnnot->GetPDFPage(); if (m_pFormFillEnv->GetFocusAnnot() != pAnnot) @@ -97,7 +97,7 @@ void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView, pFormFiller = GetFormFiller(pAnnot, false); if (pFormFiller) { - pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device); + pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, *pUser2Device); } else { pWidget->DrawAppearance(pDevice, *pUser2Device, CPDF_Annot::Normal, nullptr); diff --git a/fpdfsdk/formfiller/cffl_pushbutton.cpp b/fpdfsdk/formfiller/cffl_pushbutton.cpp index 2f75f4c16b..f09a8f7d8d 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.cpp +++ b/fpdfsdk/formfiller/cffl_pushbutton.cpp @@ -21,16 +21,3 @@ CPWL_Wnd* CFFL_PushButton::NewPDFWindow(const PWL_CREATEPARAM& cp) { return pWnd; } - -bool CFFL_PushButton::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { - return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); -} - -void CFFL_PushButton::OnDraw(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CFFL_Button::OnDraw(pPageView, pAnnot, pDevice, pUser2Device); -} diff --git a/fpdfsdk/formfiller/cffl_pushbutton.h b/fpdfsdk/formfiller/cffl_pushbutton.h index 9ae4752fa9..81c0d628a0 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.h +++ b/fpdfsdk/formfiller/cffl_pushbutton.h @@ -16,11 +16,6 @@ class CFFL_PushButton : public CFFL_Button { // CFFL_Button CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp) override; - bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; - void OnDraw(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; }; #endif // FPDFSDK_FORMFILLER_CFFL_PUSHBUTTON_H_ -- cgit v1.2.3