vcl/source/gdi/print2.cxx |   47 ++++++++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 20 deletions(-)

New commits:
commit 34a699f1894f30f68c3243784586617e01e60ab6
Author:     Chris Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Tue May 12 22:35:59 2020 +1000
Commit:     Tomaž Vajngerl <qui...@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 <qui...@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
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to