From 43d1c753d12ad66c7f7ebd9b76d903ee21f83ef5 Mon Sep 17 00:00:00 2001 From: Vasily Melenchuk Date: Fri, 12 Jul 2019 10:54:56 +0300 Subject: 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". Change-Id: I43d5801a1dff6241de214f7b24425626dc06b4fb Reviewed-on: https://gerrit.libreoffice.org/75471 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- vcl/source/gdi/print2.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'vcl/source/gdi') diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 2aec6add9634..0a470003f2fc 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -26,7 +26,7 @@ #include #include #include - +#include #include #include @@ -723,6 +723,14 @@ 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 = std::clamp(fReduceTransparencyMinArea, 0.0, 1.0); + // create an OutputDevice to record mapmode changes and the like ScopedVclPtrInstance< VirtualDevice > aMapModeVDev; aMapModeVDev->mnDPIX = mnDPIX; @@ -1125,7 +1133,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, const double fOutArea( static_cast(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 -- cgit