diff 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
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Fri Jan 11 18:19:50 2008 +0000
+++ b/layer/Colour3DPlotLayer.cpp	Mon Jan 14 18:26:06 2008 +0000
@@ -584,12 +584,15 @@
 
     if (int(m_model->getHeight()) >= v->height() ||
         int(modelResolution) < v->getZoomLevel() / 2) {
+#ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT
+        std::cerr << "Colour3DPlotLayer::paint: height = "<< m_model->getHeight() << ", resolution = " << modelResolution << ", model rate = " << m_model->getSampleRate() << ", calling paintDense" << std::endl;
+#endif
         paintDense(v, paint, rect);
         return;
     }
 
 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT
-    std::cerr << "Colour3DPlotLayer::paint: w " << w << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sw << ", sh " << sh << std::endl;
+    std::cerr << "Colour3DPlotLayer::paint: w " << x1-x0 << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sx1-sx0 << ", sh " << sh << std::endl;
     std::cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", resolution " << m_model->getResolution() << std::endl;
 #endif
 
@@ -695,7 +698,7 @@
 
     for (int x = x0; x < x1; ++x) {
 
-        long xf = long(v->getFrameForX(x) / srRatio);
+        long xf = long(v->getFrameForX(x));
         if (xf < 0) {
             for (int y = 0; y < h; ++y) {
                 img.setPixel(x - x0, y, m_cache->color(0));
@@ -703,6 +706,8 @@
             continue;
         }
 
+        xf /= srRatio;
+
         float sx0 = (float(xf) - modelStart) / modelResolution;
         float sx1 = (float(v->getFrameForX(x+1) / srRatio) - modelStart) / modelResolution;