ooo-build r12685 - in branches/ooo-build-2-4: . patches/emf+ patches/src680



Author: rodo
Date: Wed May 28 14:51:39 2008
New Revision: 12685
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12685&view=rev

Log:
2008-05-27  Radek Doulik  <rodo novell com>

	* patches/src680/apply: added emf+-multipart-objects.diff which
	contains changes described below

	* cppcanvas/source/mtfrenderer/emfplus.cxx: handle multipart
	object records



Added:
   branches/ooo-build-2-4/patches/emf+/emf+-multipart-objects.diff
Modified:
   branches/ooo-build-2-4/ChangeLog
   branches/ooo-build-2-4/patches/src680/apply

Added: branches/ooo-build-2-4/patches/emf+/emf+-multipart-objects.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4/patches/emf+/emf+-multipart-objects.diff	Wed May 28 14:51:39 2008
@@ -0,0 +1,224 @@
+diff --git cppcanvas/source/inc/implrenderer.hxx cppcanvas/source/inc/implrenderer.hxx
+index 59d793f..bb6ce2a 100644
+--- cppcanvas/source/inc/implrenderer.hxx
++++ cppcanvas/source/inc/implrenderer.hxx
+@@ -282,6 +282,7 @@ static float GetSwapFloat( SvStream& rSt )
+                                    ActionVector::const_iterator& o_rRangeBegin,
+                                    ActionVector::const_iterator& o_rRangeEnd ) const;
+ 
++            void processObjectRecord(SvMemoryStream& rObjectStream, UINT16 flags);
+             void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas );
+             void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
+ 
+@@ -306,6 +307,10 @@ static float GetSwapFloat( SvStream& rSt )
+             sal_Int32       nPixY;
+             sal_Int32       nMmX;
+             sal_Int32       nMmY;
++            /* multipart object data */
++            bool            mbMultipart;
++            UINT16          mMFlags;
++            SvMemoryStream  mMStream;
+         };
+ 
+ 
+diff --git cppcanvas/source/mtfrenderer/emfplus.cxx cppcanvas/source/mtfrenderer/emfplus.cxx
+index 657e867..9088e93 100644
+--- cppcanvas/source/mtfrenderer/emfplus.cxx
++++ cppcanvas/source/mtfrenderer/emfplus.cxx
+@@ -636,6 +636,8 @@ namespace cppcanvas
+             {
+                 sal_uInt32 header, unknown;
+ 
++                EMFP_DEBUG (dumpWords(s, 16));
++
+                 s >> header >> type;
+ 
+                 EMFP_DEBUG (printf ("EMF+\timage\nEMF+\theader: 0x%08x type: 0x%08x\n", header, type));
+@@ -947,6 +949,72 @@ namespace cppcanvas
+             }
+         }
+ 
++        void ImplRenderer::processObjectRecord(SvMemoryStream& rObjectStream, UINT16 flags)
++        {
++            UINT32 objectLen;
++            sal_uInt32 index;
++
++            EMFP_DEBUG (printf ("EMF+ Object slot: %hd flags: %hx\n", flags & 0xff, flags & 0xff00));
++
++            index = flags & 0xff;
++            if (aObjects [index] != NULL) {
++                delete aObjects [index];
++                aObjects [index] = NULL;
++            }
++
++            switch (flags & 0x7f00) {
++            case EmfPlusObjectTypeBrush:
++                {
++                    EMFPBrush *brush;
++                    aObjects [index] = brush = new EMFPBrush ();
++                    brush->Read (rObjectStream, *this);
++
++                    break;
++                }
++            case EmfPlusObjectTypePen:
++                {
++                    EMFPPen *pen;
++                    aObjects [index] = pen = new EMFPPen ();
++                    pen->Read (rObjectStream, *this, nHDPI, nVDPI);
++
++                    break;
++                }
++            case EmfPlusObjectTypePath:
++                sal_uInt32 header, pathFlags;
++                sal_Int32 points;
++
++                rObjectStream >> header >> points >> pathFlags;
++
++                EMFP_DEBUG (printf ("EMF+\tpath\n"));
++                EMFP_DEBUG (printf ("EMF+\theader: 0x%08x points: %d additional flags: 0x%08x\n", header, points, pathFlags));
++
++                EMFPPath *path;
++                aObjects [index] = path = new EMFPPath (points);
++                path->Read (rObjectStream, pathFlags, *this);
++                    
++                break;
++            case EmfPlusObjectTypeRegion: {
++                EMFPRegion *region;
++
++                aObjects [index] = region = new EMFPRegion ();
++                region->Read (rObjectStream);
++                            
++                break;
++            }
++            case EmfPlusObjectTypeImage:
++                {
++                    EMFPImage *image;
++                    aObjects [index] = image = new EMFPImage ();
++                    image->Read (rObjectStream);
++
++                    break;
++                }
++            default:
++                EMFP_DEBUG (printf ("EMF+\tObject unhandled flags: 0x%04x\n", flags & 0xff00));
++                break;
++            }
++        }
++
+         void ImplRenderer::processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms,
+                                            OutDevState& rState, const CanvasSharedPtr& rCanvas )
+         {
+@@ -966,6 +1034,26 @@ namespace cppcanvas
+ 
+                 EMFP_DEBUG (printf ("EMF+ record size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize));
+ 
++                if (type == EmfPlusRecordTypeObject && (mbMultipart && flags & 0x7fff == mMFlags & 0x7fff || flags & 0x8000)) {
++                    if (!mbMultipart) {
++                        mbMultipart = true;
++                        mMFlags = flags;
++                        mMStream.Seek(0);
++                    }
++                    EMFP_DEBUG (dumpWords(rMF, 16));
++                    // 1st 4 bytes are unknown
++                    mMStream.Write (((const char *)rMF.GetData()) + rMF.Tell() + 4, dataSize - 4);
++                    EMFP_DEBUG (printf ("EMF+ read next object part size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize));
++                } else {
++                    if (mbMultipart) {
++                        EMFP_DEBUG (printf ("EMF+ multipart record flags: %04hx\n", mMFlags));
++                        mMStream.Seek (0);
++                        processObjectRecord (mMStream, mMFlags);
++                    }
++                    mbMultipart = false;
++                }
++
++                if (type != EmfPlusRecordTypeObject || !(flags & 0x8000))
+                 switch (type) {
+                 case EmfPlusRecordTypeHeader:
+                     UINT32 header, version;
+@@ -984,73 +1072,8 @@ namespace cppcanvas
+                     EMFP_DEBUG (printf ("EMF+\talready used in svtools wmf/emf filter parser\n"));
+                     break;
+                 case EmfPlusRecordTypeObject:
+-                    {
+-                        UINT32 objectLen;
+-                        sal_uInt32 index;
+-
+-                        EMFP_DEBUG (printf ("EMF+ Object slot: %hd flags: %hx\n", flags & 0xff, flags & 0xff00));
+-
+-                        index = flags & 0xff;
+-                        if (aObjects [index] != NULL) {
+-                            delete aObjects [index];
+-                            aObjects [index] = NULL;
+-                        }
+-
+-                        // not sure yet, what 0x8000 means
+-                        switch (flags & 0x7f00) {
+-                        case EmfPlusObjectTypeBrush:
+-                            {
+-                                EMFPBrush *brush;
+-                                aObjects [index] = brush = new EMFPBrush ();
+-                                brush->Read (rMF, *this);
+-
+-                                break;
+-                            }
+-                        case EmfPlusObjectTypePen:
+-                            {
+-                                EMFPPen *pen;
+-                                aObjects [index] = pen = new EMFPPen ();
+-                                pen->Read (rMF, *this, nHDPI, nVDPI);
+-
+-                                break;
+-                            }
+-                        case EmfPlusObjectTypePath:
+-                            sal_uInt32 header, pathFlags;
+-                            sal_Int32 points;
+-
+-                            rMF >> header >> points >> pathFlags;
+-
+-                            EMFP_DEBUG (printf ("EMF+\tpath\n"));
+-                            EMFP_DEBUG (printf ("EMF+\theader: 0x%08x points: %d additional flags: 0x%08x\n", header, points, pathFlags));
+-
+-                            EMFPPath *path;
+-                            aObjects [index] = path = new EMFPPath (points);
+-                            path->Read (rMF, pathFlags, *this);
+-                    
+-                            break;
+-                        case EmfPlusObjectTypeRegion: {
+-                            EMFPRegion *region;
+-
+-                            aObjects [index] = region = new EMFPRegion ();
+-                            region->Read (rMF);
+-                            
+-                            break;
+-                        }
+-                        case EmfPlusObjectTypeImage:
+-                            {
+-                                EMFPImage *image;
+-                                aObjects [index] = image = new EMFPImage ();
+-                                image->Read (rMF);
+-
+-                                break;
+-                            }
+-                        default:
+-                            EMFP_DEBUG (printf ("EMF+\tObject unhandled flags: 0x%04x\n", flags & 0xff00));
+-                            break;
+-                        }
+-
+-                        break;
+-                    }
++                    processObjectRecord (rMF, flags);
++                    break;
+                 case EmfPlusRecordTypeFillPath:
+                     {
+                         sal_uInt32 index = flags & 0xff;
+diff --git cppcanvas/source/mtfrenderer/implrenderer.cxx cppcanvas/source/mtfrenderer/implrenderer.cxx
+index 7189004..2d03b8a 100644
+--- cppcanvas/source/mtfrenderer/implrenderer.cxx
++++ cppcanvas/source/mtfrenderer/implrenderer.cxx
+@@ -3034,6 +3034,7 @@ namespace cppcanvas
+ 
+             /* EMF+ */
+             memset (aObjects, 0, sizeof (aObjects));
++            mbMultipart = false;
+ 
+             createActions( const_cast<GDIMetaFile&>(rMtf), // HACK(Q2):
+ 								                           // we're

Modified: branches/ooo-build-2-4/patches/src680/apply
==============================================================================
--- branches/ooo-build-2-4/patches/src680/apply	(original)
+++ branches/ooo-build-2-4/patches/src680/apply	Wed May 28 14:51:39 2008
@@ -2187,6 +2187,7 @@
 emf+-crash-fix.diff, n#361534, rodo
 vcl-grey-alpha-unix-sal-bitmap.diff, rodo
 cairocanvas-alpha-pixmap-rewrite.diff, rodo
+emf+-multipart-objects.diff, rodo
 
 [ TransparentPrinting ]
 # adds fixes for printing transparent content



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]