vcl/source/gdi/print2.cxx |   40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

New commits:
commit 8318a636336dd6d6b5862a3366f85f96c64d8243
Author:     Chris Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Tue May 12 22:54:19 2020 +1000
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Wed May 20 10:56:35 2020 +0200

    vcl: refactor by creating SetBackgroundColorAndBounds() function
    
    Change-Id: If547bde70db4e5a22bcbb9fc004cc575a62b23b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94395
    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 dcdce7f793c1..dbef5ed04d75 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -743,6 +743,15 @@ void RecordMapModeChanges(VirtualDevice* pMapModeVDev, 
sal_uInt32 nDPIX, sal_uIn
     pMapModeVDev->EnableOutput(false);
 }
 
+void SetBackgroundColorAndBounds(ConnectedComponents& rBackgroundComponent, 
Color const & rBackground, tools::Rectangle const& rBounds)
+{
+    if( rBackground != COL_TRANSPARENT )
+    {
+        rBackgroundComponent.aBgColor = rBackground;
+        rBackgroundComponent.aBounds = rBounds;
+    }
+}
+
 } // end anon namespace
 
 bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& 
rInMtf, GDIMetaFile& rOutMtf,
@@ -796,32 +805,19 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( 
const GDIMetaFile& rInMtf,
 
         //  STAGE 1: Detect background
 
-        // Receives uniform background content, and is _not_ merged
-        // nor checked for intersection against other aCCList elements
-        ConnectedComponents aBackgroundComponent;
-
-        // Read the configuration value of minimal object area where 
transparency will be removed
-        double fReduceTransparencyMinArea = 
officecfg::Office::Common::VCL::ReduceTransparencyMinArea::get() / 100.0;
-        SAL_WARN_IF(fReduceTransparencyMinArea > 1.0, "vcl",
-            "Value of ReduceTransparencyMinArea config option is too high");
-        SAL_WARN_IF(fReduceTransparencyMinArea < 0.0, "vcl",
-            "Value of ReduceTransparencyMinArea config option is too low");
-        fReduceTransparencyMinArea = std::clamp(fReduceTransparencyMinArea, 
0.0, 1.0);
-
         // create an OutputDevice to record mapmode changes and the like
         ScopedVclPtrInstance< VirtualDevice > aMapModeVDev;
         RecordMapModeChanges(aMapModeVDev.get(), mnDPIX, mnDPIY);
 
+        // Receives uniform background content, and is _not_ merged
+        // nor checked for intersection against other aCCList elements
+        ConnectedComponents aBackgroundComponent;
+
         // weed out page-filling background objects (if they are
         // uniformly coloured). Keeping them outside the other
         // connected components often prevents whole-page bitmap
         // generation.
-        if( rBackground != COL_TRANSPARENT )
-        {
-            aBackgroundComponent.aBgColor = rBackground;
-            aBackgroundComponent.aBounds = SetBackgroundComponentBounds();
-        }
-
+        SetBackgroundColorAndBounds(aBackgroundComponent, rBackground, 
SetBackgroundComponentBounds());
         int nLastBgAction = 
FindIncompletelyOccludedBackground(aBackgroundComponent, rInMtf, 
aMapModeVDev.get());
         int nActionNum = GetActionAfterBackgroundAction(aBackgroundComponent, 
pCurrAct, rInMtf, nLastBgAction, aMapModeVDev.get());
 
@@ -1081,6 +1077,14 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( 
const GDIMetaFile& rInMtf,
         const tools::Rectangle aOutputRect( aPageOffset, aTmpSize );
         bool bTiling = dynamic_cast<Printer*>(this) != nullptr;
 
+        // Read the configuration value of minimal object area where 
transparency will be removed
+        double fReduceTransparencyMinArea = 
officecfg::Office::Common::VCL::ReduceTransparencyMinArea::get() / 100.0;
+        SAL_WARN_IF(fReduceTransparencyMinArea > 1.0, "vcl",
+            "Value of ReduceTransparencyMinArea config option is too high");
+        SAL_WARN_IF(fReduceTransparencyMinArea < 0.0, "vcl",
+            "Value of ReduceTransparencyMinArea config option is too low");
+        fReduceTransparencyMinArea = std::clamp(fReduceTransparencyMinArea, 
0.0, 1.0);
+
         // iterate over all aCCList members and generate bitmaps for the 
special ones
         for (auto & currentItem : aCCList)
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to