Mercurial > hg > svgui
changeset 721:15b5c679b909 tonioni
Fix for treating zeros as gaps
author | Chris Cannam |
---|---|
date | Thu, 30 Jan 2014 17:33:18 +0000 |
parents | 5f9c0147d1d6 |
children | dd64efa0dac8 |
files | layer/TimeValueLayer.cpp |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp Tue Jan 28 18:33:44 2014 +0000 +++ b/layer/TimeValueLayer.cpp Thu Jan 30 17:33:18 2014 +0000 @@ -972,7 +972,7 @@ i != points.end(); ++i) { if (m_derivative && i == points.begin()) continue; - + const SparseTimeValueModel::Point &p(*i); float value = p.value; @@ -987,6 +987,10 @@ bool gap = false; if (m_plotStyle == PlotDiscreteCurves) { + if (value == 0.0) { + // Treat zeros as gaps + continue; + } gap = (p.frame > prevFrame && (p.frame - prevFrame >= m_model->getResolution() * 2)); } @@ -1000,6 +1004,7 @@ } bool haveNext = false; + float nvalue = 0.f; int nf = v->getModelsEndFrame(); int nx = v->getXForFrame(nf); int ny = y; @@ -1009,7 +1014,7 @@ if (j != points.end()) { const SparseTimeValueModel::Point &q(*j); - float nvalue = q.value; + nvalue = q.value; if (m_derivative) nvalue -= p.value; nf = q.frame; nx = v->getXForFrame(nf); @@ -1116,7 +1121,9 @@ float y1 = ny; if (m_plotStyle == PlotDiscreteCurves) { - bool nextGap = nf - p.frame >= m_model->getResolution() * 2; + bool nextGap = + (nvalue == 0.0) || + (nf - p.frame >= m_model->getResolution() * 2); if (nextGap) { x1 = x0; y1 = y0;