diff options
author | Be <be@mixxx.org> | 2019-08-22 11:08:38 -0500 |
---|---|---|
committer | Be <be@mixxx.org> | 2019-08-22 11:08:38 -0500 |
commit | 0903d1ec62c90006b970b645491f1e6975eb9b4b (patch) | |
tree | e233c17e72922462109b51f06c7117ec34c263c5 /src/widget | |
parent | 2378a881e85ae9aab759a702a1fbc06f497bdc8b (diff) |
WOverview: calculate label background color only once
for efficiency
Diffstat (limited to 'src/widget')
-rw-r--r-- | src/widget/woverview.cpp | 8 | ||||
-rw-r--r-- | src/widget/woverview.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index 405f41b8d5..59dfdc218b 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -90,6 +90,8 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) { m_signalColors.setup(node, context); m_qColorBackground = m_signalColors.getBgColor(); + m_labelBackgroundColor = m_qColorBackground; + m_labelBackgroundColor.setAlpha(128); // Clear the background pixmap, if it exists. m_backgroundPixmap = QPixmap(); @@ -900,10 +902,8 @@ void WOverview::drawTimeRuler(QPainter* pPainter) { QString timeText = mixxx::Duration::formatTime(timePosition) + " -" + mixxx::Duration::formatTime(timePositionTillEnd); - QColor bgColor = m_qColorBackground; - bgColor.setAlpha(128); m_timeRulerPositionLabel.prerender(textPoint, QPixmap(), timeText, - markerFont, Qt::white, bgColor, width(), getDevicePixelRatioF(this)); + markerFont, Qt::white, m_labelBackgroundColor, width(), getDevicePixelRatioF(this)); m_timeRulerPositionLabel.draw(pPainter); QString timeDistanceText; @@ -911,7 +911,7 @@ void WOverview::drawTimeRuler(QPainter* pPainter) { timeDistanceText = mixxx::Duration::formatTime(timeDistance); } m_timeRulerDistanceLabel.prerender(textPointDistance, QPixmap(), timeDistanceText, - markerFont, Qt::white, bgColor, width(), getDevicePixelRatioF(this)); + markerFont, Qt::white, m_labelBackgroundColor, width(), getDevicePixelRatioF(this)); m_timeRulerDistanceLabel.draw(pPainter); } else { m_timeRulerPositionLabel.clear(); diff --git a/src/widget/woverview.h b/src/widget/woverview.h index a13c69093b..6716781ece 100644 --- a/src/widget/woverview.h +++ b/src/widget/woverview.h @@ -159,6 +159,7 @@ class WOverview : public WWidget, public TrackDropTarget { QPixmap m_backgroundPixmap; QString m_backgroundPixmapPath; QColor m_qColorBackground; + QColor m_labelBackgroundColor; QColor m_endOfTrackColor; PredefinedColorsRepresentation m_predefinedColorsRepresentation; |