* @brief Renders the spectrogram and composites it with the cached axis layer. */
| 751 | * @brief Renders the spectrogram and composites it with the cached axis layer. |
| 752 | */ |
| 753 | void Widgets::Waterfall::paint(QPainter* painter) |
| 754 | { |
| 755 | if (!painter) |
| 756 | return; |
| 757 | |
| 758 | painter->setRenderHint(QPainter::SmoothPixmapTransform, true); |
| 759 | painter->setRenderHint(QPainter::Antialiasing, true); |
| 760 | painter->setRenderHint(QPainter::TextAntialiasing, true); |
| 761 | |
| 762 | if (m_axisDirty) |
| 763 | renderAxisLayer(); |
| 764 | |
| 765 | const QRectF outerRect(0, 0, width(), height()); |
| 766 | painter->fillRect(outerRect, m_outerBg); |
| 767 | |
| 768 | const QRectF& plotRect = m_cachedPlotRect; |
| 769 | if (plotRect.isEmpty()) |
| 770 | return; |
| 771 | |
| 772 | painter->fillRect(plotRect, m_innerBg); |
| 773 | |
| 774 | if (!m_image.isNull()) { |
| 775 | painter->save(); |
| 776 | painter->setClipRect(plotRect); |
| 777 | drawHistoryImage(painter, plotRect); |
| 778 | painter->restore(); |
| 779 | } |
| 780 | |
| 781 | if (!m_axisLayer.isNull()) |
| 782 | painter->drawImage(outerRect, m_axisLayer, QRectF(m_axisLayer.rect())); |
| 783 | |
| 784 | if (m_cursorEnabled && m_cursorHovering) |
| 785 | drawCursor(painter, plotRect); |
| 786 | } |
| 787 | |
| 788 | //-------------------------------------------------------------------------------------------------- |
| 789 | // Axis layer cache |