Mercurial > hg > svgui
comparison view/AlignmentView.cpp @ 1620:dc0e47f234a2 tip
Fix some erroneous uses of reference frame where we intended "above"-view frame
author | Chris Cannam |
---|---|
date | Tue, 18 Aug 2020 16:39:26 +0100 |
parents | 36634b427d61 |
children |
comparison
equal
deleted
inserted
replaced
1619:36634b427d61 | 1620:dc0e47f234a2 |
---|---|
203 for (const auto &km: m_fromAboveMap) { | 203 for (const auto &km: m_fromAboveMap) { |
204 | 204 |
205 sv_frame_t af = km.first; | 205 sv_frame_t af = km.first; |
206 sv_frame_t bf = km.second; | 206 sv_frame_t bf = km.second; |
207 | 207 |
208 if (af < m_leftmostAbove || af > m_rightmostAbove) { | 208 if (af < m_leftmostAbove) { |
209 #ifdef DEBUG_ALIGNMENT_VIEW | |
210 SVCERR << "AlignmentView: af " << af << " < m_leftmostAbove " << m_leftmostAbove << endl; | |
211 #endif | |
212 continue; | |
213 } | |
214 if (af > m_rightmostAbove) { | |
215 #ifdef DEBUG_ALIGNMENT_VIEW | |
216 SVCERR << "AlignmentView: af " << af << " > m_rightmostAbove " << m_rightmostAbove << endl; | |
217 #endif | |
209 continue; | 218 continue; |
210 } | 219 } |
211 | 220 |
212 int ax = m_above->getXForFrame(af); | 221 int ax = m_above->getXForFrame(af); |
213 int bx = m_below->getXForFrame(bf); | 222 int bx = m_below->getXForFrame(bf); |
303 // just all map to the same first/last destination frame. But we | 312 // just all map to the same first/last destination frame. But we |
304 // don't want to display their mappings, as they're just noise.) | 313 // don't want to display their mappings, as they're just noise.) |
305 m_leftmostAbove = -1; | 314 m_leftmostAbove = -1; |
306 m_rightmostAbove = -1; | 315 m_rightmostAbove = -1; |
307 | 316 |
308 sv_frame_t prevRf = -1; | 317 sv_frame_t prevAf = -1; |
309 sv_frame_t prevBf = -1; | 318 sv_frame_t prevBf = -1; |
310 | 319 |
311 foreach (sv_frame_t f, keyFrames) { | 320 foreach (sv_frame_t af, keyFrames) { |
312 | 321 |
313 sv_frame_t rf = m_above->alignToReference(f); | 322 sv_frame_t rf = m_above->alignToReference(af); |
314 sv_frame_t bf = m_below->alignFromReference(rf); | 323 sv_frame_t bf = m_below->alignFromReference(rf); |
315 | 324 |
316 if (prevBf > 0 && bf > prevBf) { | 325 if (prevBf > 0 && bf > prevBf) { |
317 if (m_leftmostAbove < 0 && prevBf > 0 && bf > prevBf) { | 326 if (m_leftmostAbove < 0) { |
318 m_leftmostAbove = prevRf; | 327 m_leftmostAbove = prevAf; |
319 } | 328 } |
320 m_rightmostAbove = rf; | 329 m_rightmostAbove = af; |
321 } | 330 } |
322 prevRf = rf; | 331 prevAf = af; |
323 prevBf = bf; | 332 prevBf = bf; |
324 | 333 |
325 bool mappedSomething = false; | 334 bool mappedSomething = false; |
326 | 335 |
327 if (resolution > 1) { | 336 if (resolution > 1) { |
328 if (keyFramesBelow.find(bf) == keyFramesBelow.end()) { | 337 if (keyFramesBelow.find(bf) == keyFramesBelow.end()) { |
329 | 338 |
330 sv_frame_t f1 = f + resolution; | 339 sv_frame_t af1 = af + resolution; |
331 sv_frame_t rf1 = m_above->alignToReference(f1); | 340 sv_frame_t rf1 = m_above->alignToReference(af1); |
332 sv_frame_t bf1 = m_below->alignFromReference(rf1); | 341 sv_frame_t bf1 = m_below->alignFromReference(rf1); |
333 | 342 |
334 for (sv_frame_t probe = bf + 1; probe <= bf1; ++probe) { | 343 for (sv_frame_t probe = bf + 1; probe <= bf1; ++probe) { |
335 if (keyFramesBelow.find(probe) != keyFramesBelow.end()) { | 344 if (keyFramesBelow.find(probe) != keyFramesBelow.end()) { |
336 m_fromAboveMap.insert({ f, probe }); | 345 m_fromAboveMap.insert({ af, probe }); |
337 mappedSomething = true; | 346 mappedSomething = true; |
338 } | 347 } |
339 } | 348 } |
340 } | 349 } |
341 } | 350 } |
342 | 351 |
343 if (!mappedSomething) { | 352 if (!mappedSomething) { |
344 m_fromAboveMap.insert({ f, bf }); | 353 m_fromAboveMap.insert({ af, bf }); |
345 } | 354 } |
346 } | 355 } |
347 | 356 |
348 #ifdef DEBUG_ALIGNMENT_VIEW | 357 #ifdef DEBUG_ALIGNMENT_VIEW |
349 SVCERR << "AlignmentView " << getId() << "::buildMaps: have " | 358 SVCERR << "AlignmentView " << getId() << "::buildMaps: have " |