Mercurial > hg > svgui
diff view/Pane.cpp @ 1375:694004228ab7 zoom
Fix incorrect start/end overlay drawing when zoomed far in
author | Chris Cannam |
---|---|
date | Tue, 06 Nov 2018 10:51:46 +0000 |
parents | bbeffb29bf09 |
children | 81dda64a7edc |
line wrap: on
line diff
--- a/view/Pane.cpp Tue Nov 06 08:59:03 2018 +0000 +++ b/view/Pane.cpp Tue Nov 06 10:51:46 2018 +0000 @@ -750,11 +750,8 @@ void Pane::drawModelTimeExtents(QRect r, QPainter &paint, const Model *model) { - int x0 = getXForFrame(model->getStartFrame()); - int x1 = getXForFrame(model->getEndFrame()); - paint.save(); - + QBrush brush; if (hasLightBackground()) { @@ -765,14 +762,24 @@ paint.setPen(Qt::white); } - if (x0 > r.x()) { - paint.fillRect(0, 0, x0, height(), brush); - paint.drawLine(x0, 0, x0, height()); + sv_frame_t f0 = model->getStartFrame(); + + if (f0 > getStartFrame() && f0 < getEndFrame()) { + int x0 = getXForFrame(f0); + if (x0 > r.x()) { + paint.fillRect(0, 0, x0, height(), brush); + paint.drawLine(x0, 0, x0, height()); + } } - if (x1 < r.x() + r.width()) { - paint.fillRect(x1, 0, width() - x1, height(), brush); - paint.drawLine(x1, 0, x1, height()); + sv_frame_t f1 = model->getEndFrame(); + + if (f1 > getStartFrame() && f1 < getEndFrame()) { + int x1 = getXForFrame(f1); + if (x1 < r.x() + r.width()) { + paint.fillRect(x1, 0, width() - x1, height(), brush); + paint.drawLine(x1, 0, x1, height()); + } } paint.restore();