[Libreoffice-commits] core.git: include/vcl vcl/source

Radek Doulik rodo at novell.com
Mon May 27 08:09:58 PDT 2013


 include/vcl/gdimtf.hxx             |    2 +-
 vcl/source/gdi/gdimtf.cxx          |   15 ++++++++++-----
 vcl/source/gdi/pdfwriter_impl2.cxx |    2 +-
 3 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit c47f0903fe0fb2f743d179d1ac9a2dcdfb19af10
Author: Radek Doulik <rodo at novell.com>
Date:   Mon Apr 29 00:00:00 2013 +0200

    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

diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index bbdf141..c790acd 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 223fd65..5fdcba0 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 7775741..a8e0d7d 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 );


More information about the Libreoffice-commits mailing list