# HG changeset patch # User Chris Cannam # Date 1391103198 0 # Node ID 15b5c679b90924f4bdfc0afac2c97355d841bfbe # Parent 5f9c0147d1d6302edac372e4d5747ae615d57638 Fix for treating zeros as gaps diff -r 5f9c0147d1d6 -r 15b5c679b909 layer/TimeValueLayer.cpp --- 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;