Mercurial > hg > svgui
diff layer/LogColourScale.cpp @ 946:36cddc3de023 alignment_view
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:19:52 +0100 |
parents | b66fb15de477 |
children | 4fe7a09be0fe |
line wrap: on
line diff
--- a/layer/LogColourScale.cpp Thu Jan 15 16:00:53 2015 +0000 +++ b/layer/LogColourScale.cpp Mon Apr 20 09:19:52 2015 +0100 @@ -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);