From ae4b1d41a3e763240a5e9f60f76cedab55e1e5e2 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 1 Mar 2018 11:03:37 +1100 Subject: Mark variables as const where simple. --- src/Indicator.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Indicator.cxx') diff --git a/src/Indicator.cxx b/src/Indicator.cxx index e8702b17c..3551e7202 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -34,7 +34,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r sacDraw = sacHover; } surface->PenColour(sacDraw.fore); - int ymid = static_cast(rc.bottom + rc.top) / 2; + const int ymid = static_cast(rc.bottom + rc.top) / 2; if (sacDraw.style == INDIC_SQUIGGLE) { int x = static_cast(rc.left+0.5); const int xLast = static_cast(rc.right+0.5); @@ -52,9 +52,9 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r surface->LineTo(x, static_cast(rc.top) + y); } } else if (sacDraw.style == INDIC_SQUIGGLEPIXMAP) { - PRectangle rcSquiggle = PixelGridAlign(rc); + const PRectangle rcSquiggle = PixelGridAlign(rc); - int width = std::min(4000, static_cast(rcSquiggle.Width())); + const int width = std::min(4000, static_cast(rcSquiggle.Width())); RGBAImage image(width, 3, 1.0, 0); enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f }; for (int x = 0; x < width; x++) { @@ -136,7 +136,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r rcBox.top = rcLine.top + 1; rcBox.bottom = rcLine.bottom; // Cap width at 4000 to avoid large allocations when mistakes made - int width = std::min(static_cast(rcBox.Width()), 4000); + const int width = std::min(static_cast(rcBox.Width()), 4000); RGBAImage image(width, static_cast(rcBox.Height()), 1.0, 0); // Draw horizontal lines top and bottom for (int x=0; x(rc.left); while (x < static_cast(rc.right)) { - PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1); + const PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1); surface->FillRectangle(rcDot, sacDraw.fore); x += 2; } } else if (sacDraw.style == INDIC_COMPOSITIONTHICK) { - PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom); + const PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom); surface->FillRectangle(rcComposition, sacDraw.fore); } else if (sacDraw.style == INDIC_COMPOSITIONTHIN) { - PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom-1); + const PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom-1); surface->FillRectangle(rcComposition, sacDraw.fore); } else if (sacDraw.style == INDIC_POINT || sacDraw.style == INDIC_POINTCHARACTER) { if (rcCharacter.Width() >= 0.1) { -- cgit v1.2.3