include/vcl/outdev.hxx | 4 ++++ vcl/source/outdev/outdev.cxx | 10 ++-------- vcl/source/window/clipping.cxx | 20 ++++++-------------- vcl/source/window/mouse.cxx | 3 +-- vcl/source/window/paint.cxx | 21 +++++++-------------- vcl/source/window/stacking.cxx | 12 ++++-------- vcl/source/window/window.cxx | 24 +++++++----------------- vcl/source/window/window2.cxx | 4 +--- 8 files changed, 32 insertions(+), 66 deletions(-)
New commits: commit a6106c9319e04f4966f30d357eedfe23bef4a30c Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Mon Jan 18 18:26:22 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jan 19 07:26:42 2021 +0100 add OutputDevice::GetOutputRectPixel method to simplify some and make an upcoming change less invasive Change-Id: I699b2be8fa35b2b72271eda4a0885f89a47b348a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109563 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index a989522ec7b5..8c4f47b74ad4 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -446,6 +446,10 @@ public: tools::Long GetOutOffYPixel() const { return mnOutOffY; } void SetOutOffXPixel(tools::Long nOutOffX); void SetOutOffYPixel(tools::Long nOutOffY); + Point GetOutputOffPixel() const + { return Point( mnOutOffX, mnOutOffY ); } + tools::Rectangle GetOutputRectPixel() const + { return tools::Rectangle(GetOutputOffPixel(), GetOutputSizePixel() ); } Size GetOutputSize() const { return PixelToLogic( GetOutputSizePixel() ); } diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 729e322ec664..f95ca14bb5e4 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -384,10 +384,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()), nDestWidth, nDestHeight); - const tools::Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ), - Size( mnOutWidth, mnOutHeight ) ); - - AdjustTwoRect( aPosAry, aSrcOutRect ); + AdjustTwoRect( aPosAry, GetOutputRectPixel() ); if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight ) mpGraphics->CopyBits(aPosAry, *this); @@ -491,10 +488,7 @@ void OutputDevice::CopyArea( const Point& rDestPt, ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()), nSrcWidth, nSrcHeight); - const tools::Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ), - Size( mnOutWidth, mnOutHeight ) ); - - AdjustTwoRect( aPosAry, aSrcOutRect ); + AdjustTwoRect( aPosAry, GetOutputRectPixel() ); CopyDeviceArea( aPosAry, bWindowInvalidate ); } diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index 1fb8e0d77e78..fb5be87392eb 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -120,8 +120,7 @@ vcl::Region Window::GetWindowClipRegionPixel() const const_cast<vcl::Window*>(this)->ImplInitWinClipRegion(); aWinClipRegion = mpWindowImpl->maWinClipRegion; - tools::Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - vcl::Region aWinRegion( aWinRect ); + vcl::Region aWinRegion( GetOutputRectPixel() ); if ( aWinRegion == aWinClipRegion ) aWinClipRegion.SetNull(); @@ -250,8 +249,7 @@ void Window::ImplClipSiblings( vcl::Region& rRegion ) const void Window::ImplInitWinClipRegion() { // Build Window Region - mpWindowImpl->maWinClipRegion = tools::Rectangle( Point( mnOutOffX, mnOutOffY ), - Size( mnOutWidth, mnOutHeight ) ); + mpWindowImpl->maWinClipRegion = GetOutputRectPixel(); if ( mpWindowImpl->mbWinRegion ) mpWindowImpl->maWinClipRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); @@ -323,8 +321,7 @@ bool Window::ImplSysObjClip( const vcl::Region* pOldRegion ) } vcl::Region aRegion = *pWinChildClipRegion; - tools::Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - vcl::Region aWinRectRegion( aWinRect ); + vcl::Region aWinRectRegion( GetOutputRectPixel() ); if ( aRegion == aWinRectRegion ) mpWindowImpl->mpSysObj->ResetClipRegion(); @@ -506,8 +503,7 @@ void Window::ImplIntersectWindowClipRegion( vcl::Region& rRegion ) void Window::ImplIntersectWindowRegion( vcl::Region& rRegion ) { - rRegion.Intersect( tools::Rectangle( Point( mnOutOffX, mnOutOffY ), - Size( mnOutWidth, mnOutHeight ) ) ); + rRegion.Intersect( GetOutputRectPixel() ); if ( mpWindowImpl->mbWinRegion ) rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); } @@ -516,17 +512,13 @@ void Window::ImplExcludeWindowRegion( vcl::Region& rRegion ) { if ( mpWindowImpl->mbWinRegion ) { - Point aPoint( mnOutOffX, mnOutOffY ); - vcl::Region aRegion( tools::Rectangle( aPoint, - Size( mnOutWidth, mnOutHeight ) ) ); + vcl::Region aRegion( GetOutputRectPixel() ); aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); rRegion.Exclude( aRegion ); } else { - Point aPoint( mnOutOffX, mnOutOffY ); - rRegion.Exclude( tools::Rectangle( aPoint, - Size( mnOutWidth, mnOutHeight ) ) ); + rRegion.Exclude( GetOutputRectPixel() ); } } diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 43702367408a..7a6afc56c79d 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -61,8 +61,7 @@ WindowHitTest Window::ImplHitTest( const Point& rFramePos ) const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aFramePos ); } - tools::Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - if ( !aRect.IsInside( aFramePos ) ) + if ( !GetOutputRectPixel().IsInside( aFramePos ) ) return WindowHitTest::NONE; if ( mpWindowImpl->mbWinRegion ) { diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 4976d5c892e1..c6d28435236e 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -816,8 +816,7 @@ void Window::ImplInvalidate( const vcl::Region* pRegion, InvalidateFlags nFlags ImplInvalidateFrameRegion( nullptr, nFlags ); else { - tools::Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - vcl::Region aRegion( aRect ); + vcl::Region aRegion( GetOutputRectPixel() ); if ( pRegion ) { // RTL: remirror region before intersecting it @@ -927,8 +926,7 @@ void Window::ImplValidateFrameRegion( const vcl::Region* pRegion, ValidateFlags vcl::Region aChildRegion = mpWindowImpl->maInvalidateRegion; if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll ) { - tools::Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - aChildRegion = aRect; + aChildRegion = GetOutputRectPixel(); } vcl::Window* pChild = mpWindowImpl->mpFirstChild; while ( pChild ) @@ -939,8 +937,7 @@ void Window::ImplValidateFrameRegion( const vcl::Region* pRegion, ValidateFlags } if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll ) { - tools::Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - mpWindowImpl->maInvalidateRegion = aRect; + mpWindowImpl->maInvalidateRegion = GetOutputRectPixel(); } mpWindowImpl->maInvalidateRegion.Exclude( *pRegion ); } @@ -972,8 +969,7 @@ void Window::ImplValidate() ImplValidateFrameRegion( nullptr, nFlags ); else { - tools::Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - vcl::Region aRegion( aRect ); + vcl::Region aRegion( GetOutputRectPixel() ); ImplClipBoundaries( aRegion, true, true ); if ( nFlags & ValidateFlags::NoChildren ) { @@ -1056,8 +1052,7 @@ void Window::SetWindowRegionPixel() if ( IsReallyVisible() ) { - tools::Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - vcl::Region aRegion( aRect ); + vcl::Region aRegion( GetOutputRectPixel() ); ImplInvalidateParentFrameRegion( aRegion ); } } @@ -1138,8 +1133,7 @@ void Window::SetWindowRegionPixel( const vcl::Region& rRegion ) if ( IsReallyVisible() ) { - tools::Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - vcl::Region aRegion( aRect ); + vcl::Region aRegion( GetOutputRectPixel() ); ImplInvalidateParentFrameRegion( aRegion ); } } @@ -1706,8 +1700,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect, aInvalidateRegion.Union(aWinInvalidateRegion); - Point aPoint( mnOutOffX, mnOutOffY ); - vcl::Region aRegion( tools::Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) ); + vcl::Region aRegion( GetOutputRectPixel() ); if ( nFlags & ScrollFlags::Clip ) aRegion.Intersect( rRect ); if ( mpWindowImpl->mbWinRegion ) diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx index a23e3ff97f2a..60f7303f33bc 100644 --- a/vcl/source/window/stacking.cxx +++ b/vcl/source/window/stacking.cxx @@ -219,9 +219,7 @@ void Window::ImplCalcToTop( ImplCalcToTopData* pPrevData ) return; // calculate region, where the window overlaps with other windows - Point aPoint( mnOutOffX, mnOutOffY ); - vcl::Region aRegion( tools::Rectangle( aPoint, - Size( mnOutWidth, mnOutHeight ) ) ); + vcl::Region aRegion( GetOutputRectPixel() ); vcl::Region aInvalidateRegion; ImplCalcOverlapRegionOverlaps( aRegion, aInvalidateRegion ); @@ -556,7 +554,7 @@ void Window::SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags ) // Invalidate all windows which are next to each other // Is INCOMPLETE !!! - tools::Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); + tools::Rectangle aWinRect = GetOutputRectPixel(); vcl::Window* pWindow = nullptr; if ( ImplIsOverlapWindow() ) { @@ -570,8 +568,7 @@ void Window::SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags ) { if ( pWindow == this ) break; - tools::Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ), - Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) ); + tools::Rectangle aCompRect = pWindow->GetOutputRectPixel(); if ( aWinRect.IsOver( aCompRect ) ) pWindow->Invalidate( InvalidateFlags::Children | InvalidateFlags::NoTransparent ); pWindow = pWindow->mpWindowImpl->mpNext; @@ -583,8 +580,7 @@ void Window::SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags ) { if ( pWindow != this ) { - tools::Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ), - Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) ); + tools::Rectangle aCompRect = pWindow->GetOutputRectPixel(); if ( aWinRect.IsOver( aCompRect ) ) { Invalidate( InvalidateFlags::Children | InvalidateFlags::NoTransparent ); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 755a17127634..789e31e4034f 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1541,8 +1541,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( bCopyBits && !pOverlapRegion ) { pOverlapRegion.reset( new vcl::Region() ); - ImplCalcOverlapRegion( tools::Rectangle( Point( mnOutOffX, mnOutOffY ), - Size( mnOutWidth, mnOutHeight ) ), + ImplCalcOverlapRegion( GetOutputRectPixel(), *pOverlapRegion, false, true ); } mpWindowImpl->mnX = nX; @@ -1559,8 +1558,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( bCopyBits && !pOverlapRegion ) { pOverlapRegion.reset( new vcl::Region() ); - ImplCalcOverlapRegion( tools::Rectangle( Point( mnOutOffX, mnOutOffY ), - Size( mnOutWidth, mnOutHeight ) ), + ImplCalcOverlapRegion( GetOutputRectPixel(), *pOverlapRegion, false, true ); } mpWindowImpl->mnY = nY; @@ -1645,9 +1643,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, bParentPaint = mpWindowImpl->mpParent->IsPaintEnabled(); if ( bCopyBits && bParentPaint && !HasPaintEvent() ) { - Point aPoint( mnOutOffX, mnOutOffY ); - vcl::Region aRegion( tools::Rectangle( aPoint, - Size( mnOutWidth, mnOutHeight ) ) ); + vcl::Region aRegion( GetOutputRectPixel() ); if ( mpWindowImpl->mbWinRegion ) aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); ImplClipBoundaries( aRegion, false, true ); @@ -1697,9 +1693,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, } else { - Point aPoint( mnOutOffX, mnOutOffY ); - vcl::Region aRegion( tools::Rectangle( aPoint, - Size( mnOutWidth, mnOutHeight ) ) ); + vcl::Region aRegion( GetOutputRectPixel() ); aRegion.Exclude( *pOldRegion ); if ( mpWindowImpl->mbWinRegion ) aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); @@ -2942,8 +2936,7 @@ tools::Rectangle Window::ImplGetWindowExtentsRelative(const vcl::Window *pRelati void Window::Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags ) { - ImplScroll( tools::Rectangle( Point( mnOutOffX, mnOutOffY ), - Size( mnOutWidth, mnOutHeight ) ), + ImplScroll( GetOutputRectPixel(), nHorzScroll, nVertScroll, nFlags & ~ScrollFlags::Clip ); } @@ -2952,7 +2945,7 @@ void Window::Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, { OutputDevice *pOutDev = GetOutDev(); tools::Rectangle aRect = pOutDev->ImplLogicToDevicePixel( rRect ); - aRect.Intersection( tools::Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ) ); + aRect.Intersection( GetOutputRectPixel() ); if ( !aRect.IsEmpty() ) ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags ); } @@ -2960,10 +2953,7 @@ void Window::Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, void Window::Flush() { if (mpWindowImpl) - { - const tools::Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); - mpWindowImpl->mpFrame->Flush( aWinRect ); - } + mpWindowImpl->mpFrame->Flush( GetOutputRectPixel() ); } void Window::SetUpdateMode( bool bUpdate ) diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index babf85198949..56c27b22e4a5 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -192,9 +192,7 @@ void Window::InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlag if ( nFlags & ShowTrackFlags::Clip ) { - Point aPoint( mnOutOffX, mnOutOffY ); - vcl::Region aRegion( tools::Rectangle( aPoint, - Size( mnOutWidth, mnOutHeight ) ) ); + vcl::Region aRegion( GetOutputRectPixel() ); ImplClipBoundaries( aRegion, false, false ); pOutDev->SelectClipRegion( aRegion, pGraphics ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits