From 68034894d246f1352e7ff221f52c469e008fbfe8 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 15 Dec 2016 13:44:32 -0800 Subject: Remove widget offscreen code. The Offscreen state was never set, removed. Review-Url: https://codereview.chromium.org/2569663006 --- xfa/fwl/cfwl_widget.cpp | 8 ---- xfa/fwl/cfwl_widget.h | 1 - xfa/fwl/cfwl_widgetmgr.cpp | 107 +++------------------------------------------ xfa/fwl/cfwl_widgetmgr.h | 9 ---- xfa/fwl/fwl_widgetdef.h | 1 - 5 files changed, 5 insertions(+), 121 deletions(-) (limited to 'xfa') diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index 6c33c7674e..7da12fcfba 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp @@ -82,10 +82,6 @@ void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) { void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { m_pProperties->m_rtWidget = rect; - if (IsChild()) - return; - - m_pWidgetMgr->SetWidgetRect_Native(this, rect); } CFX_RectF CFWL_Widget::GetClientRect() { @@ -284,10 +280,6 @@ bool CFWL_Widget::IsChild() const { return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); } -bool CFWL_Widget::IsOffscreen() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); -} - CFX_RectF CFWL_Widget::GetEdgeRect() { CFX_RectF rtEdge = m_pProperties->m_rtWidget; rtEdge.left = rtEdge.top = 0; diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h index 95cbe3ef2a..759ab1f3e6 100644 --- a/xfa/fwl/cfwl_widget.h +++ b/xfa/fwl/cfwl_widget.h @@ -161,7 +161,6 @@ class CFWL_Widget : public IFWL_WidgetDelegate { bool IsOverLapper() const; bool IsPopup() const; bool IsChild() const; - bool IsOffscreen() const; CFWL_Widget* GetRootOuter(); bool GetPopupPosMenu(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index 48a4270068..132544fa84 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -28,14 +28,6 @@ struct FWL_NEEDREPAINTHITDATA { } // namespace -bool FWL_UseOffscreen(CFWL_Widget* pWidget) { -#if (_FX_OS_ == _FX_MACOSX_) - return false; -#else - return !!(pWidget->GetStyles() & FWL_WGTSTYLE_Offscreen); -#endif -} - CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) : m_dwCapability(0), m_pAdapter(pAdapterNative->GetWidgetMgr(this)) { ASSERT(m_pAdapter); @@ -262,28 +254,6 @@ void CFWL_WidgetMgr::SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild) { AppendWidget(pChild); } -void CFWL_WidgetMgr::SetWidgetRect_Native(CFWL_Widget* pWidget, - const CFX_RectF& rect) { - if (!FWL_UseOffscreen(pWidget)) - return; - - Item* pItem = GetWidgetMgrItem(pWidget); - pItem->iRedrawCounter++; - if (pItem->pOffscreen) { - CFX_RenderDevice* pDevice = pItem->pOffscreen->GetRenderDevice(); - if (pDevice && pDevice->GetBitmap()) { - CFX_DIBitmap* pBitmap = pDevice->GetBitmap(); - if (pBitmap->GetWidth() - rect.width > 1 || - pBitmap->GetHeight() - rect.height > 1) { - pItem->pOffscreen.reset(); - } - } - } -#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) - pItem->bOutsideChanged = !m_rtScreen.Contains(rect); -#endif -} - CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent, FX_FLOAT x, FX_FLOAT y) { @@ -314,13 +284,6 @@ CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent, return parent; } -void CFWL_WidgetMgr::NotifySizeChanged(CFWL_Widget* pForm, - FX_FLOAT fx, - FX_FLOAT fy) { - if (FWL_UseOffscreen(pForm)) - GetWidgetMgrItem(pForm)->pOffscreen.reset(); -} - CFWL_Widget* CFWL_WidgetMgr::NextTab(CFWL_Widget* parent, CFWL_Widget* focus, bool& bFind) { @@ -465,39 +428,34 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, if (!pWidget || !pGraphics) return; - CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix); CFX_RectF clipCopy = pWidget->GetWidgetRect(); clipCopy.left = clipCopy.top = 0; - if (UseOffscreenDirect(pWidget)) { - DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); - return; - } CFX_RectF clipBounds; #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \ _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_ - pWidget->GetDelegate()->OnDrawWidget(pTemp, pMatrix); + pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix); pGraphics->GetClipRect(clipBounds); clipCopy = clipBounds; #elif _FX_OS_ == _FX_MACOSX_ if (IsFormDisabled()) { - pWidget->GetDelegate()->OnDrawWidget(pTemp, pMatrix); + pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix); pGraphics->GetClipRect(clipBounds); clipCopy = clipBounds; } else { clipBounds.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d); const_cast(pMatrix)->SetIdentity(); // FIXME: const cast. - pWidget->GetDelegate()->OnDrawWidget(pTemp, pMatrix); + pWidget->GetDelegate()->OnDrawWidget(pGraphics, pMatrix); } #endif // _FX_OS_ == _FX_MACOSX_ if (!IsFormDisabled()) clipBounds.Intersect(pWidget->GetClientRect()); if (!clipBounds.IsEmpty()) - DrawChild(pWidget, clipBounds, pTemp, pMatrix); + DrawChild(pWidget, clipBounds, pGraphics, pMatrix); - DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); + GetWidgetMgrItem(pWidget)->iRedrawCounter = 0; ResetRedrawCounts(pWidget); } @@ -551,41 +509,6 @@ void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent, } } -CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(CFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - if (!FWL_UseOffscreen(pWidget)) - return pGraphics; - - Item* pItem = GetWidgetMgrItem(pWidget); - if (!pItem->pOffscreen) { - pItem->pOffscreen = pdfium::MakeUnique(); - CFX_RectF rect = pWidget->GetWidgetRect(); - pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height, - FXDIB_Argb); - } - CFX_RectF rect; - pGraphics->GetClipRect(rect); - pItem->pOffscreen->SetClipRect(rect); - return pItem->pOffscreen.get(); -} - -void CFWL_WidgetMgr::DrawWidgetAfter(CFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - CFX_RectF& rtClip, - const CFX_Matrix* pMatrix) { - if (FWL_UseOffscreen(pWidget)) { - Item* pItem = GetWidgetMgrItem(pWidget); - pGraphics->Transfer(pItem->pOffscreen.get(), rtClip.left, rtClip.top, - rtClip, pMatrix); -#ifdef _WIN32 - pItem->pOffscreen->ClearClip(); -#endif - } - Item* pItem = GetWidgetMgrItem(pWidget); - pItem->iRedrawCounter = 0; -} - bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, CFX_Matrix* pMatrix, const CFX_RectF& rtDirty) { @@ -684,26 +607,6 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, return true; } -bool CFWL_WidgetMgr::UseOffscreenDirect(CFWL_Widget* pWidget) const { - Item* pItem = GetWidgetMgrItem(pWidget); - if (!FWL_UseOffscreen(pWidget) || !(pItem->pOffscreen)) - return false; - -#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) - if (pItem->bOutsideChanged) { - CFX_RectF r = pWidget->GetWidgetRect(); - CFX_RectF temp(m_rtScreen); - temp.Deflate(50, 50); - if (!temp.Contains(r)) - return false; - - pItem->bOutsideChanged = false; - } -#endif - - return pItem->iRedrawCounter == 0; -} - CFWL_WidgetMgr::Item::Item() : CFWL_WidgetMgr::Item(nullptr) {} CFWL_WidgetMgr::Item::Item(CFWL_Widget* widget) diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h index 4d39d3651e..62ea60a182 100644 --- a/xfa/fwl/cfwl_widgetmgr.h +++ b/xfa/fwl/cfwl_widgetmgr.h @@ -49,12 +49,8 @@ class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate { void SetOwner(CFWL_Widget* pOwner, CFWL_Widget* pOwned); void SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild); - void SetWidgetRect_Native(CFWL_Widget* pWidget, const CFX_RectF& rect); - CFWL_Widget* GetWidgetAtPoint(CFWL_Widget* pParent, FX_FLOAT fx, FX_FLOAT fy); - void NotifySizeChanged(CFWL_Widget* pForm, FX_FLOAT fx, FX_FLOAT fy); - CFWL_Widget* NextTab(CFWL_Widget* parent, CFWL_Widget* focus, bool& bFind); void GetSameGroupRadioButton(CFWL_Widget* pRadioButton, @@ -111,14 +107,9 @@ class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate { CFX_Graphics* DrawWidgetBefore(CFWL_Widget* pWidget, CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); - void DrawWidgetAfter(CFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - CFX_RectF& rtClip, - const CFX_Matrix* pMatrix); bool IsNeedRepaint(CFWL_Widget* pWidget, CFX_Matrix* pMatrix, const CFX_RectF& rtDirty); - bool UseOffscreenDirect(CFWL_Widget* pWidget) const; bool IsAbleNative(CFWL_Widget* pWidget) const; diff --git a/xfa/fwl/fwl_widgetdef.h b/xfa/fwl/fwl_widgetdef.h index 7c11ea1463..04e1ec03ff 100644 --- a/xfa/fwl/fwl_widgetdef.h +++ b/xfa/fwl/fwl_widgetdef.h @@ -13,7 +13,6 @@ #define FWL_WGTSTYLE_Border (1L << 2) #define FWL_WGTSTYLE_VScroll (1L << 11) #define FWL_WGTSTYLE_Group (1L << 22) -#define FWL_WGTSTYLE_Offscreen (1L << 24) #define FWL_WGTSTYLE_NoBackground (1L << 28) #define FWL_WGTSTYLE_WindowTypeMask (3L << 0) -- cgit v1.2.3