summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2020-05-12 23:53:24 +1000
committerTomaž Vajngerl <quikee@gmail.com>2020-05-23 20:10:30 +0200
commit93649784ddbb7d9ca779d14fd60fb97385325d17 (patch)
tree800b3f59056784f1680f5f6fdad1f9c2a19fcfe8 /vcl
parent3f14671b5f0cf11dc2e0e5ae11700afcef63ce81 (diff)
vcl: move stage 1 functionality into DetectBackground()
Change-Id: I7a1785683868ca48156208bb08a80298b332fee2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94563 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/print2.cxx29
1 files changed, 21 insertions, 8 deletions
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 8e4884a05a4d..1da4393c170a 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -752,6 +752,23 @@ void SetBackgroundColorAndBounds(ConnectedComponents& rBackgroundComponent, Colo
}
}
+int DetectBackground(ConnectedComponents& rBackgroundComponent, MetaAction* pCurrAct,
+ Color const & rBackgroundColor, tools::Rectangle const& rRectBounds,
+ GDIMetaFile const & rMtf, VirtualDevice* pMapModeVDev,
+ sal_uInt32 nDPIX, sal_uInt32 nDPIY)
+{
+ RecordMapModeChanges(pMapModeVDev, nDPIX, nDPIY);
+
+ // weed out page-filling background objects (if they are
+ // uniformly coloured). Keeping them outside the other
+ // connected components often prevents whole-page bitmap
+ // generation.
+ SetBackgroundColorAndBounds(rBackgroundComponent, rBackgroundColor, rRectBounds);
+ int nLastBgAction = FindIncompletelyOccludedBackground(rBackgroundComponent, rMtf, pMapModeVDev);
+ int nActionNum = GetActionAfterBackgroundAction(rBackgroundComponent, pCurrAct, rMtf, nLastBgAction, pMapModeVDev);
+ return nActionNum;
+}
+
} // end anon namespace
bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
@@ -807,19 +824,15 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// 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.
- SetBackgroundColorAndBounds(aBackgroundComponent, rBackground, GetBackgroundComponentBounds());
- int nLastBgAction = FindIncompletelyOccludedBackground(aBackgroundComponent, rInMtf, aMapModeVDev.get());
- int nActionNum = GetActionAfterBackgroundAction(aBackgroundComponent, pCurrAct, rInMtf, nLastBgAction, aMapModeVDev.get());
+ int nActionNum = DetectBackground(aBackgroundComponent, pCurrAct,
+ rBackground, GetBackgroundComponentBounds(),
+ rInMtf, aMapModeVDev.get(),
+ mnDPIX, mnDPIY);
// STAGE 2: Generate connected components list