Kaydet (Commit) 4c676625 authored tarafından Radek Doulik's avatar Radek Doulik Kaydeden (comit) Thorsten Behrens

Fix bnc#795857 Use correct sizes for EMF+ bitmap rendering

Fix pdf export wrong size issues for embedded EMF+ images.

Change-Id: I998c9535bde32fc9f452d61d7cb7609c95f5528d
üst 0797b27f
...@@ -124,7 +124,7 @@ private: ...@@ -124,7 +124,7 @@ private:
const OutputDevice& rMapDev, const OutputDevice& rMapDev,
const PolyPolygon& rPolyPoly, const PolyPolygon& rPolyPoly,
const Gradient& rGrad ); 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 ); SAL_DLLPRIVATE void ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OutputDevice* pOut );
......
...@@ -399,7 +399,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos ) ...@@ -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()); 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; size_t i = 0;
for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ ) for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ )
{ {
...@@ -430,11 +430,13 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos ) ...@@ -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) if (!bUseCanvas)
return false; return false;
Size rDestSize( pOut->LogicToPixel( rLogicDestSize ) );
const Window* win = dynamic_cast <Window*> ( pOut ); const Window* win = dynamic_cast <Window*> ( pOut );
if (!win) if (!win)
...@@ -485,7 +487,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S ...@@ -485,7 +487,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 ); uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue()); BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
if( pBitmapEx ) { if( pBitmapEx ) {
pOut->DrawBitmapEx( rPos, *pBitmapEx ); pOut->DrawBitmapEx( rPos, rLogicDestSize, *pBitmapEx );
delete pBitmapEx; delete pBitmapEx;
return true; return true;
} }
...@@ -497,7 +499,10 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S ...@@ -497,7 +499,10 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
if( pSalBmp->Create( xBitmapCanvas, aSize ) ) if( pSalBmp->Create( xBitmapCanvas, aSize ) )
{ {
Bitmap aBitmap( pSalBmp ); Bitmap aBitmap( pSalBmp );
pOut->DrawBitmap( rPos, aBitmap ); if ( pOut->GetMapMode() == MAP_PIXEL )
pOut->DrawBitmap( rPos, aBitmap );
else
pOut->DrawBitmap( rPos, rLogicDestSize, aBitmap );
return true; return true;
} }
...@@ -602,7 +607,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos, ...@@ -602,7 +607,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
{ {
GDIMetaFile* pMtf = pOut->GetConnectMetaFile(); GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
if( ImplPlayWithRenderer( pOut, rPos, aDestSize ) ) if( ImplPlayWithRenderer( pOut, rPos, rSize ) )
return; return;
Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) ); Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
......
...@@ -769,7 +769,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa ...@@ -769,7 +769,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
const MetaBmpAction* pA = (const MetaBmpAction*) pAction; const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
BitmapEx aBitmapEx( pA->GetBitmap() ); BitmapEx aBitmapEx( pA->GetBitmap() );
Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(), Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) ); aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
if( ! ( aSize.Width() && aSize.Height() ) ) if( ! ( aSize.Width() && aSize.Height() ) )
aSize = pDummyVDev->PixelToLogic( aBitmapEx.GetSizePixel() ); aSize = pDummyVDev->PixelToLogic( aBitmapEx.GetSizePixel() );
implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext ); implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment