diff layer/SpectrogramLayer.cpp @ 558:9fc13f61ae74

* Avoid warnings for out of range pixel set at edges
author Chris Cannam
date Tue, 22 Jun 2010 09:45:42 +0000
parents eabefd562995
children 4c484636d5ec
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Tue Jun 15 10:48:28 2010 +0000
+++ b/layer/SpectrogramLayer.cpp	Tue Jun 22 09:45:42 2010 +0000
@@ -2582,9 +2582,10 @@
                 float y = v->getYForFrequency
                     (freq, displayMinFreq, displayMaxFreq, logarithmic);
 
-                if (y < 0 || y >= h) continue;
-
-                m_drawBuffer.setPixel(x, y, getDisplayValue(v, value));
+                int iy = int(y + 0.5);
+                if (iy < 0 || iy >= h) continue;
+
+                m_drawBuffer.setPixel(x, iy, getDisplayValue(v, value));
             }
 
             if (mag.isSet()) {