From 06960222c3a2bda6375d84bd3f099f21246ad3b1 Mon Sep 17 00:00:00 2001 From: Lennard Wasserthal Date: Thu, 17 Apr 2014 18:47:53 +0200 Subject: [PATCH] undoing 3998d1abb291309ddbbc2c9869736ebb1ea608f0 No effect. Change-Id: Ie7d7b2d0e1d708f25eaf9234ca8f1789b184ff8f --- vcl/source/filter/wmf/enhwmf.cxx | 6 +-- vcl/source/filter/wmf/winmtf.cxx | 101 +++++---------------------------------- vcl/source/filter/wmf/winmtf.hxx | 18 ++----- 3 files changed, 19 insertions(+), 106 deletions(-) diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx index 7be3492..ba76432 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -549,14 +549,14 @@ bool EnhWMFReader::ReadEnhWMF() case EMR_SETWINDOWEXTEX : { // #75383# pWMF->ReadUInt32( nW ).ReadUInt32( nH ); - pOut->SetWinExt( Size( nW, nH ), true); + pOut->SetWinExt( Size( nW, nH )); } break; case EMR_SETWINDOWORGEX : { pWMF->ReadInt32( nX32 ).ReadInt32( nY32 ); - pOut->SetWinOrg( Point( nX32, nY32 ), true); + pOut->SetWinOrg( Point( nX32, nY32 )); } break; @@ -987,7 +987,7 @@ bool EnhWMFReader::ReadEnhWMF() PolyPolygon aPolyPoly; if ( cbRgnData ) ImplReadRegion( aPolyPoly, *pWMF, nRecSize ); - pOut->SetClipPath( aPolyPoly, iMode, true ); + pOut->SetClipPath( aPolyPoly, iMode, false ); } break; diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index 02f2f4c..7707bac 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -305,18 +305,6 @@ Color WinMtf::ReadColor() return Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) ); }; -Point WinMtfOutput::ImplScale( const Point& rPt) // Hack to set varying defaults for incompletely defined files. -{ - if (mbIsMapDevSet && mbIsMapWinSet) - { - return rPt; //fdo#73764 - } - else - { - return Point((rPt.X())*UNDOCUMENTED_WIN_RCL_RELATION-mrclFrame.Left(),(rPt.Y())*UNDOCUMENTED_WIN_RCL_RELATION-mrclFrame.Top()); - } -} - Point WinMtfOutput::ImplMap( const Point& rPt ) { if ( mnWinExtX && mnWinExtY ) @@ -335,8 +323,8 @@ Point WinMtfOutput::ImplMap( const Point& rPt ) { fX2 -= mnWinOrgX; fY2 = mnWinOrgY-fY2; - fX2 *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH*10; - fY2 *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH*10; + fX2 *= 25.40; + fY2 *= 25.40; fX2 += mnDevOrgX; fY2 += mnDevOrgY; } @@ -345,18 +333,8 @@ Point WinMtfOutput::ImplMap( const Point& rPt ) { fX2 -= mnWinOrgX; fY2 = mnWinOrgY-fY2; - fX2 *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH; - fY2 *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH; - fX2 += mnDevOrgX; - fY2 += mnDevOrgY; - } - break; - case MM_TWIPS: - { - fX2 -= mnWinOrgX; - fY2 = mnWinOrgY-fY2; - fX2 *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH/MILLIINCH_PER_TWIPS; - fY2 *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH/MILLIINCH_PER_TWIPS; + fX2 *= 2.540; + fY2 *= 2.540; fX2 += mnDevOrgX; fY2 += mnDevOrgY; } @@ -417,14 +395,14 @@ Size WinMtfOutput::ImplMap( const Size& rSz ) { case MM_LOENGLISH : { - fWidth *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH*10; - fHeight*=-HUNDREDTH_MILLIMETERS_PER_MILLIINCH*10; + fWidth *= 25.40; + fHeight*=-25.40; } break; case MM_HIENGLISH : { - fWidth *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH; - fHeight*=-HUNDREDTH_MILLIMETERS_PER_MILLIINCH; + fWidth *= 2.540; + fHeight*=-2.540; } break; case MM_LOMETRIC : @@ -438,12 +416,6 @@ Size WinMtfOutput::ImplMap( const Size& rSz ) fHeight *= -1; } break; - case MM_TWIPS: - { - fWidth *= HUNDREDTH_MILLIMETERS_PER_MILLIINCH/MILLIINCH_PER_TWIPS; - fHeight*=-HUNDREDTH_MILLIMETERS_PER_MILLIINCH/MILLIINCH_PER_TWIPS; - } - break; default : { fWidth /= mnWinExtX; @@ -492,25 +464,6 @@ Polygon& WinMtfOutput::ImplMap( Polygon& rPolygon ) return rPolygon; } -Polygon& WinMtfOutput::ImplScale( Polygon& rPolygon ) -{ - sal_uInt16 nPoints = rPolygon.GetSize(); - for ( sal_uInt16 i = 0; i < nPoints; i++ ) - { - rPolygon[ i ] = ImplScale( rPolygon[ i ] ); - } - return rPolygon; -} - -PolyPolygon& WinMtfOutput::ImplScale( PolyPolygon& rPolyPolygon ) -{ - sal_uInt16 nPolys = rPolyPolygon.Count(); - for (sal_uInt16 i = 0; i < nPolys; ++i) - { - ImplScale(rPolyPolygon[i]); - } - return rPolyPolygon; -} PolyPolygon& WinMtfOutput::ImplMap( PolyPolygon& rPolyPolygon ) { @@ -788,8 +741,7 @@ void WinMtfOutput::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClip mbClipNeedsUpdate=true; if ( bIsMapped ) { - PolyPolygon aPP( rPolyPolygon ); - aClipPath.setClipPath( ImplScale( aPP ), nClippingMode ); + aClipPath.setClipPath(rPolyPolygon , nClippingMode ); } else { @@ -830,8 +782,6 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : mnMillY ( 1 ), mpGDIMetaFile ( &rGDIMetaFile ) { - mbIsMapWinSet = false; - mbIsMapDevSet = false; mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); // The original clipregion has to be on top // of the stack so it can always be restored // this is necessary to be able to support @@ -1769,7 +1719,7 @@ void WinMtfOutput::SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ) mnDevOrgY += nYAdd; } -void WinMtfOutput::SetDevExt( const Size& rSize ,bool regular) +void WinMtfOutput::SetDevExt( const Size& rSize ) { if ( rSize.Width() && rSize.Height() ) { @@ -1782,10 +1732,6 @@ void WinMtfOutput::SetDevExt( const Size& rSize ,bool regular) mnDevHeight = rSize.Height(); } } - if (regular) - { - mbIsMapDevSet=true; - } } } @@ -1795,15 +1741,10 @@ void WinMtfOutput::ScaleDevExt( double fX, double fY ) mnDevHeight = FRound( mnDevHeight * fY ); } -void WinMtfOutput::SetWinOrg( const Point& rPoint , bool bIsEMF) +void WinMtfOutput::SetWinOrg( const Point& rPoint ) { mnWinOrgX = rPoint.X(); mnWinOrgY = rPoint.Y(); - if (bIsEMF) - { - SetDevByWin(); - } - mbIsMapWinSet=true; } void WinMtfOutput::SetWinOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ) @@ -1812,18 +1753,7 @@ void WinMtfOutput::SetWinOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ) mnWinOrgY += nYAdd; } -void WinMtfOutput::SetDevByWin() //mnWinExt...-stuff has to be assigned before. -{ - if (!mbIsMapDevSet) - { - if ( mnMapMode == MM_ISOTROPIC ) //TODO: WHAT ABOUT ANISOTROPIC??? - { - SetDevExt(Size((mnWinExtX+mnWinOrgX)>>MS_FIXPOINT_BITCOUNT_28_4,-((mnWinExtY-mnWinOrgY)>>MS_FIXPOINT_BITCOUNT_28_4)),false); - } - } -} - -void WinMtfOutput::SetWinExt( const Size& rSize, bool bIsEMF ) +void WinMtfOutput::SetWinExt( const Size& rSize ) { if( rSize.Width() && rSize.Height() ) { @@ -1834,11 +1764,6 @@ void WinMtfOutput::SetWinExt( const Size& rSize, bool bIsEMF ) { mnWinExtX = rSize.Width(); mnWinExtY = rSize.Height(); - if (bIsEMF) - { - SetDevByWin(); - } - mbIsMapWinSet=true; } } } @@ -1875,7 +1800,7 @@ void WinMtfOutput::SetRefMill( const Size& rSize ) void WinMtfOutput::SetMapMode( sal_uInt32 nMapMode ) { mnMapMode = nMapMode; - if ( nMapMode == MM_TEXT && !mbIsMapWinSet ) + if ( nMapMode == MM_TEXT ) { mnWinExtX = mnDevWidth; mnWinExtY = mnDevHeight; diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx index 035686c..a137bc6 100644 --- a/vcl/source/filter/wmf/winmtf.hxx +++ b/vcl/source/filter/wmf/winmtf.hxx @@ -271,12 +271,6 @@ struct WMF_EXTERNALHEADER; #define PRIVATE_ESCAPE_UNICODE 2 -//Scalar constants - -#define UNDOCUMENTED_WIN_RCL_RELATION 32 -#define MS_FIXPOINT_BITCOUNT_28_4 4 -#define HUNDREDTH_MILLIMETERS_PER_MILLIINCH 2.54 -#define MILLIINCH_PER_TWIPS 1.44 //============================ WMFReader ================================== @@ -601,8 +595,6 @@ class WinMtfOutput sal_Int32 mnDevWidth, mnDevHeight; sal_Int32 mnWinOrgX, mnWinOrgY; // aktuel window origin sal_Int32 mnWinExtX, mnWinExtY; // aktuel window extend - bool mbIsMapWinSet; - bool mbIsMapDevSet; sal_Int32 mnPixX, mnPixY; // Reference Device in pixel sal_Int32 mnMillX, mnMillY; // Reference Device in Mill @@ -615,14 +607,11 @@ class WinMtfOutput void UpdateFillStyle(); Point ImplMap( const Point& rPt ); - Point ImplScale( const Point& rPt ); Size ImplMap( const Size& rSz ); Rectangle ImplMap( const Rectangle& rRectangle ); void ImplMap( Font& rFont ); Polygon& ImplMap( Polygon& rPolygon ); PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon ); - Polygon& ImplScale( Polygon& rPolygon ); - PolyPolygon& ImplScale( PolyPolygon& rPolyPolygon ); void ImplResizeObjectArry( sal_uInt32 nNewEntry ); void ImplSetNonPersistentLineColorTransparenz(); void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly ); @@ -630,15 +619,14 @@ class WinMtfOutput public: - void SetDevByWin(); //Hack to set varying defaults for incompletely defined files. void SetDevOrg( const Point& rPoint ); void SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ); - void SetDevExt( const Size& rSize ,bool regular = true); + void SetDevExt( const Size& rSize ); void ScaleDevExt( double fX, double fY ); - void SetWinOrg( const Point& rPoint , bool bIsEMF = false); + void SetWinOrg( const Point& rPoint ); void SetWinOrgOffset( sal_Int32 nX, sal_Int32 nY ); - void SetWinExt( const Size& rSize , bool bIsEMF = false); + void SetWinExt( const Size& rSize ); void ScaleWinExt( double fX, double fY ); void SetrclBounds( const Rectangle& rRect ); -- 1.8.3.2