From 2d7a4fbf7c5d164ae3088ee81683e2697f7243ec Mon Sep 17 00:00:00 2001 From: EvilDragon Date: Thu, 11 Feb 2021 08:12:03 +0100 Subject: [PATCH] Remove a value check in CLFOGui that messed the display up in some cases (#3867) Closes #2258 --- src/common/gui/CLFOGui.cpp | 47 ++++++++++++++------------------------ src/common/gui/CLFOGui.h | 11 +++++++++ 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/common/gui/CLFOGui.cpp b/src/common/gui/CLFOGui.cpp index a84c81bc0e0..db0f09d17c4 100644 --- a/src/common/gui/CLFOGui.cpp +++ b/src/common/gui/CLFOGui.cpp @@ -253,38 +253,36 @@ void CLFOGui::draw(CDrawContext *dc) // added, remove it from this condition! edpath->beginSubpath(xc, edval); if (tFullWave) + { deactPath->beginSubpath(xc, wval); + } priorval = val; } else { - if (maxval - minval > 0.2) - { - minval = ((-minval + 1.0f) * 0.5 * 0.8 + 0.1) * valScale; - maxval = ((-maxval + 1.0f) * 0.5 * 0.8 + 0.1) * valScale; - // Windows is sensitive to out-of-order line draws in a way which causes spikes. - // Make sure we draw one closest to prior first. See #1438 - float firstval = minval; - float secondval = maxval; - if (priorval - minval < maxval - priorval) - { - firstval = maxval; - secondval = minval; - } - path->addLine(xc - 0.1 * valScale / totalSamples, firstval); - path->addLine(xc + 0.1 * valScale / totalSamples, secondval); - } - else + minval = ((-minval + 1.0f) * 0.5 * 0.8 + 0.1) * valScale; + maxval = ((-maxval + 1.0f) * 0.5 * 0.8 + 0.1) * valScale; + // Windows is sensitive to out-of-order line draws in a way which causes spikes. + // Make sure we draw one closest to prior first. See #1438 + float firstval = minval; + float secondval = maxval; + if (priorval - minval < maxval - priorval) { - path->addLine(xc, val); + firstval = maxval; + secondval = minval; } + path->addLine(xc - 0.1 * valScale / totalSamples, firstval); + path->addLine(xc + 0.1 * valScale / totalSamples, secondval); + priorval = val; eupath->addLine(xc, euval); edpath->addLine(xc, edval); - // We can skip the ordering thing since we know we ahve set rate here to a low rate + // We can skip the ordering thing since we know we have set rate here to a low rate if (tFullWave) + { deactPath->addLine(xc, wval); + } } } delete tlfo; @@ -637,17 +635,6 @@ void CLFOGui::draw(CDrawContext *dc) setDirty(false); } -enum -{ - cs_null = 0, - cs_shape, - cs_steps, - cs_trigtray_toggle, - cs_loopstart, - cs_loopend, - cs_linedrag, -}; - void CLFOGui::drawStepSeq(VSTGUI::CDrawContext *dc, VSTGUI::CRect &maindisp, VSTGUI::CRect &leftpanel) { diff --git a/src/common/gui/CLFOGui.h b/src/common/gui/CLFOGui.h index e22b29343e4..890d0cc47b1 100644 --- a/src/common/gui/CLFOGui.h +++ b/src/common/gui/CLFOGui.h @@ -30,6 +30,17 @@ class CLFOGui : public VSTGUI::CControl, public Surge::UI::SkinConsumingComponent, public Surge::UI::CursorControlAdapter { + enum control_states + { + cs_null = 0, + cs_shape, + cs_steps, + cs_trigtray_toggle, + cs_loopstart, + cs_loopend, + cs_linedrag, + }; + public: const static int margin = 2; const static int margin2 = 7;