From 17ca93a6e592d3109e47c756fcfe8ac975acae5f Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sat, 26 Apr 2014 19:20:22 +0200 Subject: fdo#74336 need to transform dash length / dot length / distance Dash length, dot length and distance also need to be world transformed to be compatible with device metrics. Change-Id: I57c04f5010006aaf8c1c32e0949cb39b7f2bc67d --- vcl/source/filter/wmf/winmtf.cxx | 22 ++++++++++++++++------ vcl/source/filter/wmf/winmtf.hxx | 2 ++ 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'vcl') diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index 7aa73372c6f8..7c4b01d8f7ed 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -473,6 +473,20 @@ void WinMtfOutput::ImplMap( Font& rFont ) rFont.SetOrientation( 3600 - rFont.GetOrientation() ); } +sal_Int32 WinMtfOutput::ImplConvertWidth(const sal_Int32 aWidth) +{ + Size aSize(aWidth, 0); + return ImplMap(aSize).Width(); +} + +void WinMtfOutput::ImplMap(LineInfo& rLineInfo) +{ + rLineInfo.SetWidth(ImplConvertWidth(rLineInfo.GetWidth())); + rLineInfo.SetDashLen(ImplConvertWidth(rLineInfo.GetDashLen())); + rLineInfo.SetDotLen(ImplConvertWidth(rLineInfo.GetDotLen())); + rLineInfo.SetDistance(ImplConvertWidth(rLineInfo.GetDistance())); +} + Polygon& WinMtfOutput::ImplMap( Polygon& rPolygon ) { sal_uInt16 nPoints = rPolygon.GetSize(); @@ -682,9 +696,7 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle ) else if ( eType == GDI_PEN ) { WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle; - Size aSize(pLineStyle->aLineInfo.GetWidth(), 0); - aSize = ImplMap(aSize); - pLineStyle->aLineInfo.SetWidth(aSize.Width()); + ImplMap(pLineStyle->aLineInfo); } } sal_uInt32 nIndex; @@ -716,9 +728,7 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS else if ( eType == GDI_PEN ) { WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle; - Size aSize(pLineStyle->aLineInfo.GetWidth(), 0); - aSize = ImplMap(aSize); - pLineStyle->aLineInfo.SetWidth(aSize.Width()); + ImplMap(pLineStyle->aLineInfo); } } if ( (sal_uInt32)nIndex >= vGDIObj.size() ) diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx index 035686c25430..52b18483c32d 100644 --- a/vcl/source/filter/wmf/winmtf.hxx +++ b/vcl/source/filter/wmf/winmtf.hxx @@ -619,6 +619,8 @@ class WinMtfOutput Size ImplMap( const Size& rSz ); Rectangle ImplMap( const Rectangle& rRectangle ); void ImplMap( Font& rFont ); + sal_Int32 ImplConvertWidth(const sal_Int32 aWidth); + void ImplMap(LineInfo& rLineInfo); Polygon& ImplMap( Polygon& rPolygon ); PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon ); Polygon& ImplScale( Polygon& rPolygon ); -- cgit