[Libreoffice-commits] core.git: sw/source

Michaël Lefèvre lefevre00 at yahoo.fr
Tue Nov 18 02:37:56 PST 2014


 sw/source/core/layout/paintfrm.cxx |   76 ++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 37 deletions(-)

New commits:
commit 39fe63b8b998894f4f7c3736188bdde1b4cc6c71
Author: Michaël Lefèvre <lefevre00 at yahoo.fr>
Date:   Sun Nov 16 13:51:18 2014 +0100

    Move scale factors inside the properties container
    
    Change-Id: Ic2417796d1e1cf150124ede660b53d3a01d70aab
    Reviewed-on: https://gerrit.libreoffice.org/12480
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index b70bb6e..4b35217 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -244,8 +244,6 @@ static long nHalfPixelSzW = 0, nHalfPixelSzH = 0;
 static long nMinDistPixelW = 0, nMinDistPixelH = 0;
 
 // Current zoom factor
-static double aScaleX = 1.0;
-static double aScaleY = 1.0;
 const static double aMinDistScale = 0.73;
 const static double aEdgeScale = 0.5;
 
@@ -290,6 +288,36 @@ bool isTableBoundariesEnabled()
 }
 
 /**
+ * Container for static properties
+ */
+struct SwPaintProperties {
+    bool                bSFlyMetafile;
+    SwViewShell        *pSGlobalShell;
+    OutputDevice       *pSFlyMetafileOut;
+    SwFlyFrm           *pSRetoucheFly,
+                       *pSRetoucheFly2,
+                       *pSFlyOnlyDraw;
+    BorderLines        *pBLines;
+    SwLineRects        *pSLines;
+    SwSubsRects        *pSSubsLines;
+    SwSubsRects*        pSSpecSubsLines;
+    SfxProgress        *pSProgress;
+    long                nSPixelSzW,
+                        nSPixelSzH,
+                        nSHalfPixelSzW,
+                        nSHalfPixelSzH,
+                        nSMinDistPixelW,
+                        nSMinDistPixelH;
+    Color               aSGlobalRetoucheColor;
+
+    // Current zoom factor
+    double              aSScaleX = 1;
+    double              aSScaleY = 1;
+};
+
+static SwPaintProperties gProp;
+
+/**
  * Set borders alignment statics
  * Adjustment for 'small' twip-to-pixel relations:
  * For 'small' twip-to-pixel relations (less then 2:1)
@@ -344,37 +372,11 @@ void SwCalcPixStatics( OutputDevice *pOut )
     nMinDistPixelH = nPixelSzH * 2 + 1;
 
     const MapMode &rMap = pOut->GetMapMode();
-    aScaleX = rMap.GetScaleX();
-    aScaleY = rMap.GetScaleY();
+    gProp.aSScaleX = rMap.GetScaleX();
+    gProp.aSScaleY = rMap.GetScaleY();
 }
 
 /**
- *
- */
-struct SwPaintProperties {
-    bool                bSFlyMetafile;
-    SwViewShell        *pSGlobalShell;
-    OutputDevice       *pSFlyMetafileOut;
-    SwFlyFrm           *pSRetoucheFly,
-                       *pSRetoucheFly2,
-                       *pSFlyOnlyDraw;
-    BorderLines        *pBLines;
-    SwLineRects        *pSLines;
-    SwSubsRects        *pSSubsLines;
-    SwSubsRects*        pSSpecSubsLines;
-    SfxProgress        *pSProgress;
-    long                nSPixelSzW,
-                        nSPixelSzH,
-                        nSHalfPixelSzW,
-                        nSHalfPixelSzH,
-                        nSMinDistPixelW,
-                        nSMinDistPixelH;
-    Color               aSGlobalRetoucheColor;
-    double              aSScaleX,
-                        aSScaleY;
-};
-
-/**
  * To be able to save the statics so the paint is more or lees reentrant
  */
 class SwSavePaintStatics : public SwPaintProperties
@@ -405,8 +407,8 @@ SwSavePaintStatics::SwSavePaintStatics()
     nSMinDistPixelW = nMinDistPixelW;
     nSMinDistPixelH = nMinDistPixelH ;
     aSGlobalRetoucheColor = aGlobalRetoucheColor;
-    aSScaleX = aScaleX;
-    aSScaleY = aScaleY;
+    aSScaleX = gProp.aSScaleX;
+    aSScaleY = gProp.aSScaleY;
 
     // Restoring globales to default
     bFlyMetafile = false;
@@ -416,7 +418,7 @@ SwSavePaintStatics::SwSavePaintStatics()
     nPixelSzW = nPixelSzH =
     nHalfPixelSzW = nHalfPixelSzH =
     nMinDistPixelW = nMinDistPixelH = 0;
-    aScaleX = aScaleY = 1.0;
+    gProp.aSScaleX = gProp.aSScaleY = 1.0;
     g_pBorderLines = 0;
     pLines = 0;
     pSubsLines = 0;
@@ -445,8 +447,8 @@ SwSavePaintStatics::~SwSavePaintStatics()
     nMinDistPixelW     = nSMinDistPixelW;
     nMinDistPixelH     = nSMinDistPixelH;
     aGlobalRetoucheColor = aSGlobalRetoucheColor;
-    aScaleX            = aSScaleX;
-    aScaleY            = aSScaleY;
+    gProp.aSScaleX = aSScaleX;
+    gProp.aSScaleY = aSScaleY;
 }
 
 /**
@@ -677,7 +679,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
     if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
     {
         // I'm not doing anything for a too small zoom
-        if ( aScaleX < aEdgeScale || aScaleY < aEdgeScale )
+        if ( gProp.aSScaleX < aEdgeScale || gProp.aSScaleY < aEdgeScale )
             return;
     }
 
@@ -1392,7 +1394,7 @@ static long lcl_AlignHeight( const long nHeight )
 
 static long lcl_MinHeightDist( const long nDist )
 {
-    if ( aScaleX < aMinDistScale || aScaleY < aMinDistScale )
+    if ( gProp.aSScaleX < aMinDistScale || gProp.aSScaleY < aMinDistScale )
         return nDist;
     return ::lcl_AlignHeight( std::max( nDist, nMinDistPixelH ));
 }


More information about the Libreoffice-commits mailing list