diff --git a/src/qml/qmlwaveformrenderer.cpp b/src/qml/qmlwaveformrenderer.cpp index 610264ec3d5..3aee771a97d 100644 --- a/src/qml/qmlwaveformrenderer.cpp +++ b/src/qml/qmlwaveformrenderer.cpp @@ -44,32 +44,36 @@ QmlWaveformRendererMark::QmlWaveformRendererMark() QmlWaveformRendererFactory::Renderer QmlWaveformRendererEndOfTrack::create( WaveformWidgetRenderer* waveformWidget) const { - auto* renderer = new WaveformRendererEndOfTrack(waveformWidget, m_color); + auto* renderer = new WaveformRendererEndOfTrack(waveformWidget); + renderer->setup(m_color); return QmlWaveformRendererFactory::Renderer{renderer, renderer}; } QmlWaveformRendererFactory::Renderer QmlWaveformRendererPreroll::create( WaveformWidgetRenderer* waveformWidget) const { auto* renderer = new WaveformRendererPreroll( - waveformWidget, WaveformRendererAbstract::Play, m_color); + waveformWidget, WaveformRendererAbstract::Play); + renderer->setup(m_color); return QmlWaveformRendererFactory::Renderer{renderer, renderer}; } QmlWaveformRendererFactory::Renderer QmlWaveformRendererRGB::create( WaveformWidgetRenderer* waveformWidget) const { auto* renderer = new WaveformRendererRGB(waveformWidget, + ::WaveformRendererAbstract::Play); + renderer->setup( m_axesColor, m_lowColor, m_midColor, - m_highColor, - ::WaveformRendererAbstract::Play); + m_highColor); return QmlWaveformRendererFactory::Renderer{renderer, renderer}; } QmlWaveformRendererFactory::Renderer QmlWaveformRendererBeat::create( WaveformWidgetRenderer* waveformWidget) const { auto* renderer = new WaveformRenderBeat( - waveformWidget, ::WaveformRendererAbstract::Play, m_color); + waveformWidget, ::WaveformRendererAbstract::Play); + renderer->setup(m_color); return QmlWaveformRendererFactory::Renderer{renderer, renderer}; } @@ -110,13 +114,14 @@ QmlWaveformRendererFactory::Renderer QmlWaveformRendererMark::create( return QmlWaveformRendererFactory::Renderer{}; } auto* renderer = new WaveformRenderMark(waveformWidget, + ::WaveformRendererAbstract::Play); + renderer->setup( m_playMarkerColor, m_playMarkerBackground, m_untilMark->showTime(), m_untilMark->showBeats(), static_cast(m_untilMark->align()), - m_untilMark->textSize(), - ::WaveformRendererAbstract::Play); + m_untilMark->textSize()); int priority = 0; for (auto* pMark : m_marks) { renderer->addMark(WaveformMarkPointer(new WaveformMark( diff --git a/src/waveform/renderers/allshader/waveformrenderbeat.cpp b/src/waveform/renderers/allshader/waveformrenderbeat.cpp index 2be51f23971..aa7de4ecfe5 100644 --- a/src/waveform/renderers/allshader/waveformrenderbeat.cpp +++ b/src/waveform/renderers/allshader/waveformrenderbeat.cpp @@ -15,11 +15,9 @@ using namespace rendergraph; namespace allshader { WaveformRenderBeat::WaveformRenderBeat(WaveformWidgetRenderer* waveformWidget, - ::WaveformRendererAbstract::PositionSource type, - QColor color) + ::WaveformRendererAbstract::PositionSource type) : ::WaveformRendererAbstract(waveformWidget), - m_isSlipRenderer(type == ::WaveformRendererAbstract::Slip), - m_color(color) { + m_isSlipRenderer(type == ::WaveformRendererAbstract::Slip) { initForRectangles(0); setUsePreprocess(true); } diff --git a/src/waveform/renderers/allshader/waveformrenderbeat.h b/src/waveform/renderers/allshader/waveformrenderbeat.h index 406dac2188e..2d572ccbdf1 100644 --- a/src/waveform/renderers/allshader/waveformrenderbeat.h +++ b/src/waveform/renderers/allshader/waveformrenderbeat.h @@ -20,14 +20,17 @@ class allshader::WaveformRenderBeat final public: explicit WaveformRenderBeat(WaveformWidgetRenderer* waveformWidget, ::WaveformRendererAbstract::PositionSource type = - ::WaveformRendererAbstract::Play, - QColor color = QColor()); + ::WaveformRendererAbstract::Play); // Pure virtual from WaveformRendererAbstract, not used void draw(QPainter* painter, QPaintEvent* event) override final; void setup(const QDomNode& node, const SkinContext& skinContext) override; + void setup(const QColor& color) { + m_color = color; + } + // Virtuals for rendergraph::Node void preprocess() override; diff --git a/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp b/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp index 953a01bb3d6..8ee649e2a2c 100644 --- a/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp +++ b/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp @@ -24,11 +24,10 @@ using namespace rendergraph; namespace allshader { WaveformRendererEndOfTrack::WaveformRendererEndOfTrack( - WaveformWidgetRenderer* waveformWidget, QColor color) + WaveformWidgetRenderer* waveformWidget) : ::WaveformRendererAbstract(waveformWidget), m_pEndOfTrackControl(nullptr), - m_pTimeRemainingControl(nullptr), - m_color(color) { + m_pTimeRemainingControl(nullptr) { initForRectangles(0); setUsePreprocess(true); } diff --git a/src/waveform/renderers/allshader/waveformrendererendoftrack.h b/src/waveform/renderers/allshader/waveformrendererendoftrack.h index 9ecb4a9d155..7a9b9583f95 100644 --- a/src/waveform/renderers/allshader/waveformrendererendoftrack.h +++ b/src/waveform/renderers/allshader/waveformrendererendoftrack.h @@ -22,13 +22,17 @@ class allshader::WaveformRendererEndOfTrack final public rendergraph::GeometryNode { public: explicit WaveformRendererEndOfTrack( - WaveformWidgetRenderer* waveformWidget, QColor color = QColor()); + WaveformWidgetRenderer* waveformWidge); // Pure virtual from WaveformRendererAbstract, not used void draw(QPainter* painter, QPaintEvent* event) override final; void setup(const QDomNode& node, const SkinContext& skinContext) override; + void setup(const QColor& color) { + m_color = color; + } + bool init() override; // Virtual for rendergraph::Node diff --git a/src/waveform/renderers/allshader/waveformrendererpreroll.cpp b/src/waveform/renderers/allshader/waveformrendererpreroll.cpp index a8ca7db4ae6..47caa6f3300 100644 --- a/src/waveform/renderers/allshader/waveformrendererpreroll.cpp +++ b/src/waveform/renderers/allshader/waveformrendererpreroll.cpp @@ -64,10 +64,8 @@ namespace allshader { WaveformRendererPreroll::WaveformRendererPreroll( WaveformWidgetRenderer* waveformWidget, - ::WaveformRendererAbstract::PositionSource type, - QColor color) + ::WaveformRendererAbstract::PositionSource type) : ::WaveformRendererAbstract(waveformWidget), - m_color(color), m_isSlipRenderer(type == ::WaveformRendererAbstract::Slip) { setGeometry(std::make_unique(PatternMaterial::attributes(), 0)); setMaterial(std::make_unique()); diff --git a/src/waveform/renderers/allshader/waveformrendererpreroll.h b/src/waveform/renderers/allshader/waveformrendererpreroll.h index 24af49a457d..970f81c7262 100644 --- a/src/waveform/renderers/allshader/waveformrendererpreroll.h +++ b/src/waveform/renderers/allshader/waveformrendererpreroll.h @@ -21,8 +21,7 @@ class allshader::WaveformRendererPreroll final explicit WaveformRendererPreroll( WaveformWidgetRenderer* waveformWidget, ::WaveformRendererAbstract::PositionSource type = - ::WaveformRendererAbstract::Play, - QColor color = QColor(200, 25, 20)); + ::WaveformRendererAbstract::Play); ~WaveformRendererPreroll() override; // Pure virtual from WaveformRendererAbstract, not used @@ -30,6 +29,10 @@ class allshader::WaveformRendererPreroll final void setup(const QDomNode& node, const SkinContext& skinContext) override; + void setup(const QColor& color) { + m_color = color; + } + // Virtual for rendergraph::Node void preprocess() override; diff --git a/src/waveform/renderers/allshader/waveformrendererrgb.cpp b/src/waveform/renderers/allshader/waveformrendererrgb.cpp index 2d0765d368d..ec173619eab 100644 --- a/src/waveform/renderers/allshader/waveformrendererrgb.cpp +++ b/src/waveform/renderers/allshader/waveformrendererrgb.cpp @@ -18,26 +18,24 @@ inline float math_pow2(float x) { } // namespace WaveformRendererRGB::WaveformRendererRGB(WaveformWidgetRenderer* waveformWidget, -#ifdef __RENDERGRAPH_IS_SCENEGRAPH - QColor axesColor, - QColor lowColor, - QColor midColor, - QColor highColor, -#endif ::WaveformRendererAbstract::PositionSource type, WaveformRendererSignalBase::Options options) : WaveformRendererSignalBase(waveformWidget), m_isSlipRenderer(type == ::WaveformRendererAbstract::Slip), m_options(options) { -#ifdef __RENDERGRAPH_IS_SCENEGRAPH + initForRectangles(0); + setUsePreprocess(true); +} + +void WaveformRendererRGB::setup(const QColor& axesColor, + const QColor& lowColor, + const QColor& midColor, + const QColor& highColor) { getRgbF(axesColor, &m_axesColor_r, &m_axesColor_g, &m_axesColor_b, &m_axesColor_a); getRgbF(lowColor, &m_rgbLowColor_r, &m_rgbLowColor_g, &m_rgbLowColor_b); getRgbF(midColor, &m_rgbMidColor_r, &m_rgbMidColor_g, &m_rgbMidColor_b); getRgbF(highColor, &m_rgbHighColor_r, &m_rgbHighColor_g, &m_rgbHighColor_b); -#endif - initForRectangles(0); - setUsePreprocess(true); } void WaveformRendererRGB::onSetup(const QDomNode& node) { diff --git a/src/waveform/renderers/allshader/waveformrendererrgb.h b/src/waveform/renderers/allshader/waveformrendererrgb.h index ed44f3fbfad..6e634d4de0c 100644 --- a/src/waveform/renderers/allshader/waveformrendererrgb.h +++ b/src/waveform/renderers/allshader/waveformrendererrgb.h @@ -14,12 +14,6 @@ class allshader::WaveformRendererRGB final public rendergraph::GeometryNode { public: explicit WaveformRendererRGB(WaveformWidgetRenderer* waveformWidget, -#ifdef __RENDERGRAPH_IS_SCENEGRAPH - QColor axesColor, - QColor lowColor, - QColor midColor, - QColor highColor, -#endif ::WaveformRendererAbstract::PositionSource type = ::WaveformRendererAbstract::Play, WaveformRendererSignalBase::Options options = WaveformRendererSignalBase::Option::None); @@ -27,6 +21,11 @@ class allshader::WaveformRendererRGB final // Pure virtual from WaveformRendererSignalBase, not used void onSetup(const QDomNode& node) override; + void setup(const QColor& axesColor, + const QColor& lowColor, + const QColor& midColor, + const QColor& highColor); + bool supportsSlip() const override { return true; } diff --git a/src/waveform/renderers/allshader/waveformrendermark.cpp b/src/waveform/renderers/allshader/waveformrendermark.cpp index 38b29241ef6..fd63241d6ac 100644 --- a/src/waveform/renderers/allshader/waveformrendermark.cpp +++ b/src/waveform/renderers/allshader/waveformrendermark.cpp @@ -145,27 +145,11 @@ QString timeSecToString(double timeSec) { allshader::WaveformRenderMark::WaveformRenderMark( WaveformWidgetRenderer* waveformWidget, -#ifdef __RENDERGRAPH_IS_SCENEGRAPH - QColor fgPlayColor, - QColor bgPlayColor, - bool untilMarkShowBeats, - bool untilMarkShowTime, - Qt::Alignment untilMarkAlign, - int untilMarkTextSize, -#endif ::WaveformRendererAbstract::PositionSource type) : ::WaveformRenderMarkBase(waveformWidget, false), m_beatsUntilMark(0), m_timeUntilMark(0.0), m_pTimeRemainingControl(nullptr), -#ifdef __RENDERGRAPH_IS_SCENEGRAPH - m_fgPlayColor(fgPlayColor), - m_bgPlayColor(bgPlayColor), - m_untilMarkShowBeats(untilMarkShowBeats), - m_untilMarkShowTime(untilMarkShowTime), - m_untilMarkAlign(untilMarkAlign), - m_untilMarkTextSize(untilMarkTextSize), -#endif m_isSlipRenderer(type == ::WaveformRendererAbstract::Slip), m_playPosHeight(0.f), m_playPosDevicePixelRatio(0.f) { @@ -195,6 +179,19 @@ allshader::WaveformRenderMark::WaveformRenderMark( } } +void allshader::WaveformRenderMark::setup(const QColor& fgPlayColor, + const QColor& bgPlayColor, + bool untilMarkShowBeats, + bool untilMarkShowTime, + Qt::Alignment untilMarkAlign, + int untilMarkTextSize) { + m_fgPlayColor = fgPlayColor; + m_bgPlayColor = bgPlayColor; + m_untilMarkShowBeats = untilMarkShowBeats; + m_untilMarkShowTime = untilMarkShowTime; + m_untilMarkAlign = untilMarkAlign; + m_untilMarkTextSize = untilMarkTextSize; +} void allshader::WaveformRenderMark::draw(QPainter* painter, QPaintEvent* event) { Q_UNUSED(painter); Q_UNUSED(event); diff --git a/src/waveform/renderers/allshader/waveformrendermark.h b/src/waveform/renderers/allshader/waveformrendermark.h index 2f3e080907f..3a8730f5125 100644 --- a/src/waveform/renderers/allshader/waveformrendermark.h +++ b/src/waveform/renderers/allshader/waveformrendermark.h @@ -22,20 +22,19 @@ class allshader::WaveformRenderMark : public ::WaveformRenderMarkBase, public rendergraph::Node { public: explicit WaveformRenderMark(WaveformWidgetRenderer* waveformWidget, -#ifdef __RENDERGRAPH_IS_SCENEGRAPH - QColor fgPlayColor, - QColor bgPlayColor, - bool untilMarkShowBeats, - bool untilMarkShowTime, - Qt::Alignment untilMarkAlign, - int untilMarkTextSize, -#endif ::WaveformRendererAbstract::PositionSource type = ::WaveformRendererAbstract::Play); // Pure virtual from WaveformRendererAbstract, not used void draw(QPainter* painter, QPaintEvent* event) override final; + void setup(const QColor& fgPlayColor, + const QColor& bgPlayColor, + bool untilMarkShowBeats, + bool untilMarkShowTime, + Qt::Alignment untilMarkAlign, + int untilMarkTextSize); + bool init() override; void update();