# HG changeset patch # User Chris Cannam # Date 1457094187 0 # Node ID 86a8145a1897e9c887593f7e25f88b1adcb42534 # Parent 19bb1744518eb4f4c679c536c4d2ec4b54d1abbf Fix incorrect handling of model start frame diff -r 19bb1744518e -r 86a8145a1897 layer/Colour3DPlotLayer.cpp --- a/layer/Colour3DPlotLayer.cpp Fri Mar 04 12:22:42 2016 +0000 +++ b/layer/Colour3DPlotLayer.cpp Fri Mar 04 12:23:07 2016 +0000 @@ -1309,6 +1309,7 @@ double srRatio = v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate(); + // the s-prefix values are source, i.e. model, column and bin numbers int sx0 = int((double(v->getFrameForX(x0)) / srRatio - double(modelStart)) / modelResolution); int sx1 = int((double(v->getFrameForX(x1)) / srRatio - double(modelStart)) @@ -1353,12 +1354,12 @@ for (int sx = sx0; sx <= sx1; ++sx) { - sv_frame_t fx = sx * modelResolution; + sv_frame_t fx = sx * modelResolution + modelStart; if (fx + modelResolution <= modelStart || fx > modelEnd) continue; - int rx0 = v->getXForFrame(int(double(fx + modelStart) * srRatio)); - int rx1 = v->getXForFrame(int(double(fx + modelStart + modelResolution + 1) * srRatio)); + int rx0 = v->getXForFrame(int(double(fx) * srRatio)); + int rx1 = v->getXForFrame(int(double(fx + modelResolution + 1) * srRatio)); int rw = rx1 - rx0; if (rw < 1) rw = 1;