diff options
author | Be <be@mixxx.org> | 2019-08-21 00:39:33 -0500 |
---|---|---|
committer | Be <be@mixxx.org> | 2019-08-21 00:39:33 -0500 |
commit | 2378a881e85ae9aab759a702a1fbc06f497bdc8b (patch) | |
tree | fd6be7bb2cb7f45290b190aabfd0bff52788f69e /src | |
parent | 4f9a5da1c3d552357253f080ee5650f225141aed (diff) |
elaborate in comments
Diffstat (limited to 'src')
-rw-r--r-- | src/waveform/waveformmarklabel.h | 5 | ||||
-rw-r--r-- | src/widget/woverview.cpp | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/waveform/waveformmarklabel.h b/src/waveform/waveformmarklabel.h index d8e2157168..02ff40ca79 100644 --- a/src/waveform/waveformmarklabel.h +++ b/src/waveform/waveformmarklabel.h @@ -8,11 +8,14 @@ #include <QString> #include <QRectF> +// WaveformMarkLabel renders the label for a WaveformMark to an offscreen buffer +// and calculates its area. This allows the areas of all WaveformMarkLabels +// to be compared so overlapping labels are not drawn. class WaveformMarkLabel { public: WaveformMarkLabel() {}; - // Render the pixmap to an internal buffer + // Render the label to an internal QPixmap buffer void prerender(QPointF bottomLeft, QPixmap icon, QString text, QFont font, QColor textColor, QColor backgroundColor, float widgetWidth, double scaleFactor); diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index 71dc66c501..405f41b8d5 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -670,18 +670,18 @@ void WOverview::drawMarks(QPainter* pPainter, const float offset, const float ga shadowFont.setWeight(99); shadowFont.setPixelSize(10 * m_scaleFactor); - // Text labels are rendered so they do not overlap with other WaveformMark's + // Text labels are rendered so they do not overlap with other WaveformMarks' // labels. If the text would be too wide, it is elided. However, the user // can hover the mouse cursor over a label to show the whole label text, // temporarily hiding any following labels that would be drawn over it. // This requires looping over the WaveformMarks twice and the marks must be // sorted in the order they appear on the waveform. // In the first loop, the lines are drawn and the text to render plus its - // location are calculated. The text must be drawn in the second loop to - // prevent the lines of following WaveformMarks getting drawn over it. The - // second loop is in the separate drawMarkLabels function so it can be - // called after drawCurrentPosition so the view of labels is not obscured - // by the playhead. + // location are calculated then stored in a WaveformMarkLabel. The text must + // be drawn in the second loop to prevent the lines of following + // WaveformMarks getting drawn over it. The second loop is in the separate + // drawMarkLabels function so it can be called after drawCurrentPosition so + // the view of labels is not obscured by the playhead. bool markHovered = false; for (int i = 0; i < m_marksToRender.size(); ++i) { |