[Libreoffice-commits] .: 3 commits - cppcanvas/source vcl/source

Radek Doulík rodo at kemper.freedesktop.org
Wed Aug 10 13:44:35 PDT 2011


 cppcanvas/source/mtfrenderer/emfplus.cxx      |   51 +++++++++++++++++++-------
 cppcanvas/source/mtfrenderer/implrenderer.cxx |    2 +
 vcl/source/gdi/gdimtf.cxx                     |   37 ++++++++++--------
 3 files changed, 61 insertions(+), 29 deletions(-)

New commits:
commit d7d976c257d4ea8946643e3caff163346da8daa6
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Aug 10 20:49:51 2011 +0200

    check bitmap size before creating canvas action

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 30090a9..dfb7c34 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1417,20 +1417,24 @@ namespace cppcanvas
                                 aBmp.Crop( aCropRect );
 
 
-                                ActionSharedPtr pBmpAction (
-                                    internal::BitmapActionFactory::createBitmapAction (
-                                        aBmp,
-                                        rState.mapModeTransform * Map (x1, y1),
-                                        rState.mapModeTransform * MapSize(x2 - x1, y3 - y1),
-                                        rCanvas,
-                                        rState));
-
-                                if( pBmpAction ) {
-                                    maActions.push_back( MtfAction( pBmpAction,
-                                                                    rFactoryParms.mrCurrActionIndex ) );
-
-                                    rFactoryParms.mrCurrActionIndex += pBmpAction->getActionCount()-1;
-                                }
+                                Size aSize( aBmp.GetSizePixel() );
+                                if( aSize.Width() > 0 && aSize.Height() > 0 ) {
+                                    ActionSharedPtr pBmpAction (
+                                        internal::BitmapActionFactory::createBitmapAction (
+                                            aBmp,
+                                            rState.mapModeTransform * Map (x1, y1),
+                                            rState.mapModeTransform * MapSize(x2 - x1, y3 - y1),
+                                            rCanvas,
+                                            rState));
+
+                                    if( pBmpAction ) {
+                                        maActions.push_back( MtfAction( pBmpAction,
+                                                                        rFactoryParms.mrCurrActionIndex ) );
+
+                                        rFactoryParms.mrCurrActionIndex += pBmpAction->getActionCount()-1;
+                                    }
+                                } else
+                                    EMFP_DEBUG (printf ("EMF+ warning: empty bitmap\n"));
                             } else {
                                 EMFP_DEBUG (printf ("EMF+ DrawImagePoints TODO (fixme)\n"));
                 }
commit d0a69c9a1ffee644a8d2a2881c03847687e60af8
Author: Radek Doulik <rodo at novell.com>
Date:   Tue Aug 9 11:54:03 2011 +0200

    fix rendering of metafiles embedded in emf+

diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 3074017..6fe6504 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -568,27 +568,30 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
         pOut->SetLayoutMode( 0 );
         pOut->SetDigitLanguage( 0 );
 
-        for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ )
-        {
-            if( !Hook() )
+        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() ) ) {
+            for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ )
             {
-                MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction);
-                if( pAction->GetType() == META_COMMENT_ACTION &&
-                    pCommentAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") )
+                if( !Hook() )
                 {
-                    ImplDelegate2PluggableRenderer(pCommentAct, pOut);
-                }
-                else
-                {
-                    pAction->Execute( pOut );
+                    MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction);
+                    if( pAction->GetType() == META_COMMENT_ACTION &&
+                        pCommentAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") )
+                    {
+                        ImplDelegate2PluggableRenderer(pCommentAct, pOut);
+                    }
+                    else
+                    {
+                        pAction->Execute( pOut );
+                    }
+
+                    // flush output from time to time
+                    if( i++ > nSyncCount )
+                        ( (Window*) pOut )->Flush(), i = 0;
                 }
 
-                // flush output from time to time
-                if( i++ > nSyncCount )
-                    ( (Window*) pOut )->Flush(), i = 0;
+                pAction = NextAction();
             }
-
-            pAction = NextAction();
         }
 
         pOut->Pop();
@@ -756,7 +759,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
     {
         GDIMetaFile*    pMtf = pOut->GetConnectMetaFile();
 
-        if( bUseCanvas && !pMtf && ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
+        if( bUseCanvas && ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
             return;
 
         Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
commit 2c9d31b48de5e1d7e57637f77654aa50eca048d1
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Jul 27 16:27:25 2011 +0200

    added MultiplyWorldTransform record type

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 6b88b02..30090a9 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -73,6 +73,7 @@
 #define EmfPlusRecordTypeSave 16421
 #define EmfPlusRecordTypeSetWorldTransform 16426
 #define EmfPlusRecordTypeResetWorldTransform 16427
+#define EmfPlusRecordTypeMultiplyWorldTransform 16428
 #define EmfPlusRecordTypeSetPageTransform 16432
 #define EmfPlusRecordTypeSetClipPath 16435
 #define EmfPlusRecordTypeSetClipRegion 16436
@@ -1491,6 +1492,28 @@ namespace cppcanvas
                     EMFP_DEBUG (printf ("EMF+ ResetWorldTransform\n"));
                     aWorldTransform.SetIdentity ();
                     break;
+                case EmfPlusRecordTypeMultiplyWorldTransform: {
+                    EMFP_DEBUG (printf ("EMF+ MultiplyWorldTransform\n"));
+                    XForm transform;
+                    rMF >> transform;
+
+                    EMFP_DEBUG (printf ("EMF+\tmatrix m11: %f m12: %f\nEMF+\tm21: %f m22: %f\nEMF+\tdx: %f dy: %f\n",
+                            transform.eM11, transform.eM12,
+                            transform.eM21, transform.eM22,
+                            transform.eDx, transform.eDy));
+
+                    if (flags & 0x2000)  // post multiply
+                        aWorldTransform.Multiply (transform);
+                    else {               // pre multiply
+                        transform.Multiply (aWorldTransform);
+                        aWorldTransform.Set (transform);
+                    }
+                    EMFP_DEBUG (printf ("EMF+\tresult world matrix m11: %f m12: %f\nEMF+\tm21: %f m22: %f\nEMF+\tdx: %f dy: %f\n",
+                            aWorldTransform.eM11, aWorldTransform.eM12,
+                            aWorldTransform.eM21, aWorldTransform.eM22,
+                            aWorldTransform.eDx, aWorldTransform.eDy));
+                    break;
+                }
                 case EmfPlusRecordTypeSetClipPath:
                     {
                         EMFP_DEBUG (printf ("EMF+ SetClipPath\n"));
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index e67b87a..46f3e40 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1336,6 +1336,8 @@ namespace cppcanvas
                 // - SetFont to process font metric specific actions
                 pCurrAct->Execute( &rVDev );
 
+                EMFP_DEBUG(printf("MTF\trecord type: %x\n", pCurrAct->GetType()));
+
                 switch( pCurrAct->GetType() )
                 {
                     // ------------------------------------------------------------


More information about the Libreoffice-commits mailing list