summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadek Doulik <rodo@novell.com>2013-04-29 00:00:00 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-05-27 17:06:15 +0200
commitc47f0903fe0fb2f743d179d1ac9a2dcdfb19af10 (patch)
tree3059bc41b01d716cd990fd467d89cb2544750f5b
parente1f1092287c84f4749a586bbc84154d4a896839a (diff)
Fix bnc#795857 Use correct sizes for EMF+ bitmap rendering
Fix pdf export wrong size issues for embedded EMF+ images. Change-Id: I998c9535bde32fc9f452d61d7cb7609c95f5528d (cherry picked from commit 4c676625d4016d428e9becd5512b7cfc8b0c4b24) Conflicts: vcl/inc/vcl/gdimtf.hxx vcl/source/gdi/gdimtf.cxx
-rw-r--r--include/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/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index bbdf14177b3b..c790acdd7c43 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -111,7 +111,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 223fd65547dd..5fdcba0447fd 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -355,7 +355,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++ )
{
@@ -384,11 +384,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)
@@ -433,7 +435,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;
}
@@ -445,7 +447,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;
}
@@ -549,7 +554,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 7775741d0d24..a8e0d7d96f73 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -774,7 +774,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 );