Mercurial > hg > svgui
comparison layer/TimeValueLayer.cpp @ 1401:28075cc658c9
Scale pen for retina display on macOS as well as for hidpi display elsewhere
author | Chris Cannam |
---|---|
date | Thu, 15 Nov 2018 14:04:32 +0000 |
parents | c39f2d439d59 |
children | b0eeec95ab5b |
comparison
equal
deleted
inserted
replaced
1400:decb7741d036 | 1401:28075cc658c9 |
---|---|
563 frame - prevPoints.begin()->frame) { | 563 frame - prevPoints.begin()->frame) { |
564 usePoints = nextPoints; | 564 usePoints = nextPoints; |
565 } | 565 } |
566 | 566 |
567 if (!usePoints.empty()) { | 567 if (!usePoints.empty()) { |
568 int fuzz = ViewManager::scalePixelSize(2); | 568 int fuzz = v->scaleSize(2); |
569 int px = v->getXForFrame(usePoints.begin()->frame); | 569 int px = v->getXForFrame(usePoints.begin()->frame); |
570 if ((px > x && px - x > fuzz) || | 570 if ((px > x && px - x > fuzz) || |
571 (px < x && x - px > fuzz + 3)) { | 571 (px < x && x - px > fuzz + 3)) { |
572 usePoints.clear(); | 572 usePoints.clear(); |
573 } | 573 } |
1059 } else if (m_plotStyle == PlotLines || | 1059 } else if (m_plotStyle == PlotLines || |
1060 m_plotStyle == PlotCurve) { | 1060 m_plotStyle == PlotCurve) { |
1061 brush = QBrush(Qt::NoBrush); | 1061 brush = QBrush(Qt::NoBrush); |
1062 } | 1062 } |
1063 | 1063 |
1064 paint.setPen(PaintAssistant::scalePen(pen)); | 1064 paint.setPen(v->scalePen(pen)); |
1065 paint.setBrush(brush); | 1065 paint.setBrush(brush); |
1066 | 1066 |
1067 if (m_plotStyle == PlotStems) { | 1067 if (m_plotStyle == PlotStems) { |
1068 if (y < origin - 1) { | 1068 if (y < origin - 1) { |
1069 paint.drawLine(x + w/2, y + 1, x + w/2, origin); | 1069 paint.drawLine(x + w/2, y + 1, x + w/2, origin); |
1090 m_plotStyle != PlotCurve && | 1090 m_plotStyle != PlotCurve && |
1091 m_plotStyle != PlotDiscreteCurves && | 1091 m_plotStyle != PlotDiscreteCurves && |
1092 m_plotStyle != PlotSegmentation) { | 1092 m_plotStyle != PlotSegmentation) { |
1093 if (illuminate) { | 1093 if (illuminate) { |
1094 paint.save(); | 1094 paint.save(); |
1095 paint.setPen(PaintAssistant::scalePen(getForegroundQColor(v))); | 1095 paint.setPen(v->scalePen(getForegroundQColor(v))); |
1096 paint.setBrush(getForegroundQColor(v)); | 1096 paint.setBrush(getForegroundQColor(v)); |
1097 } | 1097 } |
1098 if (m_plotStyle != PlotStems || | 1098 if (m_plotStyle != PlotStems || |
1099 w > 1) { | 1099 w > 1) { |
1100 paint.drawRect(x, y - 1, w, 2); | 1100 paint.drawRect(x, y - 1, w, 2); |
1112 if (haveNext) { | 1112 if (haveNext) { |
1113 | 1113 |
1114 if (m_plotStyle == PlotConnectedPoints) { | 1114 if (m_plotStyle == PlotConnectedPoints) { |
1115 | 1115 |
1116 paint.save(); | 1116 paint.save(); |
1117 paint.setPen(PaintAssistant::scalePen(brushColour)); | 1117 paint.setPen(v->scalePen(brushColour)); |
1118 paint.drawLine(x + w, y, nx, ny); | 1118 paint.drawLine(x + w, y, nx, ny); |
1119 paint.restore(); | 1119 paint.restore(); |
1120 | 1120 |
1121 } else if (m_plotStyle == PlotLines) { | 1121 } else if (m_plotStyle == PlotLines) { |
1122 | 1122 |
1171 cerr << "drawing rect" << endl; | 1171 cerr << "drawing rect" << endl; |
1172 #endif | 1172 #endif |
1173 | 1173 |
1174 if (nx <= x) continue; | 1174 if (nx <= x) continue; |
1175 | 1175 |
1176 paint.setPen(PaintAssistant::scalePen(QPen(getForegroundQColor(v), 2))); | 1176 paint.setPen(v->scalePen(QPen(getForegroundQColor(v), 2))); |
1177 | 1177 |
1178 if (!illuminate) { | 1178 if (!illuminate) { |
1179 if (!m_drawSegmentDivisions || | 1179 if (!m_drawSegmentDivisions || |
1180 nx < x + 5 || | 1180 nx < x + 5 || |
1181 x >= v->getPaintWidth() - 1) { | 1181 x >= v->getPaintWidth() - 1) { |