diff options
Diffstat (limited to 'src/waveform/renderers/waveformrendermarkrange.cpp')
-rw-r--r-- | src/waveform/renderers/waveformrendermarkrange.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/waveform/renderers/waveformrendermarkrange.cpp b/src/waveform/renderers/waveformrendermarkrange.cpp index ab0d8ec787..97a304b4ef 100644 --- a/src/waveform/renderers/waveformrendermarkrange.cpp +++ b/src/waveform/renderers/waveformrendermarkrange.cpp @@ -13,6 +13,7 @@ #include "waveform/renderers/waveformwidgetrenderer.h" #include "widget/wskincolor.h" #include "widget/wwidget.h" +#include "util/painterscope.h" WaveformRenderMarkRange::WaveformRenderMarkRange(WaveformWidgetRenderer* waveformWidgetRenderer) : WaveformRendererAbstract(waveformWidgetRenderer) { @@ -37,7 +38,7 @@ void WaveformRenderMarkRange::setup(const QDomNode& node, const SkinContext& con } void WaveformRenderMarkRange::draw(QPainter *painter, QPaintEvent * /*event*/) { - painter->save(); + PainterScope PainterScope(painter); painter->setWorldMatrixEnabled(false); @@ -45,14 +46,17 @@ void WaveformRenderMarkRange::draw(QPainter *painter, QPaintEvent * /*event*/) { generateImages(); } - for (unsigned int i = 0; i < m_markRanges.size(); i++) { - WaveformMarkRange& markRange = m_markRanges[i]; - + for (auto&& markRange: m_markRanges) { // If the mark range is not active we should not draw it. if (!markRange.active()) { continue; } + // If the mark range is not visible we should not draw it. + if (!markRange.visible()) { + continue; + } + // Active mark ranges by definition have starts/ends that are not // disabled so no need to check. int startSample = markRange.start(); @@ -79,13 +83,11 @@ void WaveformRenderMarkRange::draw(QPainter *painter, QPaintEvent * /*event*/) { } painter->drawImage(rect, *selectedImage, rect); } - - painter->restore(); } void WaveformRenderMarkRange::generateImages() { - for (unsigned int i = 0; i < m_markRanges.size(); i++) { - m_markRanges[i].generateImage(m_waveformRenderer->getWidth(), m_waveformRenderer->getHeight()); + for (auto&& markRange: m_markRanges) { + markRange.generateImage(m_waveformRenderer->getWidth(), m_waveformRenderer->getHeight()); } setDirty(false); } |