diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-30 09:38:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-30 12:36:05 +0200 |
commit | c6c128b947c8864d6bbd4b0abd1abad16cd0d67e (patch) | |
tree | 45b340d9a97b3d0ef35a825d2b2b7d623870a95b | |
parent | ffe6eb528dca34b19fecf738bce647ccb8367379 (diff) |
ImplGetWinChildClipRegion never returns null
Change-Id: I3784e47e8584718a51e0fff68382dce833da26f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113340
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/vcl/window.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/clipping.cxx | 24 | ||||
-rw-r--r-- | vcl/source/window/paint.cxx | 8 |
3 files changed, 16 insertions, 18 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 000d64ffcb4a..095e597d6c28 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -656,7 +656,7 @@ private: SAL_DLLPRIVATE void ImplInitWinClipRegion(); SAL_DLLPRIVATE void ImplInitWinChildClipRegion(); - SAL_DLLPRIVATE vcl::Region* ImplGetWinChildClipRegion(); + SAL_DLLPRIVATE vcl::Region& ImplGetWinChildClipRegion(); SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows( const vcl::Region& rInterRegion, vcl::Region& rRegion ) const; SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows2( const vcl::Region& rInterRegion, vcl::Region& rRegion ); diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index 7b9330d18505..b5c262df2c1a 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -45,7 +45,7 @@ void Window::InitClipRegion() aRegion = *(mpWindowImpl->mpPaintRegion); else { - aRegion = *(ImplGetWinChildClipRegion()); + aRegion = ImplGetWinChildClipRegion(); // only this region is in frame coordinates, so re-mirror it // the mpWindowImpl->mpPaintRegion above is already correct (see ImplCallPaint()) ! if( ImplIsAntiparallel() ) @@ -96,7 +96,7 @@ void Window::ExpandPaintClipRegion( const vcl::Region& rRegion ) vcl::Region aPixRegion = LogicToPixel( rRegion ); vcl::Region aDevPixRegion = ImplPixelToDevicePixel( aPixRegion ); - vcl::Region aWinChildRegion = *ImplGetWinChildClipRegion(); + vcl::Region aWinChildRegion = ImplGetWinChildClipRegion(); // only this region is in frame coordinates, so re-mirror it if( ImplIsAntiparallel() ) { @@ -286,19 +286,17 @@ void Window::ImplInitWinChildClipRegion() mpWindowImpl->mbInitChildRegion = false; } -Region* Window::ImplGetWinChildClipRegion() +Region& Window::ImplGetWinChildClipRegion() { if ( mpWindowImpl->mbInitWinClipRegion ) ImplInitWinClipRegion(); if ( mpWindowImpl->mbInitChildRegion ) ImplInitWinChildClipRegion(); if ( mpWindowImpl->mpChildClipRegion ) - return mpWindowImpl->mpChildClipRegion.get(); - else - return &mpWindowImpl->maWinClipRegion; + return *mpWindowImpl->mpChildClipRegion; + return mpWindowImpl->maWinClipRegion; } - bool Window::ImplSysObjClip( const vcl::Region* pOldRegion ) { bool bUpdate = true; @@ -309,18 +307,18 @@ bool Window::ImplSysObjClip( const vcl::Region* pOldRegion ) if ( bVisibleState ) { - vcl::Region* pWinChildClipRegion = ImplGetWinChildClipRegion(); + vcl::Region& rWinChildClipRegion = ImplGetWinChildClipRegion(); - if ( !pWinChildClipRegion->IsEmpty() ) + if (!rWinChildClipRegion.IsEmpty()) { if ( pOldRegion ) { - vcl::Region aNewRegion = *pWinChildClipRegion; - pWinChildClipRegion->Intersect( *pOldRegion ); - bUpdate = aNewRegion == *pWinChildClipRegion; + vcl::Region aNewRegion = rWinChildClipRegion; + rWinChildClipRegion.Intersect(*pOldRegion); + bUpdate = aNewRegion == rWinChildClipRegion; } - vcl::Region aRegion = *pWinChildClipRegion; + vcl::Region aRegion = rWinChildClipRegion; vcl::Region aWinRectRegion( GetOutputRectPixel() ); if ( aRegion == aWinRectRegion ) diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index e673299095b9..d991b0bdd3b2 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -247,11 +247,11 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) { WindowImpl* pWindowImpl = m_pWindow->ImplGetWindowImpl(); - vcl::Region* pWinChildClipRegion = m_pWindow->ImplGetWinChildClipRegion(); + vcl::Region& rWinChildClipRegion = m_pWindow->ImplGetWinChildClipRegion(); ImplFrameData* pFrameData = m_pWindow->mpWindowImpl->mpFrameData; if (pWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll || pFrameData->mbInBufferedPaint) { - pWindowImpl->maInvalidateRegion = *pWinChildClipRegion; + pWindowImpl->maInvalidateRegion = rWinChildClipRegion; } else { @@ -268,7 +268,7 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) if (pWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren) m_pChildRegion.reset( new vcl::Region(pWindowImpl->maInvalidateRegion) ); - pWindowImpl->maInvalidateRegion.Intersect(*pWinChildClipRegion); + pWindowImpl->maInvalidateRegion.Intersect(rWinChildClipRegion); } pWindowImpl->mnPaintFlags = ImplPaintFlags::NONE; if (pWindowImpl->maInvalidateRegion.IsEmpty()) @@ -729,7 +729,7 @@ void Window::ImplInvalidateFrameRegion( const vcl::Region* pRegion, InvalidateFl vcl::Region *pChildRegion; if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll ) // invalidate the whole child window region in the parent - pChildRegion = ImplGetWinChildClipRegion(); + pChildRegion = &ImplGetWinChildClipRegion(); else // invalidate the same region in the parent that has to be repainted in the child pChildRegion = &mpWindowImpl->maInvalidateRegion; |