diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-01-05 16:40:39 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-01-05 20:33:41 +0000 |
commit | dfe33fcd20d97e34ba7b7926a5a0c9a93e0e9960 (patch) | |
tree | 0ff4779073f06bdf535c3716a5038e3a7f252857 /vcl/source | |
parent | 3e7bf7dc10f65f51dfd0bb29a67de4653d5902c9 (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/source')
-rw-r--r-- | vcl/source/filter/wmf/winmtf.cxx | 35 |
1 files changed, 31 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()))); + } } } } |