Mercurial > hg > svgui
comparison view/View.cpp @ 1343:5f3e374746b6 zoom
Fix crash when scrolling beyond end of waveform (+ fix compiler warnings)
author | Chris Cannam |
---|---|
date | Thu, 27 Sep 2018 16:20:58 +0100 |
parents | ab2cafd3a7cb |
children | 4949061fcb8c |
comparison
equal
deleted
inserted
replaced
1342:ed6400d5b571 | 1343:5f3e374746b6 |
---|---|
388 sv_frame_t level = m_zoomLevel.level; | 388 sv_frame_t level = m_zoomLevel.level; |
389 sv_frame_t fdiff = frame - getCentreFrame(); | 389 sv_frame_t fdiff = frame - getCentreFrame(); |
390 int diff, result; | 390 int diff, result; |
391 | 391 |
392 if (m_zoomLevel.zone == ZoomLevel::FramesPerPixel) { | 392 if (m_zoomLevel.zone == ZoomLevel::FramesPerPixel) { |
393 diff = fdiff / level; | 393 diff = int(fdiff / level); |
394 if ((fdiff < 0) && ((fdiff % level) != 0)) { | 394 if ((fdiff < 0) && ((fdiff % level) != 0)) { |
395 --diff; // round to the left | 395 --diff; // round to the left |
396 } | 396 } |
397 } else { | 397 } else { |
398 diff = fdiff * level; | 398 diff = int(fdiff * level); |
399 } | 399 } |
400 | 400 |
401 result = int(diff + (width()/2)); | 401 result = int(diff + (width()/2)); |
402 return result; | 402 return result; |
403 } | 403 } |