diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-21 12:56:24 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-21 19:05:18 +0000 |
commit | 1f403cee9478021862c7cc4e516907bd51e8f0f6 (patch) | |
tree | 57829fa3b036ee9ddd57a8ad5b3541fe4e96fdb8 /xfa | |
parent | 04557b8a7c2d3dab06fe9eadacc3c7744b3e14e2 (diff) | |
download | pdfium-1f403cee9478021862c7cc4e516907bd51e8f0f6.tar.xz |
Convert more TransformPoint calls to Transform
This Cl converts several uses of TransformPoint to use Transform(CFX_PointF).
Change-Id: I9bc3c484e0a4304b904584218bd9e59dec7db727
Reviewed-on: https://pdfium-review.googlesource.com/2791
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fwl/cfwl_combolist.cpp | 18 | ||||
-rw-r--r-- | xfa/fwl/cfwl_combolist.h | 2 | ||||
-rw-r--r-- | xfa/fwl/cfwl_notedriver.cpp | 29 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widget.cpp | 106 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widget.h | 2 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widgetmgr.cpp | 24 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidget.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgethandler.cpp | 40 | ||||
-rw-r--r-- | xfa/fxfa/xfa_ffwidget.h | 2 |
9 files changed, 116 insertions, 119 deletions
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp index d411f03ca3..171b54121c 100644 --- a/xfa/fwl/cfwl_combolist.cpp +++ b/xfa/fwl/cfwl_combolist.cpp @@ -63,12 +63,11 @@ void CFWL_ComboList::ChangeSelected(int32_t iSel) { RepaintRect(rtInvalidate); } -void CFWL_ComboList::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { - fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top; +CFX_PointF CFWL_ComboList::ClientToOuter(const CFX_PointF& point) { + CFX_PointF ret = point + CFX_PointF(m_pProperties->m_rtWidget.left, + m_pProperties->m_rtWidget.top); CFWL_Widget* pOwner = GetOwner(); - if (!pOwner) - return; - pOwner->TransformTo(m_pOuter, fx, fy); + return pOwner ? pOwner->TransformTo(m_pOuter, ret) : ret; } void CFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { @@ -148,7 +147,10 @@ void CFWL_ComboList::OnDropListMouseMove(CFWL_MessageMouse* pMsg) { ChangeSelected(GetItemIndex(this, hItem)); } else if (m_bNotifyOwner) { - ClientToOuter(pMsg->m_fx, pMsg->m_fy); + CFX_PointF point = ClientToOuter(CFX_PointF(pMsg->m_fx, pMsg->m_fy)); + pMsg->m_fx = point.x; + pMsg->m_fy = point.y; + CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter); pOuter->GetDelegate()->OnProcessMessage(pMsg); } @@ -165,7 +167,9 @@ void CFWL_ComboList::OnDropListLButtonDown(CFWL_MessageMouse* pMsg) { void CFWL_ComboList::OnDropListLButtonUp(CFWL_MessageMouse* pMsg) { CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter); if (m_bNotifyOwner) { - ClientToOuter(pMsg->m_fx, pMsg->m_fy); + CFX_PointF point = ClientToOuter(CFX_PointF(pMsg->m_fx, pMsg->m_fy)); + pMsg->m_fx = point.x; + pMsg->m_fy = point.y; pOuter->GetDelegate()->OnProcessMessage(pMsg); return; } diff --git a/xfa/fwl/cfwl_combolist.h b/xfa/fwl/cfwl_combolist.h index e1d5fd9b24..b7ba6b5780 100644 --- a/xfa/fwl/cfwl_combolist.h +++ b/xfa/fwl/cfwl_combolist.h @@ -29,7 +29,7 @@ class CFWL_ComboList : public CFWL_ListBox { void SetNotifyOwner(bool notify) { m_bNotifyOwner = notify; } private: - void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy); + CFX_PointF ClientToOuter(const CFX_PointF& point); void OnDropListFocusChanged(CFWL_Message* pMsg, bool bSet); void OnDropListMouseMove(CFWL_MessageMouse* pMsg); void OnDropListLButtonDown(CFWL_MessageMouse* pMsg); diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp index f4db9b14ab..6904759e59 100644 --- a/xfa/fwl/cfwl_notedriver.cpp +++ b/xfa/fwl/cfwl_notedriver.cpp @@ -341,8 +341,12 @@ bool CFWL_NoteDriver::DoMouse(CFWL_Message* pMessage, pMsg->m_dwCmd == FWL_MouseCommand::Enter) { return !!pMsg->m_pDstTarget; } - if (pMsg->m_pDstTarget != pMessageForm) - pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy); + if (pMsg->m_pDstTarget != pMessageForm) { + CFX_PointF point = pMsg->m_pDstTarget->TransformTo( + pMessageForm, CFX_PointF(pMsg->m_fx, pMsg->m_fy)); + pMsg->m_fx = point.x; + pMsg->m_fy = point.y; + } if (!DoMouseEx(pMsg, pMessageForm)) pMsg->m_pDstTarget = pMessageForm; return true; @@ -360,7 +364,10 @@ bool CFWL_NoteDriver::DoWheel(CFWL_Message* pMessage, if (!pDst) return false; - pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy); + CFX_PointF point = + pMessageForm->TransformTo(pDst, CFX_PointF(pMsg->m_fx, pMsg->m_fy)); + pMsg->m_fx = point.x; + pMsg->m_fy = point.y; pMsg->m_pDstTarget = pDst; return true; } @@ -380,8 +387,12 @@ bool CFWL_NoteDriver::DoMouseEx(CFWL_Message* pMessage, pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); } if (pTarget) { - if (pMessageForm != pTarget) - pMessageForm->TransformTo(pTarget, pMsg->m_fx, pMsg->m_fy); + if (pMessageForm != pTarget) { + CFX_PointF point = pMessageForm->TransformTo( + pTarget, CFX_PointF(pMsg->m_fx, pMsg->m_fy)); + pMsg->m_fx = point.x; + pMsg->m_fy = point.y; + } } if (!pTarget) return false; @@ -398,10 +409,10 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_Message* pMessage) { CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage); if (m_pHover) { CFWL_MessageMouse msLeave(nullptr, m_pHover); - msLeave.m_fx = pMsg->m_fx; - msLeave.m_fy = pMsg->m_fy; - pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy); - + CFX_PointF point = + pTarget->TransformTo(m_pHover, CFX_PointF(pMsg->m_fx, pMsg->m_fy)); + msLeave.m_fx = point.x; + msLeave.m_fy = point.y; msLeave.m_dwFlags = 0; msLeave.m_dwCmd = FWL_MouseCommand::Leave; DispatchMessage(&msLeave, nullptr); diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index e9c6ddc7d8..3462ea792a 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp @@ -159,9 +159,8 @@ FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Unknown; } -void CFWL_Widget::TransformTo(CFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy) { +CFX_PointF CFWL_Widget::TransformTo(CFWL_Widget* pWidget, + const CFX_PointF& point) { if (m_pWidgetMgr->IsFormDisabled()) { CFX_SizeF szOffset; if (IsParent(pWidget)) { @@ -171,50 +170,36 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget, szOffset.width = -szOffset.width; szOffset.height = -szOffset.height; } - fx += szOffset.width; - fy += szOffset.height; - return; + return point + CFX_PointF(szOffset.width, szOffset.height); } - CFX_RectF r; - CFX_Matrix m; + + CFX_PointF ret = point; CFWL_Widget* parent = GetParent(); - if (parent) { - r = GetWidgetRect(); - fx += r.left; - fy += r.top; - m = GetMatrix(); - m.TransformPoint(fx, fy); - } + if (parent) + ret = GetMatrix().Transform(ret + GetWidgetRect().TopLeft()); + CFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this); if (!form1) - return; + return ret; + + if (!pWidget) + return ret + form1->GetWidgetRect().TopLeft(); - if (!pWidget) { - r = form1->GetWidgetRect(); - fx += r.left; - fy += r.top; - return; - } CFWL_Widget* form2 = m_pWidgetMgr->GetSystemFormWidget(pWidget); if (!form2) - return; + return ret; if (form1 != form2) { - r = form1->GetWidgetRect(); - fx += r.left; - fy += r.top; - r = form2->GetWidgetRect(); - fx -= r.left; - fy -= r.top; + ret += form1->GetWidgetRect().TopLeft(); + ret -= form2->GetWidgetRect().TopLeft(); } + parent = pWidget->GetParent(); - if (parent) { - CFX_Matrix m1; - m1.SetReverse(pWidget->GetMatrix()); - m1.TransformPoint(fx, fy); - r = pWidget->GetWidgetRect(); - fx -= r.left; - fy -= r.top; - } + if (!parent) + return ret; + + CFX_Matrix m; + m.SetReverse(pWidget->GetMatrix()); + return m.Transform(ret) - pWidget->GetWidgetRect().TopLeft(); } CFX_Matrix CFWL_Widget::GetMatrix() { @@ -419,32 +404,31 @@ bool CFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { - FX_FLOAT fx = 0; - FX_FLOAT fy = 0; - if (GetStylesEx() & FWL_STYLEEXT_MNU_Vert) { bool bLeft = m_pProperties->m_rtWidget.left < 0; FX_FLOAT fRight = rtAnchor.right() + rtPopup.width; - TransformTo(nullptr, fx, fy); - if (fRight + fx > 0.0f || bLeft) { + CFX_PointF point = TransformTo(nullptr, CFX_PointF()); + if (fRight + point.x > 0.0f || bLeft) { rtPopup = CFX_RectF(rtAnchor.left - rtPopup.width, rtAnchor.top, rtPopup.width, rtPopup.height); } else { rtPopup = CFX_RectF(rtAnchor.right(), rtAnchor.top, rtPopup.width, rtPopup.height); } + rtPopup.Offset(point.x, point.y); + return true; + } + + FX_FLOAT fBottom = rtAnchor.bottom() + rtPopup.height; + CFX_PointF point = TransformTo(nullptr, point); + if (fBottom + point.y > 0.0f) { + rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.top - rtPopup.height, + rtPopup.width, rtPopup.height); } else { - FX_FLOAT fBottom = rtAnchor.bottom() + rtPopup.height; - TransformTo(nullptr, fx, fy); - if (fBottom + fy > 0.0f) { - rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.top - rtPopup.height, - rtPopup.width, rtPopup.height); - } else { - rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.bottom(), rtPopup.width, - rtPopup.height); - } + rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.bottom(), rtPopup.width, + rtPopup.height); } - rtPopup.Offset(fx, fy); + rtPopup.Offset(point.x, point.y); return true; } @@ -452,9 +436,6 @@ bool CFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { - FX_FLOAT fx = 0; - FX_FLOAT fy = 0; - FX_FLOAT fPopHeight = rtPopup.height; if (rtPopup.height > fMaxHeight) fPopHeight = fMaxHeight; @@ -463,15 +444,15 @@ bool CFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, FX_FLOAT fWidth = std::max(rtAnchor.width, rtPopup.width); FX_FLOAT fBottom = rtAnchor.bottom() + fPopHeight; - TransformTo(nullptr, fx, fy); - if (fBottom + fy > 0.0f) { + CFX_PointF point = TransformTo(nullptr, CFX_PointF()); + if (fBottom + point.y > 0.0f) { rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.top - fPopHeight, fWidth, fPopHeight); } else { rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.bottom(), fWidth, fPopHeight); } - rtPopup.Offset(fx, fy); + rtPopup.Offset(point.x, point.y); return true; } @@ -479,18 +460,15 @@ bool CFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup) { - FX_FLOAT fx = 0; - FX_FLOAT fy = 0; - - TransformTo(nullptr, fx, fy); - if (rtAnchor.bottom() + fy > 0.0f) { + CFX_PointF point = TransformTo(nullptr, CFX_PointF()); + if (rtAnchor.bottom() + point.y > 0.0f) { rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.top - rtPopup.height, rtPopup.width, rtPopup.height); } else { rtPopup = CFX_RectF(rtAnchor.left, rtAnchor.bottom(), rtPopup.width, rtPopup.height); } - rtPopup.Offset(fx, fy); + rtPopup.Offset(point.x, point.y); return true; } diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h index 74fa314bfd..a375005970 100644 --- a/xfa/fwl/cfwl_widget.h +++ b/xfa/fwl/cfwl_widget.h @@ -90,7 +90,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate { m_iLock--; } - void TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); + CFX_PointF TransformTo(CFWL_Widget* pWidget, const CFX_PointF& point); CFX_Matrix GetMatrix(); IFWL_ThemeProvider* GetThemeProvider() const; diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index 0af93dc38b..ea4cbde230 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -160,7 +160,10 @@ void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget, if (!pNative) return; - pWidget->TransformTo(pNative, transformedRect.left, transformedRect.top); + CFX_PointF pos = pWidget->TransformTo( + pNative, CFX_PointF(transformedRect.left, transformedRect.top)); + transformedRect.left = pos.x; + transformedRect.top = pos.y; } AddRedrawCounts(pNative); m_pAdapter->RepaintWidget(pNative); @@ -260,24 +263,21 @@ CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent, if (!parent) return nullptr; - FX_FLOAT x1; - FX_FLOAT y1; + CFX_PointF pos; CFWL_Widget* child = GetLastChildWidget(parent); while (child) { if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) { - x1 = x; - y1 = y; CFX_Matrix m; m.SetIdentity(); CFX_Matrix matrixOnParent; m.SetReverse(matrixOnParent); - m.TransformPoint(x1, y1); + pos = m.Transform(CFX_PointF(x, y)); + CFX_RectF bounds = child->GetWidgetRect(); - if (bounds.Contains(x1, y1)) { - x1 -= bounds.left; - y1 -= bounds.top; - return GetWidgetAtPoint(child, x1, y1); + if (bounds.Contains(pos.x, pos.y)) { + pos -= bounds.TopLeft(); + return GetWidgetAtPoint(child, pos.x, pos.y); } } child = GetPriorSiblingWidget(child); @@ -484,7 +484,9 @@ void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent, widgetMatrix.Concat(*pMatrix); if (!bFormDisable) { - widgetMatrix.TransformPoint(clipBounds.left, clipBounds.top); + CFX_PointF pos = widgetMatrix.Transform(clipBounds.TopLeft()); + clipBounds.left = pos.x; + clipBounds.top = pos.y; clipBounds.Intersect(rtClip); if (clipBounds.IsEmpty()) continue; diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 3ee0a3cbe8..7a8cc646dd 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -316,15 +316,17 @@ bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf, const CFX_ByteStringC& bsReplace) { return false; } -void CXFA_FFWidget::Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy) { + +CFX_PointF CXFA_FFWidget::Rotate2Normal(const CFX_PointF& point) { CFX_Matrix mt = GetRotateMatrix(); - if (mt.IsIdentity()) { - return; - } + if (mt.IsIdentity()) + return point; + CFX_Matrix mtReverse; mtReverse.SetReverse(mt); - mtReverse.TransformPoint(fx, fy); + return mtReverse.Transform(point); } + static void XFA_GetMatrix(CFX_Matrix& m, int32_t iRotate, XFA_ATTRIBUTEENUM at, diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index 551d8f6595..bbca0409d3 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -43,8 +43,8 @@ bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy) { m_pDocView->LockUpdate(); - hWidget->Rotate2Normal(fx, fy); - bool bRet = hWidget->OnLButtonDown(dwFlags, fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + bool bRet = hWidget->OnLButtonDown(dwFlags, pos.x, pos.y); if (bRet && m_pDocView->SetFocus(hWidget)) { m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( m_pDocView->GetDoc(), hWidget); @@ -59,9 +59,9 @@ bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy) { m_pDocView->LockUpdate(); - hWidget->Rotate2Normal(fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); m_pDocView->m_bLayoutEvent = true; - bool bRet = hWidget->OnLButtonUp(dwFlags, fx, fy); + bool bRet = hWidget->OnLButtonUp(dwFlags, pos.x, pos.y); m_pDocView->UnlockUpdate(); m_pDocView->UpdateDocView(); return bRet; @@ -71,8 +71,8 @@ bool CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - hWidget->Rotate2Normal(fx, fy); - bool bRet = hWidget->OnLButtonDblClk(dwFlags, fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + bool bRet = hWidget->OnLButtonDblClk(dwFlags, pos.x, pos.y); m_pDocView->RunInvalidate(); return bRet; } @@ -81,8 +81,8 @@ bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - hWidget->Rotate2Normal(fx, fy); - bool bRet = hWidget->OnMouseMove(dwFlags, fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + bool bRet = hWidget->OnMouseMove(dwFlags, pos.x, pos.y); m_pDocView->RunInvalidate(); return bRet; } @@ -92,8 +92,8 @@ bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, int16_t zDelta, FX_FLOAT fx, FX_FLOAT fy) { - hWidget->Rotate2Normal(fx, fy); - bool bRet = hWidget->OnMouseWheel(dwFlags, zDelta, fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + bool bRet = hWidget->OnMouseWheel(dwFlags, zDelta, pos.x, pos.y); m_pDocView->RunInvalidate(); return bRet; } @@ -102,8 +102,8 @@ bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - hWidget->Rotate2Normal(fx, fy); - bool bRet = hWidget->OnRButtonDown(dwFlags, fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + bool bRet = hWidget->OnRButtonDown(dwFlags, pos.x, pos.y); if (bRet && m_pDocView->SetFocus(hWidget)) { m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( m_pDocView->GetDoc(), hWidget); @@ -116,8 +116,8 @@ bool CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - hWidget->Rotate2Normal(fx, fy); - bool bRet = hWidget->OnRButtonUp(dwFlags, fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + bool bRet = hWidget->OnRButtonUp(dwFlags, pos.x, pos.y); m_pDocView->RunInvalidate(); return bRet; } @@ -126,8 +126,8 @@ bool CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - hWidget->Rotate2Normal(fx, fy); - bool bRet = hWidget->OnRButtonDblClk(dwFlags, fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + bool bRet = hWidget->OnRButtonDblClk(dwFlags, pos.x, pos.y); m_pDocView->RunInvalidate(); return bRet; } @@ -163,15 +163,15 @@ FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible)) return FWL_WidgetHit::Unknown; - hWidget->Rotate2Normal(fx, fy); - return hWidget->OnHitTest(fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + return hWidget->OnHitTest(pos.x, pos.y); } bool CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy) { - hWidget->Rotate2Normal(fx, fy); - return hWidget->OnSetCursor(fx, fy); + CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); + return hWidget->OnSetCursor(pos.x, pos.y); } void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget, diff --git a/xfa/fxfa/xfa_ffwidget.h b/xfa/fxfa/xfa_ffwidget.h index c7701d357e..57dfc639da 100644 --- a/xfa/fxfa/xfa_ffwidget.h +++ b/xfa/fxfa/xfa_ffwidget.h @@ -119,7 +119,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { void AddInvalidateRect(const CFX_RectF* pRect = nullptr); bool GetCaptionText(CFX_WideString& wsCap); bool IsFocused(); - void Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy); + CFX_PointF Rotate2Normal(const CFX_PointF& point); CFX_Matrix GetRotateMatrix(); bool IsLayoutRectEmpty(); CXFA_FFWidget* GetParent(); |