From 43ac44cbf52076fd2354d5276c95d5b4b4a06d64 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 8 Dec 2016 14:05:14 -0800 Subject: Cleanup CFWL_Widget code to return CFX_RectFs where appropriate This Cl changes the various Get*Rect methods in CFWL_Widget to return CFX_RectF classes instead of taking an out parameter. The Repaint method is split into Repaint() and RepaintRect() in order to change the param to a const CFX_RectF& from a CFX_RectF*. Review-Url: https://codereview.chromium.org/2560873005 --- xfa/fwl/cfwl_widgetmgr.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'xfa/fwl/cfwl_widgetmgr.cpp') diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index 825de0e14e..f01c02b6b8 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -148,18 +148,18 @@ void CFWL_WidgetMgr::AppendWidget(CFWL_Widget* pWidget) { } void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget, - const CFX_RectF* pRect) { + const CFX_RectF& rect) { if (!m_pAdapter) return; CFWL_Widget* pNative = pWidget; - CFX_RectF rect(*pRect); + CFX_RectF transformedRect = rect; if (IsFormDisabled()) { CFWL_Widget* pOuter = pWidget->GetOuter(); while (pOuter) { CFX_RectF rtTemp = pNative->GetWidgetRect(); - rect.left += rtTemp.left; - rect.top += rtTemp.top; + transformedRect.left += rtTemp.left; + transformedRect.top += rtTemp.top; pNative = pOuter; pOuter = pOuter->GetOuter(); } @@ -168,10 +168,10 @@ void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget, if (!pNative) return; - pWidget->TransformTo(pNative, rect.left, rect.top); + pWidget->TransformTo(pNative, transformedRect.left, transformedRect.top); } AddRedrawCounts(pNative); - m_pAdapter->RepaintWidget(pNative, &rect); + m_pAdapter->RepaintWidget(pNative); } void CFWL_WidgetMgr::InsertWidget(CFWL_Widget* pParent, CFWL_Widget* pChild) { @@ -497,11 +497,8 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, } #endif // _FX_OS_ == _FX_MACOSX_ - if (!IsFormDisabled()) { - CFX_RectF rtClient; - pWidget->GetClientRect(rtClient); - clipBounds.Intersect(rtClient); - } + if (!IsFormDisabled()) + clipBounds.Intersect(pWidget->GetClientRect()); if (!clipBounds.IsEmpty()) DrawChild(pWidget, clipBounds, pTemp, pMatrix); -- cgit v1.2.3