comparison layer/Colour3DPlotLayer.cpp @ 347:d3ee7524d39b

* fix colour 3d plot layer mis-rendering bug -- but I think it's still using dense mode when it shouldn't be (for similarity matrix)
author Chris Cannam
date Mon, 14 Jan 2008 18:26:06 +0000
parents 8f01867cc191
children 0093f351641c
comparison
equal deleted inserted replaced
346:8f01867cc191 347:d3ee7524d39b
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 if (int(m_model->getHeight()) >= v->height() || 585 if (int(m_model->getHeight()) >= v->height() ||
586 int(modelResolution) < v->getZoomLevel() / 2) { 586 int(modelResolution) < v->getZoomLevel() / 2) {
587 #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;
589 #endif
587 paintDense(v, paint, rect); 590 paintDense(v, paint, rect);
588 return; 591 return;
589 } 592 }
590 593
591 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT 594 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT
592 std::cerr << "Colour3DPlotLayer::paint: w " << w << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sw << ", sh " << sh << std::endl; 595 std::cerr << "Colour3DPlotLayer::paint: w " << x1-x0 << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sx1-sx0 << ", sh " << sh << std::endl;
593 std::cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", resolution " << m_model->getResolution() << std::endl; 596 std::cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", resolution " << m_model->getResolution() << std::endl;
594 #endif 597 #endif
595 598
596 QPoint illuminatePos; 599 QPoint illuminatePos;
597 bool illuminate = v->shouldIlluminateLocalFeatures(this, illuminatePos); 600 bool illuminate = v->shouldIlluminateLocalFeatures(this, illuminatePos);
693 696
694 QImage img(w, h, QImage::Format_RGB32); 697 QImage img(w, h, QImage::Format_RGB32);
695 698
696 for (int x = x0; x < x1; ++x) { 699 for (int x = x0; x < x1; ++x) {
697 700
698 long xf = long(v->getFrameForX(x) / srRatio); 701 long xf = long(v->getFrameForX(x));
699 if (xf < 0) { 702 if (xf < 0) {
700 for (int y = 0; y < h; ++y) { 703 for (int y = 0; y < h; ++y) {
701 img.setPixel(x - x0, y, m_cache->color(0)); 704 img.setPixel(x - x0, y, m_cache->color(0));
702 } 705 }
703 continue; 706 continue;
704 } 707 }
708
709 xf /= srRatio;
705 710
706 float sx0 = (float(xf) - modelStart) / modelResolution; 711 float sx0 = (float(xf) - modelStart) / modelResolution;
707 float sx1 = (float(v->getFrameForX(x+1) / srRatio) - modelStart) / modelResolution; 712 float sx1 = (float(v->getFrameForX(x+1) / srRatio) - modelStart) / modelResolution;
708 713
709 int sx0i = int(sx0 + 0.001); 714 int sx0i = int(sx0 + 0.001);