diff options
author | Neil <nyamatongwe@gmail.com> | 2018-05-22 11:52:51 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-05-22 11:52:51 +1000 |
commit | d08e0385d664dd33aeee88794fd065e3696cb435 (patch) | |
tree | 72c9b3156578b0ef6b9db7089169a6f0a2b29b26 /src | |
parent | fba451a1d76be9b6945c9d5d7e219f7d7d1a4260 (diff) | |
download | scintilla-mirror-d08e0385d664dd33aeee88794fd065e3696cb435.tar.gz |
Backport: Add INDIC_GRADIENT and INDIC_GRADIENTCENTRE indicator types.
Backport of changeset 6966:872900d3ceb0.
Diffstat (limited to 'src')
-rw-r--r-- | src/Indicator.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 35b2c3e5b..224083c31 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -138,6 +138,27 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r rcBox.right = rc.right; surface->AlphaRectangle(rcBox, (sacDraw.style == INDIC_ROUNDBOX) ? 1 : 0, sacDraw.fore, fillAlpha, sacDraw.fore, outlineAlpha, 0); + } else if (sacDraw.style == INDIC_GRADIENT || + sacDraw.style == INDIC_GRADIENTCENTRE) { + PRectangle rcBox = rc; + rcBox.top = rcLine.top + 1; + rcBox.bottom = rcLine.bottom; + const Surface::GradientOptions options = Surface::GradientOptions::topToBottom; + const ColourAlpha start(sacNormal.fore, fillAlpha); + const ColourAlpha end(sacNormal.fore, 0); + std::vector<ColourStop> stops; + switch (sacDraw.style) { + case INDIC_GRADIENT: + stops.push_back(ColourStop(0.0, start)); + stops.push_back(ColourStop(1.0, end)); + break; + case INDIC_GRADIENTCENTRE: + stops.push_back(ColourStop(0.0, end)); + stops.push_back(ColourStop(0.5, start)); + stops.push_back(ColourStop(1.0, end)); + break; + } + surface->GradientRectangle(rcBox, stops, options); } else if (sacDraw.style == INDIC_DOTBOX) { PRectangle rcBox = PixelGridAlign(rc); rcBox.top = rcLine.top + 1; |