Mercurial > hg > svgui
diff layer/Layer.cpp @ 904:e0f08e108064 cxx11
Move to using double rather than float for floating-point calculations (float only for storage); more build fixes
author | Chris Cannam |
---|---|
date | Mon, 09 Mar 2015 12:02:10 +0000 |
parents | 4c8ca536b54f |
children | b66fb15de477 |
line wrap: on
line diff
--- a/layer/Layer.cpp Mon Mar 09 08:43:20 2015 +0000 +++ b/layer/Layer.cpp Mon Mar 09 12:02:10 2015 +0000 @@ -139,34 +139,34 @@ } bool -Layer::getXScaleValue(const View *v, int x, float &value, QString &unit) const +Layer::getXScaleValue(const View *v, int x, double &value, QString &unit) const { if (!hasTimeXAxis()) return false; const Model *m = getModel(); if (!m) return false; - value = float(v->getFrameForX(x)) / m->getSampleRate(); + value = double(v->getFrameForX(x)) / m->getSampleRate(); unit = "s"; return true; } bool Layer::getYScaleDifference(const View *v, int y0, int y1, - float &diff, QString &unit) const + double &diff, QString &unit) const { - float v0, v1; + double v0, v1; if (!getYScaleValue(v, y0, v0, unit) || !getYScaleValue(v, y1, v1, unit)) { diff = 0.f; return false; } - diff = fabsf(v1 - v0); + diff = fabs(v1 - v0); return true; } -int -Layer::alignToReference(View *v, int frame) const +sv_frame_t +Layer::alignToReference(View *v, sv_frame_t frame) const { const Model *m = getModel(); SVDEBUG << "Layer::alignToReference(" << frame << "): model = " << m << ", alignment reference = " << (m ? m->getAlignmentReference() : 0) << endl; @@ -177,8 +177,8 @@ } } -int -Layer::alignFromReference(View *v, int frame) const +sv_frame_t +Layer::alignFromReference(View *v, sv_frame_t frame) const { const Model *m = getModel(); SVDEBUG << "Layer::alignFromReference(" << frame << "): model = " << m << ", alignment reference = " << (m ? m->getAlignmentReference() : 0) << endl; @@ -541,7 +541,7 @@ Layer::MeasureRectSet::const_iterator Layer::findFocusedMeasureRect(QPoint focusPoint) const { - float frDist = 0; + double frDist = 0; MeasureRectSet::const_iterator focusRectItr = m_measureRects.end(); for (MeasureRectSet::const_iterator i = m_measureRects.begin(); @@ -554,7 +554,7 @@ int xd = focusPoint.x() - cx; int yd = focusPoint.y() - cy; - float d = sqrt(float(xd * xd + yd * yd)); + double d = sqrt(double(xd * xd + yd * yd)); if (focusRectItr == m_measureRects.end() || d < frDist) { focusRectItr = i;