Mercurial > hg > svgui
diff layer/Layer.cpp @ 944:78c152e4db95
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:12:17 +0100 |
parents | 4a578a360011 |
children | 4fe7a09be0fe |
line wrap: on
line diff
--- a/layer/Layer.cpp Thu Jan 15 10:42:00 2015 +0000 +++ b/layer/Layer.cpp Mon Apr 20 09:12:17 2015 +0100 @@ -51,8 +51,8 @@ connect(model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged())); - connect(model, SIGNAL(modelChangedWithin(int, int)), - this, SIGNAL(modelChangedWithin(int, int))); + connect(model, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), + this, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t))); connect(model, SIGNAL(completionChanged()), this, SIGNAL(modelCompletionChanged())); @@ -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; @@ -250,12 +250,12 @@ // reference (i.e. having been copied from the reference // model). - int sourceFrame = i->getFrame(); - int referenceFrame = sourceFrame; + sv_frame_t sourceFrame = i->getFrame(); + sv_frame_t referenceFrame = sourceFrame; if (i->haveReferenceFrame()) { referenceFrame = i->getReferenceFrame(); } - int myMappedFrame = alignToReference(v, sourceFrame); + sv_frame_t myMappedFrame = alignToReference(v, sourceFrame); // cerr << "sourceFrame = " << sourceFrame << ", referenceFrame = " << referenceFrame << " (have = " << i->haveReferenceFrame() << "), myMappedFrame = " << myMappedFrame << endl; @@ -470,8 +470,8 @@ void Layer::updateMeasurePixrects(View *v) const { - int sf = v->getStartFrame(); - int ef = v->getEndFrame(); + sv_frame_t sf = v->getStartFrame(); + sv_frame_t ef = v->getEndFrame(); for (MeasureRectSet::const_iterator i = m_measureRects.begin(); i != m_measureRects.end(); ++i) { @@ -509,8 +509,8 @@ void Layer::updateMeasureRectYCoords(View *v, const MeasureRect &r) const { - int y0 = lrint(r.startY * v->height()); - int y1 = lrint(r.endY * v->height()); + int y0 = int(lrint(r.startY * v->height())); + int y1 = int(lrint(r.endY * v->height())); r.pixrect = QRect(r.pixrect.x(), y0, r.pixrect.width(), y1 - y0); } @@ -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;