Mercurial > hg > svgui
comparison view/View.cpp @ 1329:344f29e46258 zoom
Responding to a hang due to mismatching zoom and block sizes
author | Chris Cannam |
---|---|
date | Thu, 20 Sep 2018 15:42:12 +0100 |
parents | 646e713a4632 |
children | c1f719094c25 |
comparison
equal
deleted
inserted
replaced
1328:b39cd8fb309f | 1329:344f29e46258 |
---|---|
45 | 45 |
46 #include <iostream> | 46 #include <iostream> |
47 #include <cassert> | 47 #include <cassert> |
48 #include <cmath> | 48 #include <cmath> |
49 | 49 |
50 //#define DEBUG_VIEW 1 | 50 #define DEBUG_VIEW 1 |
51 //#define DEBUG_VIEW_WIDGET_PAINT 1 | 51 //#define DEBUG_VIEW_WIDGET_PAINT 1 |
52 | 52 |
53 View::View(QWidget *w, bool showProgress) : | 53 View::View(QWidget *w, bool showProgress) : |
54 QFrame(w), | 54 QFrame(w), |
55 m_id(getNextId()), | 55 m_id(getNextId()), |
326 bool | 326 bool |
327 View::setCentreFrame(sv_frame_t f, bool e) | 327 View::setCentreFrame(sv_frame_t f, bool e) |
328 { | 328 { |
329 bool changeVisible = false; | 329 bool changeVisible = false; |
330 | 330 |
331 #ifdef DEBUG_VIEW | |
332 SVCERR << "View::setCentreFrame: from " << m_centreFrame | |
333 << " to " << f << endl; | |
334 #endif | |
335 | |
331 if (m_centreFrame != f) { | 336 if (m_centreFrame != f) { |
332 | 337 |
333 sv_frame_t formerCentre = m_centreFrame; | 338 sv_frame_t formerCentre = m_centreFrame; |
334 m_centreFrame = f; | 339 m_centreFrame = f; |
335 | 340 |
349 if (newPixel != formerPixel) { | 354 if (newPixel != formerPixel) { |
350 | 355 |
351 #ifdef DEBUG_VIEW_WIDGET_PAINT | 356 #ifdef DEBUG_VIEW_WIDGET_PAINT |
352 SVCERR << "View(" << this << ")::setCentreFrame: newPixel " << newPixel << ", formerPixel " << formerPixel << endl; | 357 SVCERR << "View(" << this << ")::setCentreFrame: newPixel " << newPixel << ", formerPixel " << formerPixel << endl; |
353 #endif | 358 #endif |
359 // ensure the centre frame is a multiple of the zoom level | |
360 m_centreFrame = sv_frame_t(newPixel) * m_zoomLevel.level; | |
361 | |
354 update(); | 362 update(); |
355 changeVisible = true; | 363 changeVisible = true; |
356 } | 364 } |
357 } | 365 } |
358 | 366 |