[Libreoffice-commits] core.git: vcl/source
Chris Sherlock (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 20 08:57:12 UTC 2020
vcl/source/gdi/print2.cxx | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
New commits:
commit 8318a636336dd6d6b5862a3366f85f96c64d8243
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Tue May 12 22:54:19 2020 +1000
Commit: Tomaž Vajngerl <quikee at 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 <quikee at 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)
{
More information about the Libreoffice-commits
mailing list