[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 2 commits - vcl/source
Andras Timar
andras.timar at collabora.com
Tue Apr 22 14:31:19 PDT 2014
vcl/source/filter/wmf/enhwmf.cxx | 60 +++++++++++++++++++++++++++++++--------
vcl/source/filter/wmf/winmtf.cxx | 16 ----------
vcl/source/filter/wmf/winwmf.cxx | 60 +++++++++++++++++++++++++++++++--------
3 files changed, 98 insertions(+), 38 deletions(-)
New commits:
commit 10117d6121f3785bff11111443489ba87935a684
Author: Andras Timar <andras.timar at collabora.com>
Date: Sun Jan 19 15:12:15 2014 +0100
EMF/WMF: fix rendering of pen styles (dash, dot, dashdot, dashdotdot)
Change-Id: I226bac370601b75f2589f7a7c5e8830746b31e2e
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 813e1e6..5757fb8 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -728,19 +728,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;
@@ -777,12 +795,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 9c14fd8..e5085f6 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -747,14 +747,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;
@@ -783,14 +775,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 bef489f..7c5456c 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -748,19 +748,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;
@@ -797,12 +815,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;
commit e0feba8b05d4bf6a93ca1b250af2e08afbd5e680
Author: Andras Timar <andras.timar at collabora.com>
Date: Mon Jan 6 19:23:01 2014 +0100
EMF/WMF: parse line cap and line join
Change-Id: I081ae9c24e48912631dcfe4aba8a06ff2680aaf5
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index de8b780..813e1e6 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -730,7 +730,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
sal_Bool bTransparent = sal_False;
sal_uInt16 nDashCount = 0;
sal_uInt16 nDotCount = 0;
- switch( nStyle )
+ switch( nStyle & 0xFF )
{
case PS_DASHDOTDOT :
nDotCount++;
@@ -751,6 +751,32 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
case PS_SOLID :
aLineInfo.SetStyle( LINE_SOLID );
}
+ switch( nStyle & 0xF00 )
+ {
+ case PS_ENDCAP_ROUND :
+ aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_ROUND );
+ break;
+ case PS_ENDCAP_SQUARE :
+ aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_SQUARE );
+ break;
+ case PS_ENDCAP_FLAT :
+ default :
+ aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_BUTT );
+ }
+ switch( nStyle & 0xF000 )
+ {
+ case PS_JOIN_ROUND :
+ aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_ROUND );
+ break;
+ case PS_JOIN_MITER :
+ aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_MITER );
+ break;
+ case PS_JOIN_BEVEL :
+ aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_BEVEL );
+ break;
+ default :
+ aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_NONE );
+ }
if ( nDashCount | nDotCount )
{
aLineInfo.SetStyle( LINE_DASH );
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 6c5093d..bef489f 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -750,7 +750,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
sal_Bool bTransparent = sal_False;
sal_uInt16 nDashCount = 0;
sal_uInt16 nDotCount = 0;
- switch( nStyle )
+ switch( nStyle & 0xFF )
{
case PS_DASHDOTDOT :
nDotCount++;
@@ -771,6 +771,32 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
case PS_SOLID :
aLineInfo.SetStyle( LINE_SOLID );
}
+ switch( nStyle & 0xF00 )
+ {
+ case PS_ENDCAP_ROUND :
+ aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_ROUND );
+ break;
+ case PS_ENDCAP_SQUARE :
+ aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_SQUARE );
+ break;
+ case PS_ENDCAP_FLAT :
+ default :
+ aLineInfo.SetLineCap( com::sun::star::drawing::LineCap_BUTT );
+ }
+ switch( nStyle & 0xF000 )
+ {
+ case PS_JOIN_ROUND :
+ aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_ROUND );
+ break;
+ case PS_JOIN_MITER :
+ aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_MITER );
+ break;
+ case PS_JOIN_BEVEL :
+ aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_BEVEL );
+ break;
+ default :
+ aLineInfo.SetLineJoin ( basegfx::B2DLINEJOIN_NONE );
+ }
if ( nDashCount | nDotCount )
{
aLineInfo.SetStyle( LINE_DASH );
More information about the Libreoffice-commits
mailing list