Mercurial > hg > svgui
diff layer/LogColourScale.cpp @ 905:b66fb15de477 cxx11
Working through the float/double and int/sv_frame_t fixes
author | Chris Cannam |
---|---|
date | Mon, 09 Mar 2015 14:35:21 +0000 |
parents | 3ca3b8fbbcee |
children | 4fe7a09be0fe |
line wrap: on
line diff
--- a/layer/LogColourScale.cpp Mon Mar 09 12:02:10 2015 +0000 +++ b/layer/LogColourScale.cpp Mon Mar 09 14:35:21 2015 +0000 @@ -36,15 +36,15 @@ const ColourScaleLayer *layer, QPainter &paint, int /* x0 */, - float minlog, - float maxlog) + double minlog, + double maxlog) { int h = v->height(); int n = 10; - float val = minlog; - float inc = (maxlog - val) / n; + double val = minlog; + double inc = (maxlog - val) / n; const int buflen = 40; char buffer[buflen]; @@ -60,7 +60,7 @@ paint.save(); for (int y = 0; y < boxh; ++y) { - float val = ((boxh - y) * (maxlog - minlog)) / boxh + minlog; + double val = ((boxh - y) * (maxlog - minlog)) / boxh + minlog; paint.setPen(layer->getColourForValue(v, LogRange::unmap(val))); paint.drawLine(boxx + 1, y + boxy + 1, boxx + boxw, y + boxy + 1); } @@ -68,7 +68,7 @@ int dp = 0; if (inc > 0) { - int prec = trunc(log10f(inc)); + int prec = int(trunc(log10(inc))); prec -= 1; if (prec < 0) dp = -prec; } @@ -83,7 +83,7 @@ paint.fontMetrics().ascent() + 2; double dv = LogRange::unmap(val); - int digits = trunc(log10f(dv)); + int digits = int(trunc(log10(dv))); int sf = dp + (digits > 0 ? digits : 0); if (sf < 2) sf = 2; snprintf(buffer, buflen, "%.*g", sf, dv);