summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-05 16:40:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-05 20:33:41 +0000
commitdfe33fcd20d97e34ba7b7926a5a0c9a93e0e9960 (patch)
tree0ff4779073f06bdf535c3716a5038e3a7f252857 /vcl
parent3e7bf7dc10f65f51dfd0bb29a67de4653d5902c9 (diff)
Related: tdf#45820 polygon clipping during wmf load is ultra slow
For file fuzzing defer actually doing it during load and just set a clipping region, which can take a polypolygon argument, instead of setting a basic cliping rectangle + complexclip flag to specially clip certain things for normal use, continue to do the slow thing as it gives different visual output, so its either not quite the right thing, or there's bugs elsewhere that would need to be fixed to go this way the whole time Change-Id: Ieac7ab54ed7d7c1ca14afd75b25fe273fd676c5d
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/wmf/winmtf.cxx35
-rw-r--r--vcl/workben/commonfuzzer.hxx1
-rw-r--r--vcl/workben/fftester.cxx2
3 files changed, 34 insertions, 4 deletions
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index a169fce6422a..b383439dc99d 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -892,13 +892,40 @@ void WinMtfOutput::UpdateClipRegion()
if( !aClipPath.isEmpty() )
{
const basegfx::B2DPolyPolygon& rClipPoly( aClipPath.getClipPath() );
- mpGDIMetaFile->AddAction(
- new MetaISectRectClipRegionAction(
- vcl::unotools::rectangleFromB2DRectangle(
- rClipPoly.getB2DRange())));
mbComplexClip = rClipPoly.count() > 1
|| !basegfx::tools::isRectangle(rClipPoly);
+
+ static bool bEnableComplexClipViaRegion = getenv("SAL_WMF_COMPLEXCLIP_VIA_REGION") != nullptr;
+
+ if (bEnableComplexClipViaRegion)
+ {
+ //this makes cases like tdf#45820 work in reasonable time, and I feel in theory should
+ //be just fine. In practice I see the output is different so needs work before its the
+ //default, but for file fuzzing it should good enough
+ if (mbComplexClip)
+ {
+ mpGDIMetaFile->AddAction(
+ new MetaISectRegionClipRegionAction(
+ vcl::Region(rClipPoly)));
+ mbComplexClip = false;
+ }
+ else
+ {
+ mpGDIMetaFile->AddAction(
+ new MetaISectRectClipRegionAction(
+ vcl::unotools::rectangleFromB2DRectangle(
+ rClipPoly.getB2DRange())));
+ }
+ }
+ else
+ {
+ //normal case
+ mpGDIMetaFile->AddAction(
+ new MetaISectRectClipRegionAction(
+ vcl::unotools::rectangleFromB2DRectangle(
+ rClipPoly.getB2DRange())));
+ }
}
}
}
diff --git a/vcl/workben/commonfuzzer.hxx b/vcl/workben/commonfuzzer.hxx
index 715d69144b07..969d73b2f7a5 100644
--- a/vcl/workben/commonfuzzer.hxx
+++ b/vcl/workben/commonfuzzer.hxx
@@ -70,6 +70,7 @@ extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
__lsan_disable();
setenv("SAL_USE_VCLPLUGIN", "svp", 1);
+ setenv("SAL_WMF_COMPLEXCLIP_VIA_REGION", "1", 1);
osl_setCommandArgs(*argc, *argv);
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index e6a0ba665cfe..af9f7251c17f 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -101,6 +101,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
utl::ConfigManager::EnableAvoidConfig();
InitVCL();
+ setenv("SAL_WMF_COMPLEXCLIP_VIA_REGION", "1", 1);
+
try_again:
{