diff options
author | Neil <nyamatongwe@gmail.com> | 2018-03-01 11:03:37 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-03-01 11:03:37 +1100 |
commit | 1b808ad6a4e623c564513a72cedc17581426942f (patch) | |
tree | f0671c60ec9680f4c4d2e9f7e8c85028b833b0cf /src/Indicator.cxx | |
parent | 13f7cab5a5894313d2245ae56d6f2e7b1f0d7307 (diff) | |
download | scintilla-mirror-1b808ad6a4e623c564513a72cedc17581426942f.tar.gz |
Backport: Mark variables as const where simple.
Backport of changeset 6470:d78a4b522662.
Diffstat (limited to 'src/Indicator.cxx')
-rw-r--r-- | src/Indicator.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
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<int>(rc.bottom + rc.top) / 2; + const int ymid = static_cast<int>(rc.bottom + rc.top) / 2; if (sacDraw.style == INDIC_SQUIGGLE) { int x = static_cast<int>(rc.left+0.5); const int xLast = static_cast<int>(rc.right+0.5); @@ -52,9 +52,9 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r surface->LineTo(x, static_cast<int>(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<int>(rcSquiggle.Width())); + const int width = std::min(4000, static_cast<int>(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<int>(rcBox.Width()), 4000); + const int width = std::min(static_cast<int>(rcBox.Width()), 4000); RGBAImage image(width, static_cast<int>(rcBox.Height()), 1.0, 0); // Draw horizontal lines top and bottom for (int x=0; x<width; x++) { @@ -161,15 +161,15 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r } else if (sacDraw.style == INDIC_DOTS) { int x = static_cast<int>(rc.left); while (x < static_cast<int>(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) { |