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

Fridrich Å trba fridrich.strba at bluewin.ch
Fri Aug 30 05:37:50 PDT 2013


 cppcanvas/source/inc/implrenderer.hxx         |    5 +----
 cppcanvas/source/mtfrenderer/emfplus.cxx      |   15 +++++++++++++++
 cppcanvas/source/mtfrenderer/implrenderer.cxx |    5 +++--
 vcl/source/filter/wmf/winmtf.cxx              |   16 +++++++++-------
 4 files changed, 28 insertions(+), 13 deletions(-)

New commits:
commit 21ee132af1b888f50a9d916337011879570ca357
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Fri Aug 30 14:31:29 2013 +0200

    Revert some random work-in-progress that is most probably bitrotten
    
    Revert "EMF+: aBaseTransform is a hardcoded identity matrix, don't bother with it"
    
    This reverts commit 2b700a710e44d2d09f45793f5f2448268e66d4fe.
    
    Revert "Pass also the bounding box in device units to the EMF+ part"
    
    This reverts commit f387c5da5a824df6cf2874155c13445a86804475.

diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index 63cce82f..79a2967 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -286,6 +286,7 @@ static float GetSwapFloat( SvStream& rSt )
             ActionVector maActions;
 
             /* EMF+ */
+            XForm           aBaseTransform;
             XForm           aWorldTransform;
             EMFPObject*     aObjects [256];
             float           fPageScale;
@@ -294,10 +295,6 @@ static float GetSwapFloat( SvStream& rSt )
             sal_Int32       nHDPI;
             sal_Int32       nVDPI;
             /* EMF+ emf header info */
-            sal_Int32       nBoundsLeft;
-            sal_Int32       nBoundsTop;
-            sal_Int32       nBoundsRight;
-            sal_Int32       nBoundsBottom;
             sal_Int32       nFrameLeft;
             sal_Int32       nFrameTop;
             sal_Int32       nFrameRight;
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 384dd2c..a88ae12 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -865,6 +865,9 @@ namespace cppcanvas
             x -= nFrameLeft;
             y -= nFrameTop;
 
+            x *= aBaseTransform.eM11;
+            y *= aBaseTransform.eM22;
+
             return ::basegfx::B2DPoint (x, y);
         }
 
@@ -877,6 +880,9 @@ namespace cppcanvas
 
             MapToDevice (w, h);
 
+            w *= aBaseTransform.eM11;
+            h *= aBaseTransform.eM22;
+
             return ::basegfx::B2DSize (w, h);
         }
 
@@ -927,6 +933,7 @@ namespace cppcanvas
 
                     ::basegfx::B2DHomMatrix aTextureTransformation;
                     ::basegfx::B2DHomMatrix aWorldTransformation;
+                    ::basegfx::B2DHomMatrix aBaseTransformation;
                     rendering::Texture aTexture;
 
                     aWorldTransformation.set (0, 0, aWorldTransform.eM11);
@@ -936,6 +943,13 @@ namespace cppcanvas
                     aWorldTransformation.set (1, 1, aWorldTransform.eM22);
                     aWorldTransformation.set (1, 2, aWorldTransform.eDy);
 
+                    aBaseTransformation.set (0, 0, aBaseTransform.eM11);
+                    aBaseTransformation.set (0, 1, aBaseTransform.eM21);
+                    aBaseTransformation.set (0, 2, aBaseTransform.eDx);
+                    aBaseTransformation.set (1, 0, aBaseTransform.eM12);
+                    aBaseTransformation.set (1, 1, aBaseTransform.eM22);
+                    aBaseTransformation.set (1, 2, aBaseTransform.eDy);
+
                     if (brush->type == 4) {
                         aTextureTransformation.scale (brush->areaWidth, brush->areaHeight);
                         aTextureTransformation.translate (brush->areaX, brush->areaY);
@@ -962,6 +976,7 @@ namespace cppcanvas
                     aTextureTransformation.scale (100.0*nMmX/nPixX, 100.0*nMmY/nPixY);
                     aTextureTransformation.translate (-nFrameLeft, -nFrameTop);
                     aTextureTransformation *= rState.mapModeTransform;
+                    aTextureTransformation *= aBaseTransformation;
 
                     aTexture.RepeatModeX = rendering::TexturingMode::CLAMP;
                     aTexture.RepeatModeY = rendering::TexturingMode::CLAMP;
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 17c68c4..c9489afd 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1787,12 +1787,13 @@ namespace cppcanvas
 
                             SvMemoryStream rMF ((void*) pAct->GetData (), pAct->GetDataSize (), STREAM_READ);
 
-                            rMF >> nBoundsLeft >> nBoundsTop >> nBoundsRight >> nBoundsBottom;
-                            SAL_INFO ("cppcanvas.emf", "EMF+ picture bounds: " << nBoundsLeft << "," << nBoundsTop << " - " << nBoundsRight << "," << nBoundsBottom);
                             rMF >> nFrameLeft >> nFrameTop >> nFrameRight >> nFrameBottom;
                             SAL_INFO ("cppcanvas.emf", "EMF+ picture frame: " << nFrameLeft << "," << nFrameTop << " - " << nFrameRight << "," << nFrameBottom);
                             rMF >> nPixX >> nPixY >> nMmX >> nMmY;
                             SAL_INFO ("cppcanvas.emf", "EMF+ ref device pixel size: " << nPixX << "x" << nPixY << " mm size: " << nMmX << "x" << nMmY);
+
+                            rMF >> aBaseTransform;
+                            //aWorldTransform.Set (aBaseTransform);
                         }
                     }
                     break;
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index ff7fc2e..0972dcd 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -2233,24 +2233,26 @@ void WinMtfOutput::PassEMFPlusHeaderInfo()
     EMFP_DEBUG(printf ("\t\t\tadd EMF_PLUS header info\n"));
 
     SvMemoryStream mem;
-    sal_Int32 nDevLeft, nDevRight, nDevTop, nDevBottom;
     sal_Int32 nLeft, nRight, nTop, nBottom;
 
-    nDevLeft = mrclBounds.Left();
-    nDevRight = mrclBounds.Right();
-    nDevTop = mrclBounds.Top();
-    nDevBottom = mrclBounds.Bottom();
-
     nLeft = mrclFrame.Left();
     nTop = mrclFrame.Top();
     nRight = mrclFrame.Right();
     nBottom = mrclFrame.Bottom();
 
     // emf header info
-    mem << nDevLeft << nDevTop << nDevRight << nDevBottom;
     mem << nLeft << nTop << nRight << nBottom;
     mem << mnPixX << mnPixY << mnMillX << mnMillY;
 
+    float one, zero;
+
+    one = 1;
+    zero = 0;
+
+    // add transformation matrix to be used in vcl's metaact.cxx for
+    // rotate and scale operations
+    mem << one << zero << zero << one << zero << zero;
+
     // need to flush the stream, otherwise GetEndOfData will return 0
     // on windows where the function parameters are probably resolved in reverse order
     mem.Flush();


More information about the Libreoffice-commits mailing list