diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2019-07-13 23:32:28 +1000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-07-27 03:45:06 +0200 |
commit | 08995b6a764c9e387c94f6ce5faba2145b5512f9 (patch) | |
tree | fc7545e12a1e3a0cdd007eb3519eb928984a9d2d /vcl | |
parent | f440c1d28b440135b162e0e22703110a23e18d92 (diff) |
tdf#74702: remove GetOutDevType() from ImplAnimView
I have done a spot of refactoring - it turns out that the bits where we
save and reset the map mode during background saves should probably be
done in Window::SaveBackground(). As Window::SaveBackground() doesn't
need the animation size (maSzPix) I have rarrange the parameter order
so the Window function can ignore the parameter.
OutputDevice::SaveBackground() has been introduced as a virtual function
and now is overridden by Window for its own purposes - OutputDevice just
does a DrawOutDev(...) operation on the background.
Change-Id: Ifeffe9536c01d8e4737f6e39a4f3dd14ba418f4d
Reviewed-on: https://gerrit.libreoffice.org/76399
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/impanmvw.cxx | 23 | ||||
-rw-r--r-- | vcl/source/outdev/clipping.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/clipping.cxx | 11 |
3 files changed, 17 insertions, 23 deletions
diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index d16048f176e5..0537c349e0f3 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -75,17 +75,7 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut, // save background mpBackground->SetOutputSizePixel( maSzPix ); - - if( mpRenderContext->GetOutDevType() == OUTDEV_WINDOW ) - { - MapMode aTempMap( mpRenderContext->GetMapMode() ); - aTempMap.SetOrigin( Point() ); - mpBackground->SetMapMode( aTempMap ); - static_cast<vcl::Window*>( mpRenderContext.get() )->SaveBackground( maDispPt, maDispSz, *mpBackground ); - mpBackground->SetMapMode( MapMode() ); - } - else - mpBackground->DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpRenderContext ); + mpRenderContext->SaveBackground(*mpBackground, maDispPt, maDispSz, maSzPix); // Initialize drawing to actual position drawToPos( mpParent->ImplGetCurPos() ); @@ -317,16 +307,7 @@ void ImplAnimView::repaint() { const bool bOldPause = mbIsPaused; - if( mpRenderContext->GetOutDevType() == OUTDEV_WINDOW ) - { - MapMode aTempMap( mpRenderContext->GetMapMode() ); - aTempMap.SetOrigin( Point() ); - mpBackground->SetMapMode( aTempMap ); - static_cast<vcl::Window*>( mpRenderContext.get() )->SaveBackground( maDispPt, maDispSz, *mpBackground ); - mpBackground->SetMapMode( MapMode() ); - } - else - mpBackground->DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpRenderContext ); + mpRenderContext->SaveBackground(*mpBackground, maDispPt, maDispSz, maSzPix); mbIsPaused = false; drawToPos( mnActPos ); diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx index 9dad2667bb66..4a2750f274ff 100644 --- a/vcl/source/outdev/clipping.cxx +++ b/vcl/source/outdev/clipping.cxx @@ -36,6 +36,12 @@ #include <numeric> +void OutputDevice::SaveBackground(VirtualDevice& rSaveDevice, + const Point& rPos, const Size& rSize, const Size& rBackgroundSize) const +{ + rSaveDevice.DrawOutDev(Point(), rBackgroundSize, rPos, rSize, *this); +} + vcl::Region OutputDevice::GetClipRegion() const { diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index 62d5d695a9a4..3b1b355b33d4 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -668,9 +668,12 @@ void Window::ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Re } } -void Window::SaveBackground( const Point& rPos, const Size& rSize, - VirtualDevice& rSaveDevice ) const +void Window::SaveBackground(VirtualDevice& rSaveDevice, const Point& rPos, const Size& rSize, const Size&) const { + MapMode aTempMap(GetMapMode()); + aTempMap.SetOrigin(Point()); + rSaveDevice.SetMapMode(aTempMap); + if ( mpWindowImpl->mpPaintRegion ) { vcl::Region aClip( *mpWindowImpl->mpPaintRegion ); @@ -697,7 +700,11 @@ void Window::SaveBackground( const Point& rPos, const Size& rSize, } } else + { rSaveDevice.DrawOutDev( Point(), rSize, rPos, rSize, *this ); + } + + rSaveDevice.SetMapMode(MapMode()); } } /* namespace vcl */ |