Mercurial > hg > svgui
comparison layer/LogNumericalScale.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 | 
|---|---|
| 60 | 60 | 
| 61 double round = 1.f; | 61 double round = 1.f; | 
| 62 int dp = 0; | 62 int dp = 0; | 
| 63 | 63 | 
| 64 if (minDispInc > 0) { | 64 if (minDispInc > 0) { | 
| 65 int prec = trunc(log10f(minDispInc)); | 65 int prec = int(trunc(log10(minDispInc))); | 
| 66 if (prec < 0) dp = -prec; | 66 if (prec < 0) dp = -prec; | 
| 67 round = powf(10.f, prec); | 67 round = pow(10.0, prec); | 
| 68 if (dp > 4) dp = 4; | 68 if (dp > 4) dp = 4; | 
| 69 #ifdef DEBUG_TIME_VALUE_LAYER | 69 #ifdef DEBUG_TIME_VALUE_LAYER | 
| 70 cerr << "round = " << round << ", prec = " << prec << ", dp = " << dp << endl; | 70 cerr << "round = " << round << ", prec = " << prec << ", dp = " << dp << endl; | 
| 71 #endif | 71 #endif | 
| 72 } | 72 } | 
| 97 if (prevy >= 0 && (prevy - y) < paint.fontMetrics().height()) { | 97 if (prevy >= 0 && (prevy - y) < paint.fontMetrics().height()) { | 
| 98 val += inc; | 98 val += inc; | 
| 99 continue; | 99 continue; | 
| 100 } | 100 } | 
| 101 | 101 | 
| 102 int digits = trunc(log10f(dispval)); | 102 int digits = int(trunc(log10(dispval))); | 
| 103 int sf = dp + (digits > 0 ? digits : 0); | 103 int sf = dp + (digits > 0 ? digits : 0); | 
| 104 if (sf < 4) sf = 4; | 104 if (sf < 4) sf = 4; | 
| 105 #ifdef DEBUG_TIME_VALUE_LAYER | 105 #ifdef DEBUG_TIME_VALUE_LAYER | 
| 106 cerr << "sf = " << sf << endl; | 106 cerr << "sf = " << sf << endl; | 
| 107 #endif | 107 #endif | 
