Kaydet (Commit) 0d4f072d authored tarafından Matteo Casalin's avatar Matteo Casalin

Constify

Change-Id: I8d215b0cea56cda55d8e991da1649fca765d149b
üst 53387dab
...@@ -92,14 +92,14 @@ void SwLabPreview::Paint(const Rectangle &) ...@@ -92,14 +92,14 @@ void SwLabPreview::Paint(const Rectangle &)
{ {
const Size aSz(GetOutputSizePixel()); const Size aSz(GetOutputSizePixel());
long lOutWPix = aSz.Width (); const long lOutWPix = aSz.Width ();
long lOutHPix = aSz.Height(); const long lOutHPix = aSz.Height();
// Scale factor // Scale factor
float fxpix = (float)(lOutWPix - (2 * (lLeftWidth + 15))) / (float)lOutWPix; const float fxpix = (float)(lOutWPix - (2 * (lLeftWidth + 15))) / (float)lOutWPix;
long lOutWPix23 = (long)((float)lOutWPix * fxpix); const long lOutWPix23 = (long)((float)lOutWPix * fxpix);
long lOutHPix23 = (long)((float)lOutHPix * fxpix); const long lOutHPix23 = (long)((float)lOutHPix * fxpix);
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
const Color& rWinColor = rStyleSettings.GetWindowColor(); const Color& rWinColor = rStyleSettings.GetWindowColor();
...@@ -119,34 +119,28 @@ void SwLabPreview::Paint(const Rectangle &) ...@@ -119,34 +119,28 @@ void SwLabPreview::Paint(const Rectangle &)
SetFont(aPaintFont); SetFont(aPaintFont);
// size of region to be displayed // size of region to be displayed
long lDispW = aItem.lLeft + aItem.lHDist; const long lDispW = aItem.lLeft + aItem.lHDist
long lDispH = aItem.lUpper + aItem.lVDist; + ((aItem.nCols == 1) ? aItem.lLeft : ROUND(aItem.lHDist/10.0));
if (aItem.nCols == 1) const long lDispH = aItem.lUpper + aItem.lVDist
lDispW += aItem.lLeft ; + ((aItem.nRows == 1) ? aItem.lUpper : ROUND(aItem.lVDist/10.0));
else
lDispW += ROUND(aItem.lHDist / 10.0);
if (aItem.nRows == 1)
lDispH += aItem.lUpper;
else
lDispH += ROUND(aItem.lVDist / 10.0);
// Scale factor // Scale factor
float fx = (float) lOutWPix23 / std::max(1L, lDispW), const float fx = (float) lOutWPix23 / std::max(1L, lDispW);
fy = (float) lOutHPix23 / std::max(1L, lDispH), const float fy = (float) lOutHPix23 / std::max(1L, lDispH);
f = fx < fy ? fx : fy; const float f = fx < fy ? fx : fy;
// zero point // zero point
long lOutlineW = ROUND(f * lDispW); const long lOutlineW = ROUND(f * lDispW);
long lOutlineH = ROUND(f * lDispH); const long lOutlineH = ROUND(f * lDispH);
long lX0 = (lOutWPix - lOutlineW) / 2; const long lX0 = (lOutWPix - lOutlineW) / 2;
long lY0 = (lOutHPix - lOutlineH) / 2; const long lY0 = (lOutHPix - lOutlineH) / 2;
long lX1 = lX0 + ROUND(f * aItem.lLeft ); const long lX1 = lX0 + ROUND(f * aItem.lLeft );
long lY1 = lY0 + ROUND(f * aItem.lUpper); const long lY1 = lY0 + ROUND(f * aItem.lUpper);
long lX2 = lX0 + ROUND(f * (aItem.lLeft + aItem.lWidth )); const long lX2 = lX0 + ROUND(f * (aItem.lLeft + aItem.lWidth ));
long lY2 = lY0 + ROUND(f * (aItem.lUpper + aItem.lHeight)); const long lY2 = lY0 + ROUND(f * (aItem.lUpper + aItem.lHeight));
long lX3 = lX0 + ROUND(f * (aItem.lLeft + aItem.lHDist )); const long lX3 = lX0 + ROUND(f * (aItem.lLeft + aItem.lHDist ));
long lY3 = lY0 + ROUND(f * (aItem.lUpper + aItem.lVDist )); const long lY3 = lY0 + ROUND(f * (aItem.lUpper + aItem.lVDist ));
// draw outline (area) // draw outline (area)
DrawRect(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH))); DrawRect(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH)));
......
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