summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2014-01-19 15:12:15 +0100
committerAndras Timar <andras.timar@collabora.com>2014-04-22 22:12:25 +0200
commitb2e0edd9b79aa8f8eb103b8090405d2d77500395 (patch)
treecb74594674cf44739f10176252fb1f66c08e749b
parent109c1bf5c2bfa3563a8cc8ad158f236b6ad43dc6 (diff)
EMF/WMF: fix rendering of pen styles (dash, dot, dashdot, dashdotdot)
Change-Id: I226bac370601b75f2589f7a7c5e8830746b31e2e
-rw-r--r--vcl/source/filter/wmf/enhwmf.cxx36
-rw-r--r--vcl/source/filter/wmf/winmtf.cxx16
-rw-r--r--vcl/source/filter/wmf/winwmf.cxx36
3 files changed, 48 insertions, 40 deletions
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 5572b4b13d8d..8df19acd760b 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -701,19 +701,37 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
aLineInfo.SetWidth( aSize.Width() );
sal_Bool bTransparent = sal_False;
- sal_uInt16 nDashCount = 0;
- sal_uInt16 nDotCount = 0;
switch( nStyle & 0xFF )
{
case PS_DASHDOTDOT :
- nDotCount++;
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( 1 );
+ aLineInfo.SetDotCount( 2 );
+ aLineInfo.SetDashLen( 150 );
+ aLineInfo.SetDotLen( 30 );
+ aLineInfo.SetDistance( 50 );
+ break;
case PS_DASHDOT :
- nDashCount++;
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( 1 );
+ aLineInfo.SetDotCount( 1 );
+ aLineInfo.SetDashLen( 150 );
+ aLineInfo.SetDotLen( 30 );
+ aLineInfo.SetDistance( 90 );
+ break;
case PS_DOT :
- nDotCount++;
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( 0 );
+ aLineInfo.SetDotCount( 1 );
+ aLineInfo.SetDotLen( 30 );
+ aLineInfo.SetDistance( 50 );
break;
case PS_DASH :
- nDashCount++;
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( 1 );
+ aLineInfo.SetDotCount( 0 );
+ aLineInfo.SetDashLen( 225 );
+ aLineInfo.SetDistance( 100 );
break;
case PS_NULL :
bTransparent = sal_True;
@@ -750,12 +768,6 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
default :
aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_NONE );
}
- if ( nDashCount | nDotCount )
- {
- aLineInfo.SetStyle( LINE_DASH );
- aLineInfo.SetDashCount( nDashCount );
- aLineInfo.SetDotCount( nDotCount );
- }
pOut->CreateObject( nIndex, GDI_PEN, new WinMtfLineStyle( ReadColor(), aLineInfo, bTransparent ) );
}
}
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index fc972e8ec48f..f781706137d0 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -772,14 +772,6 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle )
{
Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
- if ( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetStyle() == LINE_DASH )
- {
- aSize.Width() += 1;
- long nDotLen = ImplMap( aSize ).Width();
- ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDistance( nDotLen );
- ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDotLen( nDotLen );
- ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDashLen( nDotLen * 4 );
- }
}
}
sal_uInt32 nIndex;
@@ -809,14 +801,6 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS
{
Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
- if ( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetStyle() == LINE_DASH )
- {
- aSize.Width() += 1;
- long nDotLen = ImplMap( aSize ).Width();
- ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDistance( nDotLen );
- ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDotLen( nDotLen );
- ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDashLen( nDotLen * 4 );
- }
}
}
if ( (sal_uInt32)nIndex >= vGDIObj.size() )
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 7c2b5a01c2c9..80848c30c894 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -737,19 +737,37 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
aLineInfo.SetWidth( nWidth );
sal_Bool bTransparent = sal_False;
- sal_uInt16 nDashCount = 0;
- sal_uInt16 nDotCount = 0;
switch( nStyle & 0xFF )
{
case PS_DASHDOTDOT :
- nDotCount++;
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( 1 );
+ aLineInfo.SetDotCount( 2 );
+ aLineInfo.SetDashLen( 150 );
+ aLineInfo.SetDotLen( 30 );
+ aLineInfo.SetDistance( 50 );
+ break;
case PS_DASHDOT :
- nDashCount++;
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( 1 );
+ aLineInfo.SetDotCount( 1 );
+ aLineInfo.SetDashLen( 150 );
+ aLineInfo.SetDotLen( 30 );
+ aLineInfo.SetDistance( 90 );
+ break;
case PS_DOT :
- nDotCount++;
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( 0 );
+ aLineInfo.SetDotCount( 1 );
+ aLineInfo.SetDotLen( 30 );
+ aLineInfo.SetDistance( 50 );
break;
case PS_DASH :
- nDashCount++;
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( 1 );
+ aLineInfo.SetDotCount( 0 );
+ aLineInfo.SetDashLen( 225 );
+ aLineInfo.SetDistance( 100 );
break;
case PS_NULL :
bTransparent = sal_True;
@@ -786,12 +804,6 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
default :
aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_NONE );
}
- if ( nDashCount | nDotCount )
- {
- aLineInfo.SetStyle( LINE_DASH );
- aLineInfo.SetDashCount( nDashCount );
- aLineInfo.SetDotCount( nDotCount );
- }
pOut->CreateObject( GDI_PEN, new WinMtfLineStyle( ReadColor(), aLineInfo, bTransparent ) );
}
break;