comparison layer/Colour3DPlotLayer.cpp @ 351:b548a36f7633

* Fix duplication of zero'th column in the minus-one'th column position
author Chris Cannam
date Thu, 24 Jan 2008 14:34:27 +0000
parents 0093f351641c
children de4db9b5dcf1
comparison
equal deleted inserted replaced
350:3a55cd576334 351:b548a36f7633
27 27
28 #include <iostream> 28 #include <iostream>
29 29
30 #include <cassert> 30 #include <cassert>
31 31
32 //#define DEBUG_COLOUR_3D_PLOT_LAYER_PAINT 1 32 #define DEBUG_COLOUR_3D_PLOT_LAYER_PAINT 1
33 33
34 34
35 Colour3DPlotLayer::Colour3DPlotLayer() : 35 Colour3DPlotLayer::Colour3DPlotLayer() :
36 m_model(0), 36 m_model(0),
37 m_cache(0), 37 m_cache(0),
580 580
581 if (sx0 > 0) --sx0; 581 if (sx0 > 0) --sx0;
582 fillCache(sx0 < 0 ? 0 : sx0, 582 fillCache(sx0 < 0 ? 0 : sx0,
583 sx1 < 0 ? 0 : sx1); 583 sx1 < 0 ? 0 : sx1);
584 584
585 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT
586 std::cerr << "Colour3DPlotLayer::paint: height = "<< m_model->getHeight() << ", modelStart = " << modelStart << ", resolution = " << modelResolution << ", model rate = " << m_model->getSampleRate() << std::endl;
587 #endif
588
585 if (int(m_model->getHeight()) >= v->height() || 589 if (int(m_model->getHeight()) >= v->height() ||
586 int(modelResolution * m_model->getSampleRate()) < v->getZoomLevel() / 2) { 590 int(modelResolution * m_model->getSampleRate()) < v->getZoomLevel() / 2) {
587 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT 591 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT
588 std::cerr << "Colour3DPlotLayer::paint: height = "<< m_model->getHeight() << ", resolution = " << modelResolution << ", model rate = " << m_model->getSampleRate() << ", calling paintDense" << std::endl; 592 std::cerr << "calling paintDense" << std::endl;
589 #endif 593 #endif
590 paintDense(v, paint, rect); 594 paintDense(v, paint, rect);
591 return; 595 return;
592 } 596 }
593 597
605 int scx = 0; 609 int scx = 0;
606 if (sx > int(m_cacheStart)) scx = sx - m_cacheStart; 610 if (sx > int(m_cacheStart)) scx = sx - m_cacheStart;
607 611
608 int fx = sx * int(modelResolution); 612 int fx = sx * int(modelResolution);
609 613
610 if (fx + int(modelResolution) < int(modelStart) || 614 if (fx + int(modelResolution) <= int(modelStart) ||
611 fx > int(modelEnd)) continue; 615 fx > int(modelEnd)) continue;
612 616
613 int rx0 = v->getXForFrame(int((fx + int(modelStart)) * srRatio)); 617 int rx0 = v->getXForFrame(int((fx + int(modelStart)) * srRatio));
614 int rx1 = v->getXForFrame(int((fx + int(modelStart) + int(modelResolution) + 1) * srRatio)); 618 int rx1 = v->getXForFrame(int((fx + int(modelStart) + int(modelResolution) + 1) * srRatio));
615 619