[Libreoffice-commits] .: vcl/source

Radek Doulík rodo at kemper.freedesktop.org
Tue Jan 31 02:38:43 PST 2012


 vcl/source/gdi/gdimtf.cxx |   43 +++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

New commits:
commit bfc9d72d70092a6d59c1df65308f04e8bc80f80b
Author: Radek Doulik <rodo at novell.com>
Date:   Tue Jan 31 10:07:46 2012 +0100

    fix rendering of metafiles embedded in emf+ (updated)

diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index e9ac49e..93be21a 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -406,29 +406,32 @@ 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().equalsL(RTL_CONSTASCII_STRINGPARAM("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().equalsL(RTL_CONSTASCII_STRINGPARAM("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();
     }
 }
@@ -437,6 +440,9 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
 
 bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize )
 {
+    if (!bUseCanvas)
+        return false;
+
     const Window* win = dynamic_cast <Window*> ( pOut );
 
     if (!win)
@@ -608,7 +614,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
     {
         GDIMetaFile*    pMtf = pOut->GetConnectMetaFile();
 
-        if( bUseCanvas && !pMtf && ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
+        if( ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
             return;
 
         Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
@@ -2042,6 +2048,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol
 
     aMtf.aPrefSize = aPrefSize;
     aMtf.aPrefMapMode = aPrefMapMode;
+    aMtf.bUseCanvas = bUseCanvas;
 
     for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() )
     {


More information about the Libreoffice-commits mailing list