Kaydet (Commit) 39fe63b8 authored tarafından Michaël Lefèvre's avatar Michaël Lefèvre Kaydeden (comit) Caolán McNamara

Move scale factors inside the properties container

Change-Id: Ic2417796d1e1cf150124ede660b53d3a01d70aab
Reviewed-on: https://gerrit.libreoffice.org/12480Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst cf269216
...@@ -244,8 +244,6 @@ static long nHalfPixelSzW = 0, nHalfPixelSzH = 0; ...@@ -244,8 +244,6 @@ static long nHalfPixelSzW = 0, nHalfPixelSzH = 0;
static long nMinDistPixelW = 0, nMinDistPixelH = 0; static long nMinDistPixelW = 0, nMinDistPixelH = 0;
// Current zoom factor // Current zoom factor
static double aScaleX = 1.0;
static double aScaleY = 1.0;
const static double aMinDistScale = 0.73; const static double aMinDistScale = 0.73;
const static double aEdgeScale = 0.5; const static double aEdgeScale = 0.5;
...@@ -289,6 +287,36 @@ bool isTableBoundariesEnabled() ...@@ -289,6 +287,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 * Set borders alignment statics
* Adjustment for 'small' twip-to-pixel relations: * Adjustment for 'small' twip-to-pixel relations:
...@@ -344,36 +372,10 @@ void SwCalcPixStatics( OutputDevice *pOut ) ...@@ -344,36 +372,10 @@ void SwCalcPixStatics( OutputDevice *pOut )
nMinDistPixelH = nPixelSzH * 2 + 1; nMinDistPixelH = nPixelSzH * 2 + 1;
const MapMode &rMap = pOut->GetMapMode(); const MapMode &rMap = pOut->GetMapMode();
aScaleX = rMap.GetScaleX(); gProp.aSScaleX = rMap.GetScaleX();
aScaleY = rMap.GetScaleY(); 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 * To be able to save the statics so the paint is more or lees reentrant
*/ */
...@@ -405,8 +407,8 @@ SwSavePaintStatics::SwSavePaintStatics() ...@@ -405,8 +407,8 @@ SwSavePaintStatics::SwSavePaintStatics()
nSMinDistPixelW = nMinDistPixelW; nSMinDistPixelW = nMinDistPixelW;
nSMinDistPixelH = nMinDistPixelH ; nSMinDistPixelH = nMinDistPixelH ;
aSGlobalRetoucheColor = aGlobalRetoucheColor; aSGlobalRetoucheColor = aGlobalRetoucheColor;
aSScaleX = aScaleX; aSScaleX = gProp.aSScaleX;
aSScaleY = aScaleY; aSScaleY = gProp.aSScaleY;
// Restoring globales to default // Restoring globales to default
bFlyMetafile = false; bFlyMetafile = false;
...@@ -416,7 +418,7 @@ SwSavePaintStatics::SwSavePaintStatics() ...@@ -416,7 +418,7 @@ SwSavePaintStatics::SwSavePaintStatics()
nPixelSzW = nPixelSzH = nPixelSzW = nPixelSzH =
nHalfPixelSzW = nHalfPixelSzH = nHalfPixelSzW = nHalfPixelSzH =
nMinDistPixelW = nMinDistPixelH = 0; nMinDistPixelW = nMinDistPixelH = 0;
aScaleX = aScaleY = 1.0; gProp.aSScaleX = gProp.aSScaleY = 1.0;
g_pBorderLines = 0; g_pBorderLines = 0;
pLines = 0; pLines = 0;
pSubsLines = 0; pSubsLines = 0;
...@@ -445,8 +447,8 @@ SwSavePaintStatics::~SwSavePaintStatics() ...@@ -445,8 +447,8 @@ SwSavePaintStatics::~SwSavePaintStatics()
nMinDistPixelW = nSMinDistPixelW; nMinDistPixelW = nSMinDistPixelW;
nMinDistPixelH = nSMinDistPixelH; nMinDistPixelH = nSMinDistPixelH;
aGlobalRetoucheColor = aSGlobalRetoucheColor; aGlobalRetoucheColor = aSGlobalRetoucheColor;
aScaleX = aSScaleX; gProp.aSScaleX = aSScaleX;
aScaleY = aSScaleY; gProp.aSScaleY = aSScaleY;
} }
/** /**
...@@ -677,7 +679,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut ) ...@@ -677,7 +679,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
if ( pOut->GetOutDevType() != OUTDEV_PRINTER ) if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
{ {
// I'm not doing anything for a too small zoom // I'm not doing anything for a too small zoom
if ( aScaleX < aEdgeScale || aScaleY < aEdgeScale ) if ( gProp.aSScaleX < aEdgeScale || gProp.aSScaleY < aEdgeScale )
return; return;
} }
...@@ -1392,7 +1394,7 @@ static long lcl_AlignHeight( const long nHeight ) ...@@ -1392,7 +1394,7 @@ static long lcl_AlignHeight( const long nHeight )
static long lcl_MinHeightDist( const long nDist ) static long lcl_MinHeightDist( const long nDist )
{ {
if ( aScaleX < aMinDistScale || aScaleY < aMinDistScale ) if ( gProp.aSScaleX < aMinDistScale || gProp.aSScaleY < aMinDistScale )
return nDist; return nDist;
return ::lcl_AlignHeight( std::max( nDist, nMinDistPixelH )); return ::lcl_AlignHeight( std::max( nDist, nMinDistPixelH ));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment