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

Fridrich Å trba fridrich.strba at bluewin.ch
Tue Jun 11 02:41:44 PDT 2013


 cppcanvas/source/mtfrenderer/emfplus.cxx |   48 +++++++------------------------
 1 file changed, 12 insertions(+), 36 deletions(-)

New commits:
commit 721f82c9bff871cd11c6a7c41ae080375463a690
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Tue Jun 11 11:41:09 2013 +0200

    Use a local variable for the points
    
    Change-Id: Ibd274ecd7eaeadaaef9f2a17a0d721355a561431

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 7817a79..47fa726 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1618,11 +1618,13 @@ namespace cppcanvas
                                 double cellSize = setFont (flags & 0xff, rFactoryParms, rState);
                                 rState.textColor = COLOR( brushId );
 
+                                ::basegfx::B2DPoint point( Map( lx + 0.15*cellSize, ly + cellSize ) );
+
                                 ActionSharedPtr pTextAction(
                                     TextActionFactory::createTextAction(
                                                                         // position is just rough guess for now
                                                                         // we should calculate it exactly from layoutRect or font
-                                        ::vcl::unotools::pointFromB2DPoint ( Map( lx + 0.15*cellSize, ly + cellSize ) ),
+                                        ::vcl::unotools::pointFromB2DPoint ( point ),
                                         ::Size(),
                                         ::Color(),
                                         ::Size(),
@@ -1863,9 +1865,11 @@ namespace cppcanvas
                             if( flags & 0x8000 )
                                 rState.textColor = COLOR( brushIndexOrColor );
 
+                            ::basegfx::B2DPoint point( Map( charsPosX[0], charsPosY[0] ) );
+
                             ActionSharedPtr pTextAction(
                                     TextActionFactory::createTextAction(
-                                        ::vcl::unotools::pointFromB2DPoint ( Map( charsPosX[0], charsPosY[0] ) ),
+                                        ::vcl::unotools::pointFromB2DPoint ( point ),
                                         ::Size(),
                                         ::Color(),
                                         ::Size(),
commit eb0a738d1b3f1a9df41d55a1defd349264486920
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Tue Jun 11 11:21:56 2013 +0200

    Refactor a bit the code while reading it
    
    Change-Id: I58693bb4ffe0f59365069a87fc30081ddf226eaa

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 7b74047..7817a79 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1474,50 +1474,22 @@ namespace cppcanvas
                             EMFPPath path (points, true);
                             path.Read (rMF, flags, *this);
 
-
                             EMFPPlusFillPolygon (path.GetPolygon (*this), rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor);
 
                             break;
                         }
                     case EmfPlusRecordTypeDrawLines:
                         {
-                            sal_uInt32 index = flags & 0xff;
                             sal_uInt32 points;
 
                             rMF >> points;
 
-                            SAL_INFO("cppcanvas.emf", "EMF+ DrawLines in slot: " << index << " points: " << points);
+                            SAL_INFO("cppcanvas.emf", "EMF+ DrawLines in slot: " << (flags && 0xff) << " points: " << points);
 
                             EMFPPath path (points, true);
                             path.Read (rMF, flags, *this);
 
-                            EMFPPen* pen = (EMFPPen*) aObjects [index];
-
-                            rState.isFillColorSet = false;
-                            rState.isLineColorSet = true;
-                            rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (),
-                                                                                       rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace() );
-                            ::basegfx::B2DPolyPolygon& polygon (path.GetPolygon (*this));
-
-                            polygon.transform( rState.mapModeTransform );
-
-                            rendering::StrokeAttributes aStrokeAttributes;
-
-                            pen->SetStrokeAttributes (aStrokeAttributes, *this, rState);
-
-                            ActionSharedPtr pPolyAction(
-                                internal::PolyPolyActionFactory::createPolyPolyAction(
-                                    polygon, rFactoryParms.mrCanvas, rState, aStrokeAttributes ) );
-
-                            if( pPolyAction )
-                            {
-                                maActions.push_back(
-                                    MtfAction(
-                                        pPolyAction,
-                                        rFactoryParms.mrCurrActionIndex ) );
-
-                                rFactoryParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
-                            }
+                            EMFPPlusDrawPolygon (path.GetPolygon (*this), rFactoryParms, rState, rCanvas, flags);
 
                             break;
                         }
commit 2933de9ce0f820e59ac4eef796fdde2566e38d42
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Tue Jun 11 10:38:52 2013 +0200

    Fix typo and make the debug output a bit more readable
    
    Change-Id: I45cb5303bfcc1f3df8455ac454f3e1b3fc5a11e0

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 111c1e2..7b74047 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -836,7 +836,7 @@ namespace cppcanvas
 
         void ImplRenderer::MapToDevice (double& x, double& y)
         {
-            // TODO: other untis
+            // TODO: other units
             x = 100*nMmX*x/nPixX;
             y = 100*nMmY*y/nPixY;
         }
@@ -1764,9 +1764,9 @@ namespace cppcanvas
                         rMF >> transform;
                         aWorldTransform.Set (transform);
                         SAL_INFO("cppcanvas.emf",
-                                "EMF+\tm11: " << aWorldTransform.eM11 << "m12: " << aWorldTransform.eM12 <<
-                                "EMF+\tm21: " << aWorldTransform.eM21 << "m22: " << aWorldTransform.eM22 <<
-                                "EMF+\tdx: "  << aWorldTransform.eDx  << "dy: "  << aWorldTransform.eDy);
+                                "EMF+\tm11: " << aWorldTransform.eM11 << "\tm12: " << aWorldTransform.eM12 <<
+                                "\tm21: " << aWorldTransform.eM21 << "\tm22: " << aWorldTransform.eM22 <<
+                                "\tdx: "  << aWorldTransform.eDx  << "\tdy: "  << aWorldTransform.eDy);
                         break;
                     }
                     case EmfPlusRecordTypeResetWorldTransform:


More information about the Libreoffice-commits mailing list