From b45ea1fce52d93615470bab8b671cba5907fb01e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 21 Feb 2017 14:27:59 -0500 Subject: Convert CFWL messages to use CFX_PointF This Cl updates the various CFWL_Message classes to take CFX_PointF instead of x,y values. Change-Id: I5d9d01d68be64fc9e69c04574994c01286ad24e1 Reviewed-on: https://pdfium-review.googlesource.com/2811 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- fpdfsdk/cpdfsdk_pageview.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'fpdfsdk/cpdfsdk_pageview.cpp') diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index 0136077df5..1f041dfb25 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -130,22 +130,20 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, } } -CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, - FX_FLOAT pageY) { +CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(const CFX_PointF& point) { CPDFSDK_AnnotHandlerMgr* pAnnotMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_AnnotIteration annotIteration(this, false); for (const auto& pSDKAnnot : annotIteration) { CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot.Get()); if (pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::POPUP) continue; - if (rc.Contains(pageX, pageY)) + if (rc.Contains(point)) return pSDKAnnot.Get(); } return nullptr; } -CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, - FX_FLOAT pageY) { +CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(const CFX_PointF& point) { CPDFSDK_AnnotHandlerMgr* pAnnotMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_AnnotIteration annotIteration(this, false); for (const auto& pSDKAnnot : annotIteration) { @@ -156,8 +154,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, #endif // PDF_ENABLE_XFA if (bHitTest) { pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot.Get()); - if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot.Get(), - CFX_PointF(pageX, pageY))) + if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot.Get(), point)) return pSDKAnnot.Get(); } } @@ -247,7 +244,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) { #endif // PDF_ENABLE_XFA bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { - CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); + CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point)); if (!pAnnot) { m_pFormFillEnv->KillFocusAnnot(nFlag); return false; @@ -267,7 +264,7 @@ bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { #ifdef PDF_ENABLE_XFA bool CPDFSDK_PageView::OnRButtonDown(const CFX_PointF& point, uint32_t nFlag) { - CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); + CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point)); if (!pAnnot) return false; @@ -286,7 +283,7 @@ bool CPDFSDK_PageView::OnRButtonDown(const CFX_PointF& point, uint32_t nFlag) { bool CPDFSDK_PageView::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); - CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); + CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point)); if (!pFXAnnot) return false; @@ -300,7 +297,7 @@ bool CPDFSDK_PageView::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); - CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); + CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point)); CPDFSDK_Annot::ObservedPtr pFocusAnnot(GetFocusAnnot()); if (pFocusAnnot && pFocusAnnot != pFXAnnot) { // Last focus Annot gets a chance to handle the event. @@ -314,7 +311,7 @@ bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { bool CPDFSDK_PageView::OnMouseMove(const CFX_PointF& point, int nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); - CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXAnnotAtPoint(point.x, point.y)); + CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXAnnotAtPoint(point)); if (pFXAnnot) { if (m_pCaptureWidget && m_pCaptureWidget != pFXAnnot) { m_bExitWidget = true; @@ -347,7 +344,7 @@ bool CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY, const CFX_PointF& point, int nFlag) { - CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); + CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point)); if (!pAnnot) return false; -- cgit v1.2.3