summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEilidh McAdam <eilidh.mcadam@itomig.de>2014-12-12 00:45:11 +0000
committerJan Holesovsky <kendy@collabora.com>2015-02-09 19:42:29 +0100
commit0ca943155c04ee6272bba7ce957b8d87ae9442de (patch)
tree7974ded518fc91c82ca0ea1e439bb59d092361e5
parentf5e7207053b857b6903a0ab9c161bed9ad7bcee9 (diff)
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
-rw-r--r--vcl/qa/cppunit/wmf/wmfimporttest.cxx10
-rw-r--r--vcl/source/filter/wmf/enhwmf.cxx18
-rw-r--r--vcl/source/filter/wmf/winmtf.cxx12
-rw-r--r--vcl/source/filter/wmf/winmtf.hxx2
4 files changed, 29 insertions, 13 deletions
diff --git a/vcl/qa/cppunit/wmf/wmfimporttest.cxx b/vcl/qa/cppunit/wmf/wmfimporttest.cxx
index f0d192c41a03..6b1cec40060a 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 606a9f304e06..c314ef69091f 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 e15f2e017e62..8d40354ba89a 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 7d96353f92c1..7f7e781db917 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 );