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

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Sun May 17 19:32:05 UTC 2020


 include/vcl/outdev.hxx            |    1 +
 vcl/source/gdi/print2.cxx         |   10 ++--------
 vcl/source/outdev/outdevstate.cxx |    7 +++++++
 3 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit d2aca9c946f5977779256e6a3c2a3a0e21a6ed08
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Tue May 12 22:15:44 2020 +1000
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun May 17 21:31:27 2020 +0200

    vcl: refactor by creating OutputDevice::ClearStack()
    
    Change-Id: Ica4400cdb1e5c24dfb302426548ac976da802c74
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94343
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 1df0137cdcee..744f0b0b1f54 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -589,6 +589,7 @@ public:
     // this should not normally be used since Push and Pop must always be used symmetrically
     // however this may be e.g. a help when debugging code in which this somehow is not the case
     sal_uInt32                  GetGCStackDepth() const;
+    void                        ClearStack();
 
     void                        EnableOutput( bool bEnable = true );
     bool                        IsOutputEnabled() const { return mbOutput; }
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index e3bdb765438b..d0ef866b2620 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -794,10 +794,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
 
         int nLastBgAction = FindIncompletelyOccludedBackground(aBackgroundComponent, rInMtf, aMapModeVDev.get());
 
-        // clean up aMapModeVDev
-        sal_uInt32 nCount = aMapModeVDev->GetGCStackDepth();
-        while( nCount-- )
-            aMapModeVDev->Pop();
+        aMapModeVDev->ClearStack(); // clean up aMapModeVDev
 
         ::std::vector<ConnectedComponents> aCCList; // contains distinct sets of connected components as elements.
 
@@ -1218,10 +1215,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
             }
         }
 
-        // clean up aMapModeVDev
-        nCount = aMapModeVDev->GetGCStackDepth();
-        while( nCount-- )
-            aMapModeVDev->Pop();
+        aMapModeVDev->ClearStack(); // clean up aMapModeVDev
 
         //  STAGE 4: Copy actions to output metafile
 
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index ccf92be1932d..a9ca52d9449b 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -225,6 +225,13 @@ sal_uInt32 OutputDevice::GetGCStackDepth() const
     return maOutDevStateStack.size();
 }
 
+void OutputDevice::ClearStack()
+{
+    sal_uInt32 nCount = GetGCStackDepth();
+    while( nCount-- )
+        Pop();
+}
+
 void OutputDevice::EnableOutput( bool bEnable )
 {
     mbOutput = bEnable;


More information about the Libreoffice-commits mailing list