From 23f55851279e253f64f79d2e1509ec223b1b83b4 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Mon, 14 May 2018 15:32:00 +0000 Subject: Remove dead code from CFWL_WidgetMgr. Change-Id: Ic39b843ab21e7eb738849511a5187822ad49d67a Reviewed-on: https://pdfium-review.googlesource.com/32413 Commit-Queue: Henrique Nakashima Reviewed-by: Tom Sepez Reviewed-by: Ryan Harrison --- xfa/fwl/cfwl_widgetmgr.cpp | 122 +-------------------------------------------- xfa/fwl/cfwl_widgetmgr.h | 14 ------ 2 files changed, 1 insertion(+), 135 deletions(-) diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index 2aab88bcb0..7bae450374 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -15,26 +15,9 @@ #include "xfa/fxfa/cxfa_ffapp.h" #include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h" -namespace { - -const int kNeedRepaintHitPoints = 12; -const int kNeedRepaintHitPiece = 3; - -struct FWL_NEEDREPAINTHITDATA { - CFX_PointF hitPoint; - bool bNotNeedRepaint; - bool bNotContainByDirty; -}; - -} // namespace - CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) : m_pAdapter(pAdapterNative->GetFWLAdapterWidgetMgr()) { - ASSERT(m_pAdapter); m_mapWidgetItem[nullptr] = pdfium::MakeUnique(); -#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - m_rtScreen.Reset(); -#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ } CFWL_WidgetMgr::~CFWL_WidgetMgr() {} @@ -141,9 +124,6 @@ void CFWL_WidgetMgr::AppendWidget(CFWL_Widget* pWidget) { void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget, const CFX_RectF& rect) { - if (!m_pAdapter) - return; - CFWL_Widget* pNative = pWidget; CFX_RectF transformedRect = rect; CFWL_Widget* pOuter = pWidget->GetOuter(); @@ -453,100 +433,6 @@ void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent, } } -bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, - CFX_Matrix* pMatrix, - const CFX_RectF& rtDirty) { - Item* pItem = GetWidgetMgrItem(pWidget); - if (pItem && pItem->iRedrawCounter > 0) { - pItem->iRedrawCounter = 0; - return true; - } - - CFX_RectF rtWidget = - pMatrix->TransformRect(CFX_RectF(0, 0, pWidget->GetWidgetRect().Size())); - if (!rtWidget.IntersectWith(rtDirty)) - return false; - - CFWL_Widget* pChild = - pWidget->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pWidget); - if (!pChild) - return true; - - CFX_RectF rtChilds; - bool bChildIntersectWithDirty = false; - bool bOrginPtIntersectWidthChild = false; - bool bOrginPtIntersectWidthDirty = rtDirty.Contains(rtWidget.TopLeft()); - float fxPiece = rtWidget.width / kNeedRepaintHitPiece; - float fyPiece = rtWidget.height / kNeedRepaintHitPiece; - FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; - memset(hitPoint, 0, sizeof(hitPoint)); - hitPoint[2].hitPoint.x = hitPoint[6].hitPoint.x = rtWidget.left; - hitPoint[0].hitPoint.x = hitPoint[3].hitPoint.x = hitPoint[7].hitPoint.x = - hitPoint[10].hitPoint.x = fxPiece + rtWidget.left; - hitPoint[1].hitPoint.x = hitPoint[4].hitPoint.x = hitPoint[8].hitPoint.x = - hitPoint[11].hitPoint.x = fxPiece * 2 + rtWidget.left; - hitPoint[5].hitPoint.x = hitPoint[9].hitPoint.x = - rtWidget.width + rtWidget.left; - hitPoint[0].hitPoint.y = hitPoint[1].hitPoint.y = rtWidget.top; - hitPoint[2].hitPoint.y = hitPoint[3].hitPoint.y = hitPoint[4].hitPoint.y = - hitPoint[5].hitPoint.y = fyPiece + rtWidget.top; - hitPoint[6].hitPoint.y = hitPoint[7].hitPoint.y = hitPoint[8].hitPoint.y = - hitPoint[9].hitPoint.y = fyPiece * 2 + rtWidget.top; - hitPoint[10].hitPoint.y = hitPoint[11].hitPoint.y = - rtWidget.height + rtWidget.top; - do { - CFX_RectF rect = pChild->GetWidgetRect(); - CFX_RectF r(rect.left + rtWidget.left, rect.top + rtWidget.top, rect.width, - rect.height); - if (r.IsEmpty()) - continue; - if (r.Contains(rtDirty)) - return false; - if (!bChildIntersectWithDirty && r.IntersectWith(rtDirty)) - bChildIntersectWithDirty = true; - if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild) - bOrginPtIntersectWidthChild = rect.Contains(CFX_PointF(0, 0)); - - if (rtChilds.IsEmpty()) - rtChilds = rect; - else if (!(pChild->GetStates() & FWL_WGTSTATE_Invisible)) - rtChilds.Union(rect); - - for (int32_t i = 0; i < kNeedRepaintHitPoints; i++) { - if (hitPoint[i].bNotContainByDirty || hitPoint[i].bNotNeedRepaint) - continue; - if (!rtDirty.Contains(hitPoint[i].hitPoint)) { - hitPoint[i].bNotContainByDirty = true; - continue; - } - if (r.Contains(hitPoint[i].hitPoint)) - hitPoint[i].bNotNeedRepaint = true; - } - pChild = - pChild->GetOwnerApp()->GetWidgetMgr()->GetNextSiblingWidget(pChild); - } while (pChild); - - if (!bChildIntersectWithDirty) - return true; - if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild) - return true; - if (rtChilds.IsEmpty()) - return true; - - int32_t repaintPoint = kNeedRepaintHitPoints; - for (int32_t i = 0; i < kNeedRepaintHitPoints; i++) { - if (hitPoint[i].bNotNeedRepaint) - repaintPoint--; - } - if (repaintPoint > 0) - return true; - - rtChilds = pMatrix->TransformRect(rtChilds); - if (rtChilds.Contains(rtDirty) || rtChilds.Contains(rtWidget)) - return false; - return true; -} - CFWL_WidgetMgr::Item::Item() : CFWL_WidgetMgr::Item(nullptr) {} CFWL_WidgetMgr::Item::Item(CFWL_Widget* widget) @@ -556,12 +442,6 @@ CFWL_WidgetMgr::Item::Item(CFWL_Widget* widget) pPrevious(nullptr), pNext(nullptr), pWidget(widget), - iRedrawCounter(0) -#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - , - bOutsideChanged(false) -#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ -{ -} + iRedrawCounter(0) {} CFWL_WidgetMgr::Item::~Item() {} diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h index 536dce9d2b..856e7f4cc2 100644 --- a/xfa/fwl/cfwl_widgetmgr.h +++ b/xfa/fwl/cfwl_widgetmgr.h @@ -14,8 +14,6 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fxgraphics/cxfa_graphics.h" -#define FWL_WGTMGR_DisableForm 0x00000002 - class CFWL_Message; class CXFA_FFApp; class CXFA_FWLAdapterWidgetMgr; @@ -77,9 +75,6 @@ class CFWL_WidgetMgr { CFWL_Widget* const pWidget; std::unique_ptr pOffscreen; int32_t iRedrawCounter; -#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - bool bOutsideChanged; -#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ }; CFWL_Widget* GetFirstSiblingWidget(CFWL_Widget* pWidget) const; @@ -98,20 +93,11 @@ class CFWL_WidgetMgr { const CFX_RectF& rtClip, CXFA_Graphics* pGraphics, const CFX_Matrix* pMatrix); - CXFA_Graphics* DrawWidgetBefore(CFWL_Widget* pWidget, - CXFA_Graphics* pGraphics, - const CFX_Matrix* pMatrix); - bool IsNeedRepaint(CFWL_Widget* pWidget, - CFX_Matrix* pMatrix, - const CFX_RectF& rtDirty); bool IsAbleNative(CFWL_Widget* pWidget) const; std::map> m_mapWidgetItem; UnownedPtr const m_pAdapter; -#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - CFX_RectF m_rtScreen; -#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ }; #endif // XFA_FWL_CFWL_WIDGETMGR_H_ -- cgit v1.2.3