From 22f63e3e7be99f13fd719ffc03aa78e34bd545af Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Wed, 27 Nov 2013 12:12:42 +0100 Subject: [PATCH 003/109] fdo#61272: Do the mapping correctly both for WMF and EMF. Turns out that for the WMF, we already had everything set up correctly, we were just overwriting the right settings with default data again :-) - fix that. Includes the following commits: * Revert "wmf-mm-text-1.diff: Fix WMF rendering, n#417818" * Revert "wmf-mm-text.diff: Fix WMF rendering, n#417818" * fdo#56886 EMF: Fixes some scaling problems of clipped regions, Twips Change-Id: I7ff859246dbaea3868438d3632f9adc60fc4ee37 Reviewed-on: https://gerrit.libreoffice.org/6829 Reviewed-by: Andras Timar Tested-by: Andras Timar --- vcl/source/filter/wmf/winmtf.cxx | 33 +-------------------------------- vcl/source/filter/wmf/winmtf.hxx | 1 - vcl/source/filter/wmf/winwmf.cxx | 1 - 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index c8c6652..6d44084 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -374,19 +374,6 @@ Point WinMtfOutput::ImplMap( const Point& rPt ) { switch( mnMapMode ) { - case MM_TEXT: - fX2 -= mnWinOrgX; - fY2 -= mnWinOrgY; - if( mnDevWidth != 1 || mnDevHeight != 1 ) { - fX2 *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH*1000/mnUnitsPerInch; - fY2 *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH*1000/mnUnitsPerInch; - } - fX2 += mnDevOrgX; - fY2 += mnDevOrgY; - fX2 *= (double)mnMillX * 100.0 / (double)mnPixX; - fY2 *= (double)mnMillY * 100.0 / (double)mnPixY; - - break; case MM_LOENGLISH : { fX2 -= mnWinOrgX; @@ -471,15 +458,6 @@ Size WinMtfOutput::ImplMap( const Size& rSz ) { switch( mnMapMode ) { - case MM_TEXT: - if( mnDevWidth != 1 && mnDevHeight != 1 ) { - fWidth *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH*1000/mnUnitsPerInch; - fHeight*= HUNDREDTH_MILLIMETERS_PER_MILLIINCH*1000/mnUnitsPerInch; - } else { - fWidth *= (double)mnMillX * 100 / (double)mnPixX; - fHeight *= (double)mnMillY * 100 / (double)mnPixY; - } - break; case MM_LOENGLISH : { fWidth *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH*10; @@ -916,7 +894,6 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : mbComplexClip ( false ), mnGfxMode ( GM_COMPATIBLE ), mnMapMode ( MM_TEXT ), - mnUnitsPerInch ( 96 ), mnDevOrgX ( 0 ), mnDevOrgY ( 0 ), mnDevWidth ( 1 ), @@ -2025,7 +2002,7 @@ void WinMtfOutput::SetRefMill( const Size& rSize ) void WinMtfOutput::SetMapMode( sal_uInt32 nMapMode ) { mnMapMode = nMapMode; - if ( nMapMode == MM_TEXT ) + if ( nMapMode == MM_TEXT && !mbIsMapWinSet ) { mnWinExtX = mnDevWidth; mnWinExtY = mnDevHeight; @@ -2039,14 +2016,6 @@ void WinMtfOutput::SetMapMode( sal_uInt32 nMapMode ) -void WinMtfOutput::SetUnitsPerInch( sal_uInt16 nUnitsPerInch ) -{ - if( nUnitsPerInch != 0 ) - mnUnitsPerInch = nUnitsPerInch; -} - - - void WinMtfOutput::SetWorldTransform( const XForm& rXForm ) { maXForm.eM11 = rXForm.eM11; diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx index bec5d8a..8e18f7e 100644 --- a/vcl/source/filter/wmf/winmtf.hxx +++ b/vcl/source/filter/wmf/winmtf.hxx @@ -679,7 +679,6 @@ public: sal_uInt32 GetMapMode() const { return mnMapMode; }; void SetMapMode( sal_uInt32 mnMapMode ); - void SetUnitsPerInch( sal_uInt16 nUnitsPerInch ); void SetWorldTransform( const XForm& rXForm ); void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index 84b1a78..3777c3b 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -1108,7 +1108,6 @@ sal_Bool WMFReader::ReadHeader() } } - pOut->SetUnitsPerInch( nUnitsPerInch ); pOut->SetWinOrg( aPlaceableBound.TopLeft() ); Size aWMFSize( labs( aPlaceableBound.GetWidth() ), labs( aPlaceableBound.GetHeight() ) ); pOut->SetWinExt( aWMFSize ); -- 1.8.4.2