diff widgets/Panner.cpp @ 908:4a578a360011 cxx11

More type fixes
author Chris Cannam
date Tue, 10 Mar 2015 13:22:10 +0000
parents ae4f58d9db84
children 4d0ca1ab4cd0
line wrap: on
line diff
--- a/widgets/Panner.cpp	Tue Mar 10 10:31:27 2015 +0000
+++ b/widgets/Panner.cpp	Tue Mar 10 13:22:10 2015 +0000
@@ -65,7 +65,7 @@
     float unit = m_scrollUnit;
     if (unit == 0.f) {
         unit = float(m_rectHeight) / (6 * float(height()));
-        if (unit < 0.01) unit = 0.01;
+        if (unit < 0.01f) unit = 0.01f;
     }
 
     if (!up) {
@@ -165,24 +165,24 @@
 
     paint.setBrush(hl);
 
-    int rw = lrintf((width() - 1) * m_rectWidth);
-    int rh = lrintf((height() - 1) * m_rectHeight);
+    int rw = int(lrintf(float(width() - 1) * m_rectWidth));
+    int rh = int(lrintf(float(height() - 1) * m_rectHeight));
     if (rw < 2) rw = 2;
     if (rh < 2) rh = 2;
 
-    paint.drawRect(lrintf(width() * m_rectX),
-                   lrintf(height() * m_rectY),
+    paint.drawRect(int(lrintf(float(width()) * m_rectX)),
+                   int(lrintf(float(height()) * m_rectY)),
                    rw, rh);
 }
 
 void
 Panner::normalise()
 {
-    if (m_rectWidth > 1.0) m_rectWidth = 1.0;
-    if (m_rectHeight > 1.0) m_rectHeight = 1.0;
-    if (m_rectX + m_rectWidth > 1.0) m_rectX = 1.0 - m_rectWidth;
+    if (m_rectWidth > 1.f) m_rectWidth = 1.f;
+    if (m_rectHeight > 1.f) m_rectHeight = 1.f;
+    if (m_rectX + m_rectWidth > 1.f) m_rectX = 1.f - m_rectWidth;
     if (m_rectX < 0) m_rectX = 0;
-    if (m_rectY + m_rectHeight > 1.0) m_rectY = 1.0 - m_rectHeight;
+    if (m_rectY + m_rectHeight > 1.f) m_rectY = 1.f - m_rectHeight;
     if (m_rectY < 0) m_rectY = 0;
 
     if (!m_defaultsSet) {