comparison 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
comparison
equal deleted inserted replaced
1374:631897ba9fca 1375:694004228ab7
748 } 748 }
749 749
750 void 750 void
751 Pane::drawModelTimeExtents(QRect r, QPainter &paint, const Model *model) 751 Pane::drawModelTimeExtents(QRect r, QPainter &paint, const Model *model)
752 { 752 {
753 int x0 = getXForFrame(model->getStartFrame());
754 int x1 = getXForFrame(model->getEndFrame());
755
756 paint.save(); 753 paint.save();
757 754
758 QBrush brush; 755 QBrush brush;
759 756
760 if (hasLightBackground()) { 757 if (hasLightBackground()) {
761 brush = QBrush(QColor("#aaf8f8f8")); 758 brush = QBrush(QColor("#aaf8f8f8"));
762 paint.setPen(Qt::black); 759 paint.setPen(Qt::black);
763 } else { 760 } else {
764 brush = QBrush(QColor("#aa101010")); 761 brush = QBrush(QColor("#aa101010"));
765 paint.setPen(Qt::white); 762 paint.setPen(Qt::white);
766 } 763 }
767 764
768 if (x0 > r.x()) { 765 sv_frame_t f0 = model->getStartFrame();
769 paint.fillRect(0, 0, x0, height(), brush); 766
770 paint.drawLine(x0, 0, x0, height()); 767 if (f0 > getStartFrame() && f0 < getEndFrame()) {
771 } 768 int x0 = getXForFrame(f0);
772 769 if (x0 > r.x()) {
773 if (x1 < r.x() + r.width()) { 770 paint.fillRect(0, 0, x0, height(), brush);
774 paint.fillRect(x1, 0, width() - x1, height(), brush); 771 paint.drawLine(x0, 0, x0, height());
775 paint.drawLine(x1, 0, x1, height()); 772 }
773 }
774
775 sv_frame_t f1 = model->getEndFrame();
776
777 if (f1 > getStartFrame() && f1 < getEndFrame()) {
778 int x1 = getXForFrame(f1);
779 if (x1 < r.x() + r.width()) {
780 paint.fillRect(x1, 0, width() - x1, height(), brush);
781 paint.drawLine(x1, 0, x1, height());
782 }
776 } 783 }
777 784
778 paint.restore(); 785 paint.restore();
779 } 786 }
780 787