comparison layer/LinearNumericalScale.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 e0f08e108064
children 4fe7a09be0fe
comparison
equal deleted inserted replaced
904:e0f08e108064 905:b66fb15de477
45 const int buflen = 40; 45 const int buflen = 40;
46 char buffer[buflen]; 46 char buffer[buflen];
47 47
48 int w = getWidth(v, paint) + x0; 48 int w = getWidth(v, paint) + x0;
49 49
50 double round = 1.f; 50 double round = 1.0;
51 int dp = 0; 51 int dp = 0;
52 if (inc > 0) { 52 if (inc > 0) {
53 int prec = trunc(log10f(inc)); 53 int prec = int(trunc(log10(inc)));
54 prec -= 1; 54 prec -= 1;
55 if (prec < 0) dp = -prec; 55 if (prec < 0) dp = -prec;
56 round = powf(10.f, prec); 56 round = pow(10.0, prec);
57 #ifdef DEBUG_TIME_VALUE_LAYER 57 #ifdef DEBUG_TIME_VALUE_LAYER
58 cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl; 58 cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl;
59 #endif 59 #endif
60 } 60 }
61 61
70 70
71 if (i == n-1 && 71 if (i == n-1 &&
72 v->height() < paint.fontMetrics().height() * (n*2)) { 72 v->height() < paint.fontMetrics().height() * (n*2)) {
73 if (layer->getScaleUnits() != "") drawText = false; 73 if (layer->getScaleUnits() != "") drawText = false;
74 } 74 }
75 dispval = lrintf(val / round) * round; 75 dispval = int(rint(val / round) * round);
76 76
77 #ifdef DEBUG_TIME_VALUE_LAYER 77 #ifdef DEBUG_TIME_VALUE_LAYER
78 cerr << "val = " << val << ", dispval = " << dispval << endl; 78 cerr << "val = " << val << ", dispval = " << dispval << endl;
79 #endif 79 #endif
80 80