vcl/qa/cppunit/wmf/wmfimporttest.cxx | 10 +--------- vcl/source/filter/wmf/enhwmf.cxx | 18 ++++++++++++++---- vcl/source/filter/wmf/winmtf.cxx | 12 ++++++++++++ vcl/source/filter/wmf/winmtf.hxx | 2 ++ 4 files changed, 29 insertions(+), 13 deletions(-)
New commits: commit 0ca943155c04ee6272bba7ce957b8d87ae9442de Author: Eilidh McAdam <eilidh.mca...@itomig.de> Date: Fri Dec 12 00:45:11 2014 +0000 EMF clip regions should be ignored sometimes. Specifically, the record EMR_EXTSELECTCLIPRGN specifies the default clip region if the RegionMode field is set to RGN_COPY. See EMF specification section 2.3.2.2 available from http://msdn.microsoft.com/en-us/library/cc230624.aspx A unit test had to be changed for this - instead of checking for a specific clip region, it now checks that no clip region is specified. This is under the assumption that the default clip region for our device context is "show everything" - i.e. no clip. Note also that RGN_COPY seems to be a common mode value for this record type. Change-Id: I7bd4fe305dda184d121465005fe09d3c113e3063 diff --git a/vcl/qa/cppunit/wmf/wmfimporttest.cxx b/vcl/qa/cppunit/wmf/wmfimporttest.cxx index f0d192c..6b1cec4 100644 --- a/vcl/qa/cppunit/wmf/wmfimporttest.cxx +++ b/vcl/qa/cppunit/wmf/wmfimporttest.cxx @@ -96,15 +96,7 @@ void WmfTest::testSine() CPPUNIT_ASSERT (pDoc); - assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "top", "0"); - assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "left", "0"); - assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "bottom", "1155947"); - assertXPath(pDoc, "/metafile/sectrectclipregion[1]", "right", "1155378"); - - assertXPath(pDoc, "/metafile/sectrectclipregion[2]", "top", "1411"); - assertXPath(pDoc, "/metafile/sectrectclipregion[2]", "left", "2962"); - assertXPath(pDoc, "/metafile/sectrectclipregion[2]", "bottom", "16651"); - assertXPath(pDoc, "/metafile/sectrectclipregion[2]", "right", "20698"); + assertXPath(pDoc, "/metafile/sectrectclipregion", 0); } void WmfTest::testEmfProblem() diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx index 606a9f3..c314ef6 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -1149,10 +1149,20 @@ bool EnhWMFReader::ReadEnhWMF() pWMF->ReadInt32(cbRgnData); pWMF->ReadInt32(nClippingMode); - tools::PolyPolygon aPolyPoly; - if (cbRgnData) - ImplReadRegion(aPolyPoly, *pWMF, nRecSize); - pOut->SetClipPath(aPolyPoly, nClippingMode, false); + // This record's region data should be ignored if mode + // is RGN_COPY - see EMF spec section 2.3.2.2 + if (nClippingMode == RGN_COPY) + { + pOut->SetDefaultClipPath(); + } + else + { + tools::PolyPolygon aPolyPoly; + if (cbRgnData) + ImplReadRegion(aPolyPoly, *pWMF, nRecSize); + pOut->SetClipPath(aPolyPoly, nClippingMode, false); + } + } break; diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index e15f2e0..8d40354 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -83,6 +83,12 @@ void WinMtfClipPath::moveClipRegion( const Size& rSize ) maClip = basegfx::tools::B2DClipState( aCurrClip ); } +void WinMtfClipPath::setDefaultClipPath() +{ + // Empty clip region - everything visible + maClip = basegfx::tools::B2DClipState(); +} + basegfx::B2DPolyPolygon WinMtfClipPath::getClipPath() const { return maClip.getClipPoly(); @@ -797,6 +803,12 @@ void WinMtfOutput::SetClipPath( const tools::PolyPolygon& rPolyPolygon, sal_Int3 aClipPath.setClipPath(aPolyPolygon, nClippingMode); } +void WinMtfOutput::SetDefaultClipPath() +{ + mbClipNeedsUpdate = true; + aClipPath.setDefaultClipPath(); +} + WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : mnLatestTextAlign ( 0 ), mnTextAlign ( TA_LEFT | TA_TOP | TA_NOUPDATECP ), diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx index 7d96353..7f7e781 100644 --- a/vcl/source/filter/wmf/winmtf.hxx +++ b/vcl/source/filter/wmf/winmtf.hxx @@ -249,6 +249,7 @@ public : void intersectClipRect( const Rectangle& rRect ); void excludeClipRect( const Rectangle& rRect ); void moveClipRegion( const Size& rSize ); + void setDefaultClipPath(); bool isEmpty() const { return maClip.isCleared(); } @@ -711,6 +712,7 @@ public: sal_Int32 nClippingMode, bool bIsMapped ); + void SetDefaultClipPath(); void UpdateClipRegion(); void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits