summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-08-12 16:01:40 +0200
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-08-12 16:01:40 +0200
commitb045af077a788a6b95b2e690d58ea1712c6f3d25 (patch)
treeef73a1afe9c85fc6f3634f7534e5869c9622a743 /vcl
parent6bb9f5bea7037dcda3cb3e104452fb0104544bfb (diff)
ooo33gsl05: #i113025# fix GDIMetaFile handlng of MapMode MAP_PIXEL
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/gdimtf.hxx2
-rw-r--r--vcl/source/gdi/gdimtf.cxx43
-rw-r--r--vcl/source/gdi/metaact.cxx2
-rwxr-xr-xvcl/source/gdi/print3.cxx6
4 files changed, 49 insertions, 4 deletions
diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx
index 06f7a0d14a2e..c168443741fc 100644
--- a/vcl/inc/vcl/gdimtf.hxx
+++ b/vcl/inc/vcl/gdimtf.hxx
@@ -158,6 +158,8 @@ public:
sal_Bool IsEqual( const GDIMetaFile& rMtf ) const;
BOOL Mirror( ULONG nMirrorFlags );
void Move( long nX, long nY );
+ // additional Move method getting specifics how to handle MapMode( MAP_PIXEL )
+ void Move( long nX, long nY, long nDPIX, long nDPIX );
void Scale( double fScaleX, double fScaleY );
void Scale( const Fraction& rScaleX, const Fraction& rScaleY );
void Rotate( long nAngle10 );
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 01b34286a086..818a31a10c0f 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -841,6 +841,49 @@ void GDIMetaFile::Move( long nX, long nY )
}
}
+void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY )
+{
+ const Size aBaseOffset( nX, nY );
+ Size aOffset( aBaseOffset );
+ VirtualDevice aMapVDev;
+
+ aMapVDev.EnableOutput( FALSE );
+ aMapVDev.SetReferenceDevice( nDPIX, nDPIY );
+ aMapVDev.SetMapMode( GetPrefMapMode() );
+
+ for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() )
+ {
+ const long nType = pAct->GetType();
+ MetaAction* pModAct;
+
+ if( pAct->GetRefCount() > 1 )
+ {
+ Replace( pModAct = pAct->Clone(), GetCurPos() );
+ pAct->Delete();
+ }
+ else
+ pModAct = pAct;
+
+ if( ( META_MAPMODE_ACTION == nType ) ||
+ ( META_PUSH_ACTION == nType ) ||
+ ( META_POP_ACTION == nType ) )
+ {
+ pModAct->Execute( &aMapVDev );
+ if( aMapVDev.GetMapMode().GetMapUnit() == MAP_PIXEL )
+ {
+ aOffset = aMapVDev.LogicToPixel( aBaseOffset, GetPrefMapMode() );
+ MapMode aMap( aMapVDev.GetMapMode() );
+ aOffset.Width() = aOffset.Width() * (double)aMap.GetScaleX();
+ aOffset.Height() = aOffset.Height() * (double)aMap.GetScaleY();
+ }
+ else
+ aOffset = aMapVDev.LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev.GetMapMode() );
+ }
+
+ pModAct->Move( aOffset.Width(), aOffset.Height() );
+ }
+}
+
// ------------------------------------------------------------------------
void GDIMetaFile::Scale( double fScaleX, double fScaleY )
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 752a4222bcb2..94f07b8f17d1 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -4078,7 +4078,7 @@ void MetaCommentAction::Move( long nXMove, long nYMove )
aMemStm >> aFill;
PolyPolygon aPath;
aFill.getPath( aPath );
- aPath.Scale( nXMove, nYMove );
+ aPath.Move( nXMove, nYMove );
aFill.setPath( aPath );
aDest << aFill;
}
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index b3f858a06f2d..375c570f1a16 100755
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -958,7 +958,7 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte
o_rMtf.WindStart();
long nDX = (aPaperSize.Width() - aPageSize.aSize.Width()) / 2;
long nDY = (aPaperSize.Height() - aPageSize.aSize.Height()) / 2;
- o_rMtf.Move( nDX, nDY );
+ o_rMtf.Move( nDX, nDY, mpImplData->mpPrinter->ImplGetDPIX(), mpImplData->mpPrinter->ImplGetDPIY() );
o_rMtf.WindStart();
o_rMtf.SetPrefSize( aPaperSize );
aPageSize.aSize = aPaperSize;
@@ -1033,7 +1033,7 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte
long nOffY = (aSubPageSize.Height() - long(double(aPageSize.aSize.Height()) * fScale)) / 2;
long nX = rMPS.nLeftMargin + nOffX + nAdvX * nCellX;
long nY = rMPS.nTopMargin + nOffY + nAdvY * nCellY;
- aPageFile.Move( nX, nY );
+ aPageFile.Move( nX, nY, mpImplData->mpPrinter->ImplGetDPIX(), mpImplData->mpPrinter->ImplGetDPIY() );
aPageFile.WindStart();
// calculate border rectangle
Rectangle aSubPageRect( Point( nX, nY ),
@@ -1153,7 +1153,7 @@ void PrinterController::printFilteredPage( int i_nPage )
{
Point aPageOffset( mpImplData->mpPrinter->GetPageOffset() );
aPageFile.WindStart();
- aPageFile.Move( -aPageOffset.X(), -aPageOffset.Y() );
+ aPageFile.Move( -aPageOffset.X(), -aPageOffset.Y(), mpImplData->mpPrinter->ImplGetDPIX(), mpImplData->mpPrinter->ImplGetDPIY() );
}
GDIMetaFile aCleanedFile;