[PATCH libreoffice-4-0-2] implemented EmfPlusRecordTypeSave and EmfPlusRecordTypeResto...

Fridrich Strba (via Code Review) gerrit at gerrit.libreoffice.org
Tue Mar 19 06:03:18 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2839

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/39/2839/1

implemented EmfPlusRecordTypeSave and EmfPlusRecordTypeRestore records

Signed-off-by: Fridrich Štrba <fridrich.strba at bluewin.ch>
(cherry picked from commit 5a86702e13b3654982f1ee84da981d7fb8c442c5)

Change-Id: Iac87870c0f50a74b7f4db4c674adcded1494c055
---
M cppcanvas/source/inc/implrenderer.hxx
R cppcanvas/source/inc/outdevstate.hxx
M cppcanvas/source/mtfrenderer/emfplus.cxx
3 files changed, 58 insertions(+), 3 deletions(-)



diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index c2902d6..4537368 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -28,8 +28,10 @@
 
 #include <canvasgraphichelper.hxx>
 #include <action.hxx>
+#include <outdevstate.hxx>
 
 #include <vector>
+#include <map>
 
 class GDIMetaFile;
 class VirtualDevice;
@@ -166,6 +168,12 @@
             }
         };
 
+        // EMF+
+        typedef struct {
+            XForm aWorldTransform;
+            OutDevState aDevState;
+        } EmfPlusGraphicState;
+
         class ImplRenderer : public virtual Renderer, protected CanvasGraphicHelper
         {
         public:
@@ -278,7 +286,6 @@
             sal_Int32       nOriginY;
             sal_Int32       nHDPI;
             sal_Int32       nVDPI;
-            ::PolyPolygon   aClippingPolygon;
             /* EMF+ emf header info */
             sal_Int32       nFrameLeft;
             sal_Int32       nFrameTop;
@@ -292,6 +299,9 @@
             bool            mbMultipart;
             sal_uInt16      mMFlags;
             SvMemoryStream  mMStream;
+            /* emf+ graphic state stack */
+            ::std::map<int,EmfPlusGraphicState> mGSStack;
+            typedef ::std::map<int,EmfPlusGraphicState>::iterator EPGSSIter;
         };
 
 
diff --git a/cppcanvas/source/mtfrenderer/outdevstate.hxx b/cppcanvas/source/inc/outdevstate.hxx
similarity index 100%
rename from cppcanvas/source/mtfrenderer/outdevstate.hxx
rename to cppcanvas/source/inc/outdevstate.hxx
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 491b085..81f7eb7 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -68,6 +68,7 @@
 #define EmfPlusRecordTypeSetPixelOffsetMode 16418
 #define EmfPlusRecordTypeSetCompositingQuality 16420
 #define EmfPlusRecordTypeSave 16421
+#define EmfPlusRecordTypeRestore 16422
 #define EmfPlusRecordTypeSetWorldTransform 16426
 #define EmfPlusRecordTypeResetWorldTransform 16427
 #define EmfPlusRecordTypeMultiplyWorldTransform 16428
@@ -1658,9 +1659,53 @@
                     EMFP_DEBUG (printf ("EMF+\tTODO\n"));
                     break;
                 case EmfPlusRecordTypeSave:
-                    EMFP_DEBUG (printf ("EMF+ Save\n"));
-                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
+                    {
+                        sal_uInt32 stackIndex;
+
+                        rMF >> stackIndex;
+
+                        EMFP_DEBUG (printf ("EMF+ Save stack index: %d\n", stackIndex));
+
+                        EPGSSIter aIter = mGSStack.find( stackIndex );
+
+                        if ( aIter != mGSStack.end() )
+                        {
+                            EmfPlusGraphicState aState = aIter->second;
+                            mGSStack.erase( aIter );
+
+                            EMFP_DEBUG (printf ("stack index: %d found and erased\n", stackIndex));
+                        }
+
+                        EmfPlusGraphicState aState;
+
+                        aState.aWorldTransform = aWorldTransform;
+                        aState.aDevState = rState;
+
+                        mGSStack[ stackIndex ] = aState;
+
                     break;
+                    }
+                    case EmfPlusRecordTypeRestore:
+                    {
+                        sal_uInt32 stackIndex;
+
+                        rMF >> stackIndex;
+
+                        EMFP_DEBUG (printf ("EMF+ Restore stack index: %d\n", stackIndex));
+
+                        EPGSSIter aIter = mGSStack.find( stackIndex );
+
+                        if ( aIter != mGSStack.end() ) {
+                            EMFP_DEBUG (printf ("stack index: %d found\n", stackIndex));
+                            EmfPlusGraphicState aState = aIter->second;
+                            aWorldTransform = aState.aWorldTransform;
+                            rState.clip = aState.aDevState.clip;
+                            rState.clipRect = aState.aDevState.clipRect;
+                            rState.xClipPoly = aState.aDevState.xClipPoly;
+                        }
+
+                        break;
+                    }
                 case EmfPlusRecordTypeSetWorldTransform: {
                     EMFP_DEBUG (printf ("EMF+ SetWorldTransform\n"));
                     XForm transform;

-- 
To view, visit https://gerrit.libreoffice.org/2839
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac87870c0f50a74b7f4db4c674adcded1494c055
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0-2
Gerrit-Owner: Fridrich Strba <fridrich at documentfoundation.org>
Gerrit-Reviewer: Radek Doulík <rodo at novell.com>



More information about the LibreOffice mailing list