summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2020-05-12 22:15:44 +1000
committerTomaž Vajngerl <quikee@gmail.com>2020-05-17 21:31:27 +0200
commitd2aca9c946f5977779256e6a3c2a3a0e21a6ed08 (patch)
tree1bbf77778b4ea76eccf72de04fb93e865232dbf8
parentbc94fe8a7415cb0df0e613fb764f886f45a648e3 (diff)
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@gmail.com>
-rw-r--r--include/vcl/outdev.hxx1
-rw-r--r--vcl/source/gdi/print2.cxx10
-rw-r--r--vcl/source/outdev/outdevstate.cxx7
3 files changed, 10 insertions, 8 deletions
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;