[Libreoffice-commits] core.git: vcl/source
Chris Sherlock (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 20 08:55:29 UTC 2020
vcl/source/gdi/print2.cxx | 47 ++++++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 20 deletions(-)
New commits:
commit 34a699f1894f30f68c3243784586617e01e60ab6
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Tue May 12 22:35:59 2020 +1000
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed May 20 10:54:47 2020 +0200
vcl: refactor by creating GetActionAfterBackgroundAction() function
Change-Id: Ice78e9433863be8966cd5b9caac663e684332f71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94393
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 71a1f76071ac..b50d57a6c2d4 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -711,6 +711,31 @@ int FindIncompletelyOccludedBackground(ConnectedComponents& rBackgroundComponent
return nLastBgAction;
}
+int GetActionAfterBackgroundAction(ConnectedComponents& rBackgroundComponent, MetaAction* pCurrAct,
+ GDIMetaFile const & rMtf, int nLastBgAction,
+ VirtualDevice* const pMapModeVDev)
+{
+ pMapModeVDev->ClearStack(); // clean up pMapModeVDev
+
+ // fast-forward until one after the last background action
+ // (need to reconstruct map mode vdev state)
+ int nActionNum=0;
+ pCurrAct=const_cast<GDIMetaFile&>(rMtf).FirstAction();
+ while(pCurrAct && nActionNum <= nLastBgAction)
+ {
+ // up to and including last ink-generating background
+ // action go to background component
+ rBackgroundComponent.aComponentList.emplace_back(pCurrAct, nActionNum);
+
+ // execute action to get correct MapModes etc.
+ pCurrAct->Execute(pMapModeVDev);
+ pCurrAct=const_cast<GDIMetaFile&>(rMtf).NextAction();
+ ++nActionNum;
+ }
+
+ return nActionNum;
+}
+
} // end anon namespace
bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
@@ -720,7 +745,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
const Color& rBackground
)
{
- MetaAction* pCurrAct;
+ MetaAction* pCurrAct = nullptr;;
bool bTransparent( false );
rOutMtf.Clear();
@@ -793,25 +818,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
}
int nLastBgAction = FindIncompletelyOccludedBackground(aBackgroundComponent, rInMtf, aMapModeVDev.get());
-
- aMapModeVDev->ClearStack(); // clean up aMapModeVDev
-
- // fast-forward until one after the last background action
- // (need to reconstruct map mode vdev state)
- int nActionNum=0;
- pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction();
- while( pCurrAct && nActionNum<=nLastBgAction )
- {
- // up to and including last ink-generating background
- // action go to background component
- aBackgroundComponent.aComponentList.emplace_back(
- pCurrAct, nActionNum );
-
- // execute action to get correct MapModes etc.
- pCurrAct->Execute( aMapModeVDev.get() );
- pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction();
- ++nActionNum;
- }
+ int nActionNum = GetActionAfterBackgroundAction(aBackgroundComponent, pCurrAct, rInMtf, nLastBgAction, aMapModeVDev.get());
// STAGE 2: Generate connected components list
More information about the Libreoffice-commits
mailing list