[Libreoffice-commits] core.git: include/vcl vcl/source

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 27 01:46:15 UTC 2019


 include/vcl/outdev.hxx         |    2 ++
 include/vcl/window.hxx         |    4 ++--
 vcl/source/gdi/impanmvw.cxx    |   23 ++---------------------
 vcl/source/outdev/clipping.cxx |    6 ++++++
 vcl/source/window/clipping.cxx |   11 +++++++++--
 5 files changed, 21 insertions(+), 25 deletions(-)

New commits:
commit 08995b6a764c9e387c94f6ce5faba2145b5512f9
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Sat Jul 13 23:32:28 2019 +1000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Jul 27 03:45:06 2019 +0200

    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 at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 0b92e735914f..b18150cefd38 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -624,6 +624,8 @@ public:
 
     void                        SetBackground();
     void                        SetBackground( const Wallpaper& rBackground );
+    virtual void                SaveBackground(VirtualDevice& rSaveDevice,
+                                               const Point& rPos, const Size& rSize, const Size& rBackgroundSize) const;
 
     const Wallpaper&            GetBackground() const { return maBackground; }
     bool                        IsBackground() const { return mbBackground; }
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 47c140e475ae..c1ac276f6327 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1184,8 +1184,8 @@ public:
                                                              ScrollBar* pHScrl,
                                                              ScrollBar* pVScrl );
 
-    void                                SaveBackground( const Point& rPos, const Size& rSize,
-                                                        VirtualDevice& rSaveDevice ) const;
+    void                                SaveBackground(VirtualDevice& rSaveDevice,
+                                                       const Point& rPos, const Size& rSize, const Size&) const override;
 
     virtual const SystemEnvData*        GetSystemData() const;
     css::uno::Any                       GetSystemDataAny() const;
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 */


More information about the Libreoffice-commits mailing list