summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadek Doulik <rodo@novell.com>2013-04-29 00:00:00 +0200
committerThorsten Behrens <tbehrens@suse.com>2013-05-15 00:00:17 +0200
commit4c676625d4016d428e9becd5512b7cfc8b0c4b24 (patch)
treed7eba3f87fdb8cacda9e54872c49ac99ab34ed58
parent0797b27ff5b18abd3bbdcba7b7a361d0097fd93e (diff)
Fix bnc#795857 Use correct sizes for EMF+ bitmap rendering
Fix pdf export wrong size issues for embedded EMF+ images. Change-Id: I998c9535bde32fc9f452d61d7cb7609c95f5528d
-rw-r--r--vcl/inc/vcl/gdimtf.hxx2
-rw-r--r--vcl/source/gdi/gdimtf.cxx15
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx2
3 files changed, 12 insertions, 7 deletions
diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx
index ecefb903c467..90fce692fc96 100644
--- a/vcl/inc/vcl/gdimtf.hxx
+++ b/vcl/inc/vcl/gdimtf.hxx
@@ -124,7 +124,7 @@ private:
const OutputDevice& rMapDev,
const PolyPolygon& rPolyPoly,
const Gradient& rGrad );
- SAL_DLLPRIVATE bool ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize );
+ SAL_DLLPRIVATE bool ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rLogicDestSize );
SAL_DLLPRIVATE void ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OutputDevice* pOut );
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 3fbb01ce6788..526196dc1054 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -399,7 +399,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
OSL_TRACE("GDIMetaFile::Play on device of size: %d x %d", pOut->GetOutputSizePixel().Width(), pOut->GetOutputSizePixel().Height());
- if( !ImplPlayWithRenderer( pOut, Point(0,0), pOut->GetOutputSizePixel() ) ) {
+ if( !ImplPlayWithRenderer( pOut, Point(0,0), pOut->GetOutputSize() ) ) {
size_t i = 0;
for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ )
{
@@ -430,11 +430,13 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
// ------------------------------------------------------------------------
-bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize )
+bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rLogicDestSize )
{
if (!bUseCanvas)
return false;
+ Size rDestSize( pOut->LogicToPixel( rLogicDestSize ) );
+
const Window* win = dynamic_cast <Window*> ( pOut );
if (!win)
@@ -485,7 +487,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
if( pBitmapEx ) {
- pOut->DrawBitmapEx( rPos, *pBitmapEx );
+ pOut->DrawBitmapEx( rPos, rLogicDestSize, *pBitmapEx );
delete pBitmapEx;
return true;
}
@@ -497,7 +499,10 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
if( pSalBmp->Create( xBitmapCanvas, aSize ) )
{
Bitmap aBitmap( pSalBmp );
- pOut->DrawBitmap( rPos, aBitmap );
+ if ( pOut->GetMapMode() == MAP_PIXEL )
+ pOut->DrawBitmap( rPos, aBitmap );
+ else
+ pOut->DrawBitmap( rPos, rLogicDestSize, aBitmap );
return true;
}
@@ -602,7 +607,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
{
GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
- if( ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
+ if( ImplPlayWithRenderer( pOut, rPos, rSize ) )
return;
Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index beee4613e3c7..8579168a2c07 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -769,7 +769,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
BitmapEx aBitmapEx( pA->GetBitmap() );
Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
- aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
+ aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
if( ! ( aSize.Width() && aSize.Height() ) )
aSize = pDummyVDev->PixelToLogic( aBitmapEx.GetSizePixel() );
implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext );