[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - officecfg/registry vcl/source

Vasily Melenchuk (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 7 18:04:49 UTC 2019


 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    8 ++++++
 vcl/source/gdi/print2.cxx                                  |   16 +++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 04abaa7704dfdcbfffab7499e4d9dc69bc8ed5aa
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri Jul 12 10:54:56 2019 +0300
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Oct 7 20:03:52 2019 +0200

    vcl: make "Reduce Transparency" parameter tweakable
    
    "Reduce transparency" feature previously was using hardcoded
    value of 0.25. If current object area to whole printing area
    ratio exceeds this value, object is being written without
    any extra transparency layers in order to reduce metafile size.
    
    Right now this value can be adjusted in "Expert Configuration".
    Parameter is called "ReduceTransparencyMinArea".
    
    Reviewed-on: https://gerrit.libreoffice.org/75471
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    
    Conflicts:
            vcl/source/gdi/print2.cxx
    
    Change-Id: I43d5801a1dff6241de214f7b24425626dc06b4fb
    Reviewed-on: https://gerrit.libreoffice.org/80393
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 54af3be74603..136005d5296a 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -878,6 +878,14 @@
         </info>
         <value>true</value>
       </prop>
+      <prop oor:name="ReduceTransparencyMinArea" oor:type="xs:int" oor:nillable="false">
+        <info>
+           <desc>Specifies minimal area of an object for applying "Reduce Transparency"
+           printer configuration option (removing object transparency). This value
+           is counted in percents of the printable area.</desc>
+        </info>
+        <value>25</value>
+      </prop>
     </group>
     <group oor:name="InternalMSExport">
       <info>
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index e131b061557b..829d9c894bbe 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -22,10 +22,13 @@
 #include <utility>
 #include <list>
 #include <vector>
+#include <boost/algorithm/clamp.hpp>
+
+#include <sal/log.hxx>
 
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
-
+#include <officecfg/Office/Common.hxx>
 
 #include <vcl/virdev.hxx>
 #include <vcl/metaact.hxx>
@@ -722,6 +725,15 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
         // 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 = boost::algorithm::clamp(
+            fReduceTransparencyMinArea, 0.0, 1.0);
+
         // create an OutputDevice to record mapmode changes and the like
         ScopedVclPtrInstance< VirtualDevice > aMapModeVDev;
         aMapModeVDev->mnDPIX = mnDPIX;
@@ -1125,7 +1137,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
                 const double fOutArea( static_cast<double>(aOutputRect.GetWidth()) * aOutputRect.GetHeight() );
 
                 // check if output doesn't exceed given size
-                if( bReduceTransparency && bTransparencyAutoMode && ( fBmpArea > ( 0.25 * fOutArea ) ) )
+                if( bReduceTransparency && bTransparencyAutoMode && ( fBmpArea > ( fReduceTransparencyMinArea * fOutArea ) ) )
                 {
                     // output normally. Therefore, we simply clear the
                     // special attribute, as everything non-special is


More information about the Libreoffice-commits mailing list