comparison layer/Colour3DPlotLayer.cpp @ 1047:86a8145a1897

Fix incorrect handling of model start frame
author Chris Cannam
date Fri, 04 Mar 2016 12:23:07 +0000
parents 19bb1744518e
children e8102ff5573b
comparison
equal deleted inserted replaced
1046:19bb1744518e 1047:86a8145a1897
1307 int h = v->height(); 1307 int h = v->height();
1308 1308
1309 double srRatio = 1309 double srRatio =
1310 v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate(); 1310 v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate();
1311 1311
1312 // the s-prefix values are source, i.e. model, column and bin numbers
1312 int sx0 = int((double(v->getFrameForX(x0)) / srRatio - double(modelStart)) 1313 int sx0 = int((double(v->getFrameForX(x0)) / srRatio - double(modelStart))
1313 / modelResolution); 1314 / modelResolution);
1314 int sx1 = int((double(v->getFrameForX(x1)) / srRatio - double(modelStart)) 1315 int sx1 = int((double(v->getFrameForX(x1)) / srRatio - double(modelStart))
1315 / modelResolution); 1316 / modelResolution);
1316 int sh = m_model->getHeight(); 1317 int sh = m_model->getHeight();
1351 const int buflen = 40; 1352 const int buflen = 40;
1352 char labelbuf[buflen]; 1353 char labelbuf[buflen];
1353 1354
1354 for (int sx = sx0; sx <= sx1; ++sx) { 1355 for (int sx = sx0; sx <= sx1; ++sx) {
1355 1356
1356 sv_frame_t fx = sx * modelResolution; 1357 sv_frame_t fx = sx * modelResolution + modelStart;
1357 1358
1358 if (fx + modelResolution <= modelStart || fx > modelEnd) continue; 1359 if (fx + modelResolution <= modelStart || fx > modelEnd) continue;
1359 1360
1360 int rx0 = v->getXForFrame(int(double(fx + modelStart) * srRatio)); 1361 int rx0 = v->getXForFrame(int(double(fx) * srRatio));
1361 int rx1 = v->getXForFrame(int(double(fx + modelStart + modelResolution + 1) * srRatio)); 1362 int rx1 = v->getXForFrame(int(double(fx + modelResolution + 1) * srRatio));
1362 1363
1363 int rw = rx1 - rx0; 1364 int rw = rx1 - rx0;
1364 if (rw < 1) rw = 1; 1365 if (rw < 1) rw = 1;
1365 1366
1366 bool showLabel = (rw > 10 && 1367 bool showLabel = (rw > 10 &&