diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2020-05-12 22:35:59 +1000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-05-20 10:54:47 +0200 |
commit | 34a699f1894f30f68c3243784586617e01e60ab6 (patch) | |
tree | 8635293ac05fa3bb7e5b1f69247b138a6f68a19c /vcl | |
parent | 05d7dbb911349c0b529c3f3a64223e447958d435 (diff) |
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@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/print2.cxx | 47 |
1 files changed, 27 insertions, 20 deletions
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 |