diff --git a/CMakeLists.txt b/CMakeLists.txt index b85baecf6c39..1a58e2bf09a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1154,19 +1154,19 @@ else() src/widget/wglwidgetqopengl.cpp src/widget/qopengl/wvumetergl.cpp src/widget/qopengl/wspinny.cpp - src/waveform/renderers/qopengl/waveformrenderbackground.cpp - src/waveform/renderers/qopengl/waveformrenderbeat.cpp - src/waveform/renderers/qopengl/waveformrenderer.cpp - src/waveform/renderers/qopengl/waveformrendererendoftrack.cpp - src/waveform/renderers/qopengl/waveformrendererpreroll.cpp - src/waveform/renderers/qopengl/waveformrendererrgb.cpp - src/waveform/renderers/qopengl/waveformrenderersignalbase.cpp - src/waveform/renderers/qopengl/waveformrendermark.cpp - src/waveform/renderers/qopengl/waveformrendermarkrange.cpp - src/waveform/widgets/qopengl/waveformwidget.cpp - src/waveform/widgets/qopengl/rgbwaveformwidget.cpp - src/waveform/widgets/qopengl/waveformwidget.cpp - src/waveform/widgets/qopengl/rgbwaveformwidget.cpp + src/waveform/renderers/qopengl/oglwaveformrenderbackground.cpp + src/waveform/renderers/qopengl/oglwaveformrenderbeat.cpp + src/waveform/renderers/qopengl/oglwaveformrenderer.cpp + src/waveform/renderers/qopengl/oglwaveformrendererendoftrack.cpp + src/waveform/renderers/qopengl/oglwaveformrendererpreroll.cpp + src/waveform/renderers/qopengl/oglwaveformrendererrgb.cpp + src/waveform/renderers/qopengl/oglwaveformrenderersignalbase.cpp + src/waveform/renderers/qopengl/oglwaveformrendermark.cpp + src/waveform/renderers/qopengl/oglwaveformrendermarkrange.cpp + src/waveform/widgets/qopengl/oglwaveformwidget.cpp + src/waveform/widgets/qopengl/oglrgbwaveformwidget.cpp + src/waveform/widgets/qopengl/oglwaveformwidget.cpp + src/waveform/widgets/qopengl/oglrgbwaveformwidget.cpp ) else() target_sources(mixxx-lib PRIVATE diff --git a/src/waveform/renderers/qopengl/fixedpointcalc.h b/src/waveform/renderers/qopengl/fixedpointcalc.h index 25e36e60ba04..b60568b23aa8 100644 --- a/src/waveform/renderers/qopengl/fixedpointcalc.h +++ b/src/waveform/renderers/qopengl/fixedpointcalc.h @@ -1,4 +1,4 @@ -/// functions to do fixed point calculations, used by qopengl::WaveformRendererRGB +/// functions to do fixed point calculations, used by OGLWaveformRendererRGB // float to fixed point with 8 fractional bits, clipped at 4.0 inline uint32_t toFrac8(float x) { diff --git a/src/waveform/renderers/qopengl/iwaveformrenderer.h b/src/waveform/renderers/qopengl/ioglwaveformrenderer.h similarity index 67% rename from src/waveform/renderers/qopengl/iwaveformrenderer.h rename to src/waveform/renderers/qopengl/ioglwaveformrenderer.h index 5fd380a18ab1..3e6edd91feea 100644 --- a/src/waveform/renderers/qopengl/iwaveformrenderer.h +++ b/src/waveform/renderers/qopengl/ioglwaveformrenderer.h @@ -4,11 +4,7 @@ /// Interface for QOpenGL-based waveform renderers -namespace qopengl { -class IWaveformRenderer; -} - -class qopengl::IWaveformRenderer : public QOpenGLFunctions { +class IOGLWaveformRenderer : public QOpenGLFunctions { public: virtual void initializeGL() { } diff --git a/src/waveform/renderers/qopengl/waveformrenderbackground.cpp b/src/waveform/renderers/qopengl/oglwaveformrenderbackground.cpp similarity index 83% rename from src/waveform/renderers/qopengl/waveformrenderbackground.cpp rename to src/waveform/renderers/qopengl/oglwaveformrenderbackground.cpp index e965e6e4dd01..875a57fbf32d 100644 --- a/src/waveform/renderers/qopengl/waveformrenderbackground.cpp +++ b/src/waveform/renderers/qopengl/oglwaveformrenderbackground.cpp @@ -1,22 +1,20 @@ -#include "waveform/renderers/qopengl/waveformrenderbackground.h" +#include "waveform/renderers/qopengl/oglwaveformrenderbackground.h" #include "waveform/renderers/waveformwidgetrenderer.h" #include "widget/wimagestore.h" #include "widget/wskincolor.h" #include "widget/wwidget.h" -using namespace qopengl; - -WaveformRenderBackground::WaveformRenderBackground( +OGLWaveformRenderBackground::OGLWaveformRenderBackground( WaveformWidgetRenderer* waveformWidgetRenderer) - : WaveformRenderer(waveformWidgetRenderer), + : OGLWaveformRenderer(waveformWidgetRenderer), m_backgroundColor(0, 0, 0) { } -WaveformRenderBackground::~WaveformRenderBackground() { +OGLWaveformRenderBackground::~OGLWaveformRenderBackground() { } -void WaveformRenderBackground::setup(const QDomNode& node, +void OGLWaveformRenderBackground::setup(const QDomNode& node, const SkinContext& context) { m_backgroundColor = m_waveformRenderer->getWaveformSignalColors()->getBgColor(); QString backgroundPixmapPath = context.selectString(node, "BgPixmap"); @@ -26,7 +24,7 @@ void WaveformRenderBackground::setup(const QDomNode& node, setDirty(true); } -void WaveformRenderBackground::renderGL() { +void OGLWaveformRenderBackground::renderGL() { if (isDirty()) { // TODO @m0dB // generateImage(); @@ -46,7 +44,7 @@ void WaveformRenderBackground::renderGL() { //painter->drawImage(QPoint(0, 0), m_backgroundImage); } -void WaveformRenderBackground::generateImage() { +void OGLWaveformRenderBackground::generateImage() { m_backgroundImage = QImage(); if (!m_backgroundPixmapPath.isEmpty()) { QImage backgroundImage = *WImageStore::getImage( diff --git a/src/waveform/renderers/qopengl/oglwaveformrenderbackground.h b/src/waveform/renderers/qopengl/oglwaveformrenderbackground.h new file mode 100644 index 000000000000..96131ab28659 --- /dev/null +++ b/src/waveform/renderers/qopengl/oglwaveformrenderbackground.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include + +#include "util/class.h" +#include "waveform/renderers/qopengl/oglwaveformrenderer.h" + +class QDomNode; +class SkinContext; + +class OGLWaveformRenderBackground : public OGLWaveformRenderer { + public: + explicit OGLWaveformRenderBackground(WaveformWidgetRenderer* waveformWidgetRenderer); + ~OGLWaveformRenderBackground() override; + + void setup(const QDomNode& node, const SkinContext& context) override; + void renderGL() override; + + private: + void generateImage(); + + QString m_backgroundPixmapPath; + QColor m_backgroundColor; + QImage m_backgroundImage; + + DISALLOW_COPY_AND_ASSIGN(OGLWaveformRenderBackground); +}; diff --git a/src/waveform/renderers/qopengl/waveformrenderbeat.cpp b/src/waveform/renderers/qopengl/oglwaveformrenderbeat.cpp similarity index 89% rename from src/waveform/renderers/qopengl/waveformrenderbeat.cpp rename to src/waveform/renderers/qopengl/oglwaveformrenderbeat.cpp index 4fec0402edae..e7c13b32f168 100644 --- a/src/waveform/renderers/qopengl/waveformrenderbeat.cpp +++ b/src/waveform/renderers/qopengl/oglwaveformrenderbeat.cpp @@ -1,25 +1,23 @@ -#include "waveform/renderers/qopengl/waveformrenderbeat.h" +#include "waveform/renderers/qopengl/oglwaveformrenderbeat.h" #include #include "control/controlobject.h" #include "skin/legacy/skincontext.h" #include "track/track.h" -#include "waveform/widgets/qopengl/waveformwidget.h" +#include "waveform/widgets/qopengl/oglwaveformwidget.h" #include "widget/wskincolor.h" #include "widget/wwidget.h" -using namespace qopengl; - -WaveformRenderBeat::WaveformRenderBeat(WaveformWidgetRenderer* waveformWidget) - : WaveformRenderer(waveformWidget) { +OGLWaveformRenderBeat::OGLWaveformRenderBeat(WaveformWidgetRenderer* waveformWidget) + : OGLWaveformRenderer(waveformWidget) { m_beatLineVertices.resize(1024); } -WaveformRenderBeat::~WaveformRenderBeat() { +OGLWaveformRenderBeat::~OGLWaveformRenderBeat() { } -void WaveformRenderBeat::initializeGL() { +void OGLWaveformRenderBeat::initializeGL() { QString vertexShaderCode = "\ uniform mat4 matrix;\n\ @@ -54,12 +52,12 @@ void main()\n\ } } -void WaveformRenderBeat::setup(const QDomNode& node, const SkinContext& context) { +void OGLWaveformRenderBeat::setup(const QDomNode& node, const SkinContext& context) { m_beatColor.setNamedColor(context.selectString(node, "BeatColor")); m_beatColor = WSkinColor::getCorrectColor(m_beatColor).toRgb(); } -void WaveformRenderBeat::renderGL() { +void OGLWaveformRenderBeat::renderGL() { TrackPointer trackInfo = m_waveformRenderer->getTrackInfo(); if (!trackInfo) { diff --git a/src/waveform/renderers/qopengl/waveformrenderbeat.h b/src/waveform/renderers/qopengl/oglwaveformrenderbeat.h similarity index 54% rename from src/waveform/renderers/qopengl/waveformrenderbeat.h rename to src/waveform/renderers/qopengl/oglwaveformrenderbeat.h index f84ab9832fdc..00e8fb2b7947 100644 --- a/src/waveform/renderers/qopengl/waveformrenderbeat.h +++ b/src/waveform/renderers/qopengl/oglwaveformrenderbeat.h @@ -4,19 +4,15 @@ #include #include "util/class.h" -#include "waveform/renderers/qopengl/waveformrenderer.h" +#include "waveform/renderers/qopengl/oglwaveformrenderer.h" class QDomNode; class SkinContext; -namespace qopengl { -class WaveformRenderBeat; -} - -class qopengl::WaveformRenderBeat : public qopengl::WaveformRenderer { +class OGLWaveformRenderBeat : public OGLWaveformRenderer { public: - explicit WaveformRenderBeat(WaveformWidgetRenderer* waveformWidget); - ~WaveformRenderBeat() override; + explicit OGLWaveformRenderBeat(WaveformWidgetRenderer* waveformWidget); + ~OGLWaveformRenderBeat() override; void setup(const QDomNode& node, const SkinContext& context) override; void renderGL() override; @@ -27,5 +23,5 @@ class qopengl::WaveformRenderBeat : public qopengl::WaveformRenderer { QVector m_beatLineVertices; QOpenGLShaderProgram m_shaderProgram; - DISALLOW_COPY_AND_ASSIGN(WaveformRenderBeat); + DISALLOW_COPY_AND_ASSIGN(OGLWaveformRenderBeat); }; diff --git a/src/waveform/renderers/qopengl/oglwaveformrenderer.cpp b/src/waveform/renderers/qopengl/oglwaveformrenderer.cpp new file mode 100644 index 000000000000..136c10bf7ac5 --- /dev/null +++ b/src/waveform/renderers/qopengl/oglwaveformrenderer.cpp @@ -0,0 +1,9 @@ +#include "waveform/renderers/qopengl/oglwaveformrenderer.h" + +#include "waveform/widgets/qopengl/oglwaveformwidget.h" + +OGLWaveformRenderer::OGLWaveformRenderer(WaveformWidgetRenderer* widget) + : WaveformRendererAbstract(widget) { +} + +OGLWaveformRenderer::~OGLWaveformRenderer() = default; diff --git a/src/waveform/renderers/qopengl/oglwaveformrenderer.h b/src/waveform/renderers/qopengl/oglwaveformrenderer.h new file mode 100644 index 000000000000..45be2ddc40cd --- /dev/null +++ b/src/waveform/renderers/qopengl/oglwaveformrenderer.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +#include "waveform/renderers/qopengl/ioglwaveformrenderer.h" +#include "waveform/renderers/waveformrendererabstract.h" + +class WaveformWidgetRenderer; + +class OGLWaveformRenderer : public WaveformRendererAbstract, public IOGLWaveformRenderer { + public: + explicit OGLWaveformRenderer(WaveformWidgetRenderer* widget); + ~OGLWaveformRenderer(); + + void draw(QPainter* painter, QPaintEvent* event) override { + } + + IOGLWaveformRenderer* qopenglWaveformRenderer() override { + return this; + } +}; diff --git a/src/waveform/renderers/qopengl/waveformrendererendoftrack.cpp b/src/waveform/renderers/qopengl/oglwaveformrendererendoftrack.cpp similarity index 84% rename from src/waveform/renderers/qopengl/waveformrendererendoftrack.cpp rename to src/waveform/renderers/qopengl/oglwaveformrendererendoftrack.cpp index 2caf59827ec5..02f4b018f901 100644 --- a/src/waveform/renderers/qopengl/waveformrendererendoftrack.cpp +++ b/src/waveform/renderers/qopengl/oglwaveformrendererendoftrack.cpp @@ -1,4 +1,4 @@ -#include "waveform/renderers/qopengl/waveformrendererendoftrack.h" +#include "waveform/renderers/qopengl/oglwaveformrendererendoftrack.h" #include #include @@ -8,7 +8,7 @@ #include "control/controlproxy.h" #include "util/timer.h" #include "waveform/waveformwidgetfactory.h" -#include "waveform/widgets/qopengl/waveformwidget.h" +#include "waveform/widgets/qopengl/oglwaveformwidget.h" #include "widget/wskincolor.h" #include "widget/wwidget.h" @@ -18,21 +18,19 @@ constexpr int kBlinkingPeriodMillis = 1000; } // anonymous namespace -using namespace qopengl; - -WaveformRendererEndOfTrack::WaveformRendererEndOfTrack( +OGLWaveformRendererEndOfTrack::OGLWaveformRendererEndOfTrack( WaveformWidgetRenderer* waveformWidget) - : WaveformRenderer(waveformWidget), + : OGLWaveformRenderer(waveformWidget), m_pEndOfTrackControl(nullptr), m_pTimeRemainingControl(nullptr) { } -WaveformRendererEndOfTrack::~WaveformRendererEndOfTrack() { +OGLWaveformRendererEndOfTrack::~OGLWaveformRendererEndOfTrack() { delete m_pEndOfTrackControl; delete m_pTimeRemainingControl; } -bool WaveformRendererEndOfTrack::init() { +bool OGLWaveformRendererEndOfTrack::init() { m_timer.restart(); m_pEndOfTrackControl = new ControlProxy( @@ -42,7 +40,7 @@ bool WaveformRendererEndOfTrack::init() { return true; } -void WaveformRendererEndOfTrack::setup(const QDomNode& node, const SkinContext& context) { +void OGLWaveformRendererEndOfTrack::setup(const QDomNode& node, const SkinContext& context) { m_color = QColor(200, 25, 20); const QString endOfTrackColorName = context.selectString(node, "EndOfTrackColor"); if (!endOfTrackColorName.isNull()) { @@ -52,7 +50,7 @@ void WaveformRendererEndOfTrack::setup(const QDomNode& node, const SkinContext& //m_pen = QPen(QBrush(m_color), 2.5 * scaleFactor()); } -void WaveformRendererEndOfTrack::initializeGL() { +void OGLWaveformRendererEndOfTrack::initializeGL() { QString vertexShaderCode = "\ uniform mat4 matrix;\n\ @@ -91,7 +89,7 @@ void main()\n\ } } -void WaveformRendererEndOfTrack::fillWithGradient(QColor color) { +void OGLWaveformRendererEndOfTrack::fillWithGradient(QColor color) { const float posarray[] = {-1.f, -1.f, 1.f, -1.f, -1.f, 1.f, 1.f, 1.f}; m_shaderProgram.bind(); @@ -108,7 +106,7 @@ void WaveformRendererEndOfTrack::fillWithGradient(QColor color) { glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } -void WaveformRendererEndOfTrack::renderGL() { +void OGLWaveformRendererEndOfTrack::renderGL() { if (!m_pEndOfTrackControl->toBool()) { return; } diff --git a/src/waveform/renderers/qopengl/waveformrendererendoftrack.h b/src/waveform/renderers/qopengl/oglwaveformrendererendoftrack.h similarity index 67% rename from src/waveform/renderers/qopengl/waveformrendererendoftrack.h rename to src/waveform/renderers/qopengl/oglwaveformrendererendoftrack.h index 942e675a334c..28eea5c5bf35 100644 --- a/src/waveform/renderers/qopengl/waveformrendererendoftrack.h +++ b/src/waveform/renderers/qopengl/oglwaveformrendererendoftrack.h @@ -6,22 +6,18 @@ #include "util/class.h" #include "util/performancetimer.h" -#include "waveform/renderers/qopengl/waveformrenderer.h" +#include "waveform/renderers/qopengl/oglwaveformrenderer.h" class ControlObject; class ControlProxy; class QDomNode; class SkinContext; -namespace qopengl { -class WaveformRendererEndOfTrack; -} - -class qopengl::WaveformRendererEndOfTrack : public qopengl::WaveformRenderer { +class OGLWaveformRendererEndOfTrack : public OGLWaveformRenderer { public: - explicit WaveformRendererEndOfTrack( + explicit OGLWaveformRendererEndOfTrack( WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererEndOfTrack() override; + ~OGLWaveformRendererEndOfTrack() override; void setup(const QDomNode& node, const SkinContext& context) override; @@ -40,5 +36,5 @@ class qopengl::WaveformRendererEndOfTrack : public qopengl::WaveformRenderer { QColor m_color; PerformanceTimer m_timer; - DISALLOW_COPY_AND_ASSIGN(WaveformRendererEndOfTrack); + DISALLOW_COPY_AND_ASSIGN(OGLWaveformRendererEndOfTrack); }; diff --git a/src/waveform/renderers/qopengl/waveformrendererpreroll.cpp b/src/waveform/renderers/qopengl/oglwaveformrendererpreroll.cpp similarity index 92% rename from src/waveform/renderers/qopengl/waveformrendererpreroll.cpp rename to src/waveform/renderers/qopengl/oglwaveformrendererpreroll.cpp index d390696bb9a3..9b7349804ec1 100644 --- a/src/waveform/renderers/qopengl/waveformrendererpreroll.cpp +++ b/src/waveform/renderers/qopengl/oglwaveformrendererpreroll.cpp @@ -1,4 +1,4 @@ -#include "waveform/renderers/qopengl/waveformrendererpreroll.h" +#include "waveform/renderers/qopengl/oglwaveformrendererpreroll.h" #include @@ -8,23 +8,21 @@ #include "widget/wskincolor.h" #include "widget/wwidget.h" -using namespace qopengl; - -WaveformRendererPreroll::WaveformRendererPreroll(WaveformWidgetRenderer* waveformWidget) - : WaveformRenderer(waveformWidget) { +OGLWaveformRendererPreroll::OGLWaveformRendererPreroll(WaveformWidgetRenderer* waveformWidget) + : OGLWaveformRenderer(waveformWidget) { m_vertices.resize(1024); } -WaveformRendererPreroll::~WaveformRendererPreroll() { +OGLWaveformRendererPreroll::~OGLWaveformRendererPreroll() { } -void WaveformRendererPreroll::setup( +void OGLWaveformRendererPreroll::setup( const QDomNode& node, const SkinContext& context) { m_color.setNamedColor(context.selectString(node, "SignalColor")); m_color = WSkinColor::getCorrectColor(m_color); } -void WaveformRendererPreroll::initializeGL() { +void OGLWaveformRendererPreroll::initializeGL() { QString vertexShaderCode = "\ uniform mat4 matrix;\n\ @@ -59,7 +57,7 @@ void main()\n\ } } -void WaveformRendererPreroll::renderGL() { +void OGLWaveformRendererPreroll::renderGL() { const TrackPointer track = m_waveformRenderer->getTrackInfo(); if (!track) { return; @@ -85,7 +83,7 @@ void WaveformRendererPreroll::renderGL() { // << "vSamplesPerPixel" << vSamplesPerPixel // << "numberOfVSamples" << numberOfVSamples // << "totalVSamples" << totalVSamples - // << "WaveformRendererPreroll::playMarkerPosition=" << playMarkerPositionFrac; + // << "OGLWaveformRendererPreroll::playMarkerPosition=" << playMarkerPositionFrac; const float halfBreadth = m_waveformRenderer->getBreadth() / 2.0f; const float halfPolyBreadth = m_waveformRenderer->getBreadth() / 5.0f; diff --git a/src/waveform/renderers/qopengl/waveformrendererpreroll.h b/src/waveform/renderers/qopengl/oglwaveformrendererpreroll.h similarity index 51% rename from src/waveform/renderers/qopengl/waveformrendererpreroll.h rename to src/waveform/renderers/qopengl/oglwaveformrendererpreroll.h index ce0317b1fd84..dbc703deb57a 100644 --- a/src/waveform/renderers/qopengl/waveformrendererpreroll.h +++ b/src/waveform/renderers/qopengl/oglwaveformrendererpreroll.h @@ -4,19 +4,15 @@ #include #include "util/class.h" -#include "waveform/renderers/qopengl/waveformrenderer.h" +#include "waveform/renderers/qopengl/oglwaveformrenderer.h" class QDomNode; class SkinContext; -namespace qopengl { -class WaveformRendererPreroll; -} - -class qopengl::WaveformRendererPreroll : public qopengl::WaveformRenderer { +class OGLWaveformRendererPreroll : public OGLWaveformRenderer { public: - explicit WaveformRendererPreroll(WaveformWidgetRenderer* waveformWidgetRenderer); - ~WaveformRendererPreroll() override; + explicit OGLWaveformRendererPreroll(WaveformWidgetRenderer* waveformWidgetRenderer); + ~OGLWaveformRendererPreroll() override; void setup(const QDomNode& node, const SkinContext& context) override; void renderGL() override; @@ -27,5 +23,5 @@ class qopengl::WaveformRendererPreroll : public qopengl::WaveformRenderer { QVector m_vertices; QOpenGLShaderProgram m_shaderProgram; - DISALLOW_COPY_AND_ASSIGN(WaveformRendererPreroll); + DISALLOW_COPY_AND_ASSIGN(OGLWaveformRendererPreroll); }; diff --git a/src/waveform/renderers/qopengl/waveformrendererrgb.cpp b/src/waveform/renderers/qopengl/oglwaveformrendererrgb.cpp similarity index 95% rename from src/waveform/renderers/qopengl/waveformrendererrgb.cpp rename to src/waveform/renderers/qopengl/oglwaveformrendererrgb.cpp index 67348f3d635f..3ee2dc70fbcb 100644 --- a/src/waveform/renderers/qopengl/waveformrendererrgb.cpp +++ b/src/waveform/renderers/qopengl/oglwaveformrendererrgb.cpp @@ -1,29 +1,27 @@ -#include "waveform/renderers/qopengl/waveformrendererrgb.h" +#include "waveform/renderers/qopengl/oglwaveformrendererrgb.h" #include "fixedpointcalc.h" #include "track/track.h" #include "util/math.h" #include "waveform/waveform.h" #include "waveform/waveformwidgetfactory.h" -#include "waveform/widgets/qopengl/waveformwidget.h" +#include "waveform/widgets/qopengl/oglwaveformwidget.h" #include "widget/wskincolor.h" #include "widget/wwidget.h" -using namespace qopengl; - -WaveformRendererRGB::WaveformRendererRGB( +OGLWaveformRendererRGB::OGLWaveformRendererRGB( WaveformWidgetRenderer* waveformWidget) - : WaveformRendererSignalBase(waveformWidget) { + : OGLWaveformRendererSignalBase(waveformWidget) { } -WaveformRendererRGB::~WaveformRendererRGB() { +OGLWaveformRendererRGB::~OGLWaveformRendererRGB() { } -void WaveformRendererRGB::onSetup(const QDomNode& node) { +void OGLWaveformRendererRGB::onSetup(const QDomNode& node) { Q_UNUSED(node); } -void WaveformRendererRGB::initializeGL() { +void OGLWaveformRendererRGB::initializeGL() { QString vertexShaderCode = "\ uniform mat4 matrix;\n\ @@ -61,7 +59,7 @@ void main()\n\ } } -inline void WaveformRendererRGB::addRectangle( +inline void OGLWaveformRendererRGB::addRectangle( float x1, float y1, float x2, @@ -94,7 +92,7 @@ inline void WaveformRendererRGB::addRectangle( } } -void WaveformRendererRGB::renderGL() { +void OGLWaveformRendererRGB::renderGL() { // The source of our data are uint8_t values (waveformData.filtered.low/mid/high). // We can avoid type conversion by calculating the values needed for drawing // using fixed point. Since the range of the intermediate values is limited, we diff --git a/src/waveform/renderers/qopengl/waveformrendererrgb.h b/src/waveform/renderers/qopengl/oglwaveformrendererrgb.h similarity index 56% rename from src/waveform/renderers/qopengl/waveformrendererrgb.h rename to src/waveform/renderers/qopengl/oglwaveformrendererrgb.h index f187e8d4a68b..f0389bfc6056 100644 --- a/src/waveform/renderers/qopengl/waveformrendererrgb.h +++ b/src/waveform/renderers/qopengl/oglwaveformrendererrgb.h @@ -2,16 +2,12 @@ #include -#include "waveform/renderers/qopengl/waveformrenderersignalbase.h" +#include "waveform/renderers/qopengl/oglwaveformrenderersignalbase.h" -namespace qopengl { -class WaveformRendererRGB; -} - -class qopengl::WaveformRendererRGB : public qopengl::WaveformRendererSignalBase { +class OGLWaveformRendererRGB : public OGLWaveformRendererSignalBase { public: - explicit WaveformRendererRGB(WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererRGB() override; + explicit OGLWaveformRendererRGB(WaveformWidgetRenderer* waveformWidget); + ~OGLWaveformRendererRGB() override; // override ::WaveformRendererSignalBase void onSetup(const QDomNode& node) override; @@ -30,5 +26,5 @@ class qopengl::WaveformRendererRGB : public qopengl::WaveformRendererSignalBase void addRectangle(float x1, float y1, float x2, float y2, float r, float g, float b); - DISALLOW_COPY_AND_ASSIGN(WaveformRendererRGB); + DISALLOW_COPY_AND_ASSIGN(OGLWaveformRendererRGB); }; diff --git a/src/waveform/renderers/qopengl/oglwaveformrenderersignalbase.cpp b/src/waveform/renderers/qopengl/oglwaveformrenderersignalbase.cpp new file mode 100644 index 000000000000..1918bef227b7 --- /dev/null +++ b/src/waveform/renderers/qopengl/oglwaveformrenderersignalbase.cpp @@ -0,0 +1,8 @@ +#include "waveform/renderers/qopengl/oglwaveformrenderersignalbase.h" + +#include "waveform/widgets/qopengl/oglwaveformwidget.h" + +OGLWaveformRendererSignalBase::OGLWaveformRendererSignalBase( + WaveformWidgetRenderer* waveformWidget) + : WaveformRendererSignalBase(waveformWidget) { +} diff --git a/src/waveform/renderers/qopengl/oglwaveformrenderersignalbase.h b/src/waveform/renderers/qopengl/oglwaveformrenderersignalbase.h new file mode 100644 index 000000000000..2addb159be92 --- /dev/null +++ b/src/waveform/renderers/qopengl/oglwaveformrenderersignalbase.h @@ -0,0 +1,22 @@ +#pragma once + +#include "waveform/renderers/qopengl/ioglwaveformrenderer.h" +#include "waveform/renderers/waveformrenderersignalbase.h" + +class WaveformWidgetRenderer; + +class OGLWaveformRendererSignalBase : public ::WaveformRendererSignalBase, + public IOGLWaveformRenderer { + public: + explicit OGLWaveformRendererSignalBase(WaveformWidgetRenderer* waveformWidget); + ~OGLWaveformRendererSignalBase() override = default; + + void draw(QPainter* painter, QPaintEvent* event) override { + } + + IOGLWaveformRenderer* qopenglWaveformRenderer() override { + return this; + } + + DISALLOW_COPY_AND_ASSIGN(OGLWaveformRendererSignalBase); +}; diff --git a/src/waveform/renderers/qopengl/waveformrendermark.cpp b/src/waveform/renderers/qopengl/oglwaveformrendermark.cpp similarity index 95% rename from src/waveform/renderers/qopengl/waveformrendermark.cpp rename to src/waveform/renderers/qopengl/oglwaveformrendermark.cpp index 515b9e6d485a..07cb671ec8da 100644 --- a/src/waveform/renderers/qopengl/waveformrendermark.cpp +++ b/src/waveform/renderers/qopengl/oglwaveformrendermark.cpp @@ -1,4 +1,4 @@ -#include "waveform/renderers/qopengl/waveformrendermark.h" +#include "waveform/renderers/qopengl/oglwaveformrendermark.h" #include #include @@ -8,9 +8,9 @@ #include "track/track.h" #include "util/color/color.h" #include "util/painterscope.h" -#include "waveform/renderers/qopengl/moc_waveformrendermark.cpp" +#include "waveform/renderers/qopengl/moc_oglwaveformrendermark.cpp" #include "waveform/waveform.h" -#include "waveform/widgets/qopengl/waveformwidget.h" +#include "waveform/widgets/qopengl/oglwaveformwidget.h" #include "widget/wimagestore.h" #include "widget/wskincolor.h" @@ -18,31 +18,29 @@ namespace { constexpr int kMaxCueLabelLength = 23; } // namespace -using namespace qopengl; - -WaveformRenderMark::WaveformRenderMark(WaveformWidgetRenderer* waveformWidget) - : WaveformRenderer(waveformWidget) { +OGLWaveformRenderMark::OGLWaveformRenderMark(WaveformWidgetRenderer* waveformWidget) + : OGLWaveformRenderer(waveformWidget) { } -WaveformRenderMark::~WaveformRenderMark() { +OGLWaveformRenderMark::~OGLWaveformRenderMark() { for (const auto& pMark : m_marks) { pMark->m_pTexture.reset(); } } -void WaveformRenderMark::setup(const QDomNode& node, const SkinContext& context) { +void OGLWaveformRenderMark::setup(const QDomNode& node, const SkinContext& context) { WaveformSignalColors signalColors = *m_waveformRenderer->getWaveformSignalColors(); m_marks.setup(m_waveformRenderer->getGroup(), node, context, signalColors); } -void WaveformRenderMark::initializeGL() { +void OGLWaveformRenderMark::initializeGL() { initGradientShader(); initTextureShader(); generatePlayPosMarkTexture(); } -void WaveformRenderMark::initGradientShader() { +void OGLWaveformRenderMark::initGradientShader() { QString vertexShaderCode = "\ uniform mat4 matrix;\n\ @@ -82,7 +80,7 @@ void main()\n\ } } -void WaveformRenderMark::initTextureShader() { +void OGLWaveformRenderMark::initTextureShader() { QString vertexShaderCode = "\ uniform mat4 matrix;\n\ @@ -122,7 +120,7 @@ void main()\n\ } } -void WaveformRenderMark::drawTexture(int x, int y, QOpenGLTexture* texture) { +void OGLWaveformRenderMark::drawTexture(int x, int y, QOpenGLTexture* texture) { const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio(); const float texx1 = 0.f; const float texy1 = 0.f; @@ -163,7 +161,7 @@ void WaveformRenderMark::drawTexture(int x, int y, QOpenGLTexture* texture) { glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } -void WaveformRenderMark::fillRectWithGradient( +void OGLWaveformRenderMark::fillRectWithGradient( const QRectF& rect, QColor color, Qt::Orientation orientation) { const float grdx1 = 0.f; const float grdy1 = 0.f; @@ -200,7 +198,7 @@ void WaveformRenderMark::fillRectWithGradient( glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } -void WaveformRenderMark::renderGL() { +void OGLWaveformRenderMark::renderGL() { const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio(); QMap marksOnScreen; @@ -327,7 +325,7 @@ void WaveformRenderMark::renderGL() { drawTexture(drawOffset, 0, m_pPlayPosMarkTexture.get()); } -void WaveformRenderMark::generatePlayPosMarkTexture() { +void OGLWaveformRenderMark::generatePlayPosMarkTexture() { float imgwidth; float imgheight; @@ -419,7 +417,7 @@ void WaveformRenderMark::generatePlayPosMarkTexture() { m_pPlayPosMarkTexture->setWrapMode(QOpenGLTexture::ClampToBorder); } -void WaveformRenderMark::drawTriangle(QPainter* painter, +void OGLWaveformRenderMark::drawTriangle(QPainter* painter, const QBrush& fillColor, QPointF p0, QPointF p1, @@ -433,14 +431,14 @@ void WaveformRenderMark::drawTriangle(QPainter* painter, painter->fillPath(triangle, fillColor); } -void WaveformRenderMark::resizeGL(int, int) { +void OGLWaveformRenderMark::resizeGL(int, int) { // Delete all marks' images. New images will be created on next paint. for (const auto& pMark : m_marks) { pMark->m_image = QImage(); } } -void WaveformRenderMark::onSetTrack() { +void OGLWaveformRenderMark::onSetTrack() { slotCuesUpdated(); TrackPointer trackInfo = m_waveformRenderer->getTrackInfo(); @@ -450,14 +448,14 @@ void WaveformRenderMark::onSetTrack() { connect(trackInfo.get(), &Track::cuesUpdated, this, - &WaveformRenderMark::slotCuesUpdated); + &OGLWaveformRenderMark::slotCuesUpdated); } -void WaveformRenderMark::slotCuesUpdated() { +void OGLWaveformRenderMark::slotCuesUpdated() { m_bCuesUpdates = true; } -void WaveformRenderMark::checkCuesUpdated() { +void OGLWaveformRenderMark::checkCuesUpdated() { if (!m_bCuesUpdates) { return; } @@ -496,7 +494,7 @@ void WaveformRenderMark::checkCuesUpdated() { } } -void WaveformRenderMark::generateMarkImage(WaveformMarkPointer pMark) { +void OGLWaveformRenderMark::generateMarkImage(WaveformMarkPointer pMark) { // Load the pixmap from file. // If that succeeds loading the text and stroke is skipped. const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio(); diff --git a/src/waveform/renderers/qopengl/waveformrendermark.h b/src/waveform/renderers/qopengl/oglwaveformrendermark.h similarity index 80% rename from src/waveform/renderers/qopengl/waveformrendermark.h rename to src/waveform/renderers/qopengl/oglwaveformrendermark.h index 6fe51430d041..494ae0ecb7de 100644 --- a/src/waveform/renderers/qopengl/waveformrendermark.h +++ b/src/waveform/renderers/qopengl/oglwaveformrendermark.h @@ -5,22 +5,18 @@ #include #include "util/class.h" -#include "waveform/renderers/qopengl/waveformrenderer.h" +#include "waveform/renderers/qopengl/oglwaveformrenderer.h" #include "waveform/renderers/waveformmarkset.h" class QDomNode; class SkinContext; class QOpenGLTexture; -namespace qopengl { -class WaveformRenderMark; -} - -class qopengl::WaveformRenderMark : public QObject, public qopengl::WaveformRenderer { +class OGLWaveformRenderMark : public QObject, public OGLWaveformRenderer { Q_OBJECT public: - explicit WaveformRenderMark(WaveformWidgetRenderer* waveformWidget); - ~WaveformRenderMark() override; + explicit OGLWaveformRenderMark(WaveformWidgetRenderer* waveformWidget); + ~OGLWaveformRenderMark() override; void setup(const QDomNode& node, const SkinContext& context) override; @@ -62,5 +58,5 @@ class qopengl::WaveformRenderMark : public QObject, public qopengl::WaveformRend void fillRectWithGradient(const QRectF& rect, QColor color, Qt::Orientation orientation); void drawTexture(int x, int y, QOpenGLTexture* texture); - DISALLOW_COPY_AND_ASSIGN(WaveformRenderMark); + DISALLOW_COPY_AND_ASSIGN(OGLWaveformRenderMark); }; diff --git a/src/waveform/renderers/qopengl/waveformrendermarkrange.cpp b/src/waveform/renderers/qopengl/oglwaveformrendermarkrange.cpp similarity index 87% rename from src/waveform/renderers/qopengl/waveformrendermarkrange.cpp rename to src/waveform/renderers/qopengl/oglwaveformrendermarkrange.cpp index 5f89d79f1937..bd63417040e9 100644 --- a/src/waveform/renderers/qopengl/waveformrendermarkrange.cpp +++ b/src/waveform/renderers/qopengl/oglwaveformrendermarkrange.cpp @@ -1,4 +1,4 @@ -#include "waveform/renderers/qopengl/waveformrendermarkrange.h" +#include "waveform/renderers/qopengl/oglwaveformrendermarkrange.h" #include #include @@ -10,20 +10,18 @@ #include "preferences/usersettings.h" #include "track/track.h" #include "util/painterscope.h" -#include "waveform/widgets/qopengl/waveformwidget.h" +#include "waveform/widgets/qopengl/oglwaveformwidget.h" #include "widget/wskincolor.h" #include "widget/wwidget.h" -using namespace qopengl; - -WaveformRenderMarkRange::WaveformRenderMarkRange(WaveformWidgetRenderer* waveformWidget) - : WaveformRenderer(waveformWidget) { +OGLWaveformRenderMarkRange::OGLWaveformRenderMarkRange(WaveformWidgetRenderer* waveformWidget) + : OGLWaveformRenderer(waveformWidget) { } -WaveformRenderMarkRange::~WaveformRenderMarkRange() { +OGLWaveformRenderMarkRange::~OGLWaveformRenderMarkRange() { } -void WaveformRenderMarkRange::initializeGL() { +void OGLWaveformRenderMarkRange::initializeGL() { QString vertexShaderCode = "\ uniform mat4 matrix;\n\ @@ -58,7 +56,7 @@ void main()\n\ return; } } -void WaveformRenderMarkRange::fillRect( +void OGLWaveformRenderMarkRange::fillRect( const QRectF& rect, QColor color) { const float posx1 = rect.x(); const float posx2 = rect.x() + rect.width(); @@ -79,7 +77,7 @@ void WaveformRenderMarkRange::fillRect( glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } -void WaveformRenderMarkRange::setup(const QDomNode& node, const SkinContext& context) { +void OGLWaveformRenderMarkRange::setup(const QDomNode& node, const SkinContext& context) { m_markRanges.clear(); m_markRanges.reserve(1); @@ -97,7 +95,7 @@ void WaveformRenderMarkRange::setup(const QDomNode& node, const SkinContext& con } } -void WaveformRenderMarkRange::renderGL() { +void OGLWaveformRenderMarkRange::renderGL() { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/waveform/renderers/qopengl/waveformrendermarkrange.h b/src/waveform/renderers/qopengl/oglwaveformrendermarkrange.h similarity index 59% rename from src/waveform/renderers/qopengl/waveformrendermarkrange.h rename to src/waveform/renderers/qopengl/oglwaveformrendermarkrange.h index ed2dea5fdd2a..0a38df677029 100644 --- a/src/waveform/renderers/qopengl/waveformrendermarkrange.h +++ b/src/waveform/renderers/qopengl/oglwaveformrendermarkrange.h @@ -5,20 +5,16 @@ #include #include "preferences/usersettings.h" -#include "waveform/renderers/qopengl/waveformrenderer.h" +#include "waveform/renderers/qopengl/oglwaveformrenderer.h" #include "waveform/renderers/waveformmarkrange.h" class QDomNode; class SkinContext; -namespace qopengl { -class WaveformRenderMarkRange; -} - -class qopengl::WaveformRenderMarkRange : public qopengl::WaveformRenderer { +class OGLWaveformRenderMarkRange : public OGLWaveformRenderer { public: - explicit WaveformRenderMarkRange(WaveformWidgetRenderer* waveformWidget); - ~WaveformRenderMarkRange() override; + explicit OGLWaveformRenderMarkRange(WaveformWidgetRenderer* waveformWidget); + ~OGLWaveformRenderMarkRange() override; void setup(const QDomNode& node, const SkinContext& context) override; @@ -31,5 +27,5 @@ class qopengl::WaveformRenderMarkRange : public qopengl::WaveformRenderer { QOpenGLShaderProgram m_shaderProgram; std::vector m_markRanges; - DISALLOW_COPY_AND_ASSIGN(WaveformRenderMarkRange); + DISALLOW_COPY_AND_ASSIGN(OGLWaveformRenderMarkRange); }; diff --git a/src/waveform/renderers/qopengl/waveformrenderbackground.h b/src/waveform/renderers/qopengl/waveformrenderbackground.h deleted file mode 100644 index d6633f2018ba..000000000000 --- a/src/waveform/renderers/qopengl/waveformrenderbackground.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include -#include - -#include "util/class.h" -#include "waveform/renderers/qopengl/waveformrenderer.h" - -class QDomNode; -class SkinContext; - -namespace qopengl { -class WaveformRenderBackground; -} -class qopengl::WaveformRenderBackground : public qopengl::WaveformRenderer { - public: - explicit WaveformRenderBackground(WaveformWidgetRenderer* waveformWidgetRenderer); - ~WaveformRenderBackground() override; - - void setup(const QDomNode& node, const SkinContext& context) override; - void renderGL() override; - - private: - void generateImage(); - - QString m_backgroundPixmapPath; - QColor m_backgroundColor; - QImage m_backgroundImage; - - DISALLOW_COPY_AND_ASSIGN(WaveformRenderBackground); -}; diff --git a/src/waveform/renderers/qopengl/waveformrenderer.cpp b/src/waveform/renderers/qopengl/waveformrenderer.cpp deleted file mode 100644 index 31cfd5d925bd..000000000000 --- a/src/waveform/renderers/qopengl/waveformrenderer.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "waveform/renderers/qopengl/waveformrenderer.h" - -#include "waveform/widgets/qopengl/waveformwidget.h" - -using namespace qopengl; - -WaveformRenderer::WaveformRenderer(WaveformWidgetRenderer* widget) - : ::WaveformRendererAbstract(widget) { -} - -WaveformRenderer::~WaveformRenderer() = default; diff --git a/src/waveform/renderers/qopengl/waveformrenderer.h b/src/waveform/renderers/qopengl/waveformrenderer.h deleted file mode 100644 index 71b208e8cdb3..000000000000 --- a/src/waveform/renderers/qopengl/waveformrenderer.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include - -#include "waveform/renderers/qopengl/iwaveformrenderer.h" -#include "waveform/renderers/waveformrendererabstract.h" - -class WaveformWidgetRenderer; - -namespace qopengl { -class WaveformRenderer; -} // namespace qopengl - -class qopengl::WaveformRenderer : public WaveformRendererAbstract, public IWaveformRenderer { - public: - explicit WaveformRenderer(WaveformWidgetRenderer* widget); - ~WaveformRenderer(); - - void draw(QPainter* painter, QPaintEvent* event) override { - } - - IWaveformRenderer* qopenglWaveformRenderer() override { - return this; - } -}; diff --git a/src/waveform/renderers/qopengl/waveformrenderersignalbase.cpp b/src/waveform/renderers/qopengl/waveformrenderersignalbase.cpp deleted file mode 100644 index 1fe7461104a2..000000000000 --- a/src/waveform/renderers/qopengl/waveformrenderersignalbase.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "waveform/renderers/qopengl/waveformrenderersignalbase.h" - -#include "waveform/widgets/qopengl/waveformwidget.h" - -using namespace qopengl; - -qopengl::WaveformRendererSignalBase::WaveformRendererSignalBase( - WaveformWidgetRenderer* waveformWidget) - : ::WaveformRendererSignalBase(waveformWidget) { -} diff --git a/src/waveform/renderers/qopengl/waveformrenderersignalbase.h b/src/waveform/renderers/qopengl/waveformrenderersignalbase.h deleted file mode 100644 index 21a2c9e9006e..000000000000 --- a/src/waveform/renderers/qopengl/waveformrenderersignalbase.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "waveform/renderers/qopengl/iwaveformrenderer.h" -#include "waveform/renderers/waveformrenderersignalbase.h" - -class WaveformWidgetRenderer; - -namespace qopengl { -class WaveformRendererSignalBase; -} // namespace qopengl - -class qopengl::WaveformRendererSignalBase : public ::WaveformRendererSignalBase, - public qopengl::IWaveformRenderer { - public: - explicit WaveformRendererSignalBase(WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererSignalBase() override = default; - - void draw(QPainter* painter, QPaintEvent* event) override { - } - - IWaveformRenderer* qopenglWaveformRenderer() override { - return this; - } - - DISALLOW_COPY_AND_ASSIGN(WaveformRendererSignalBase); -}; diff --git a/src/waveform/renderers/waveformmark.h b/src/waveform/renderers/waveformmark.h index bd31ccf4427c..83479b2633e0 100644 --- a/src/waveform/renderers/waveformmark.h +++ b/src/waveform/renderers/waveformmark.h @@ -16,9 +16,7 @@ class WOverview; #ifdef MIXXX_USE_QOPENGL class QOpenGLTexture; -namespace qopengl { -class WaveformRenderMark; -} +class OGLWaveformRenderMark; #endif class WaveformMark { @@ -110,8 +108,8 @@ class WaveformMark { std::unique_ptr m_pEndPositionCO; std::unique_ptr m_pVisibleCO; #ifdef MIXXX_USE_QOPENGL - std::unique_ptr m_pTexture; // used by qopengl::WaveformRenderMark - friend class qopengl::WaveformRenderMark; + std::unique_ptr m_pTexture; // used by OGLWaveformRenderMark + friend class OGLWaveformRenderMark; #endif int m_iHotCue; QImage m_image; diff --git a/src/waveform/renderers/waveformmarkrange.h b/src/waveform/renderers/waveformmarkrange.h index baa35d76e2bf..b9bcd244004f 100644 --- a/src/waveform/renderers/waveformmarkrange.h +++ b/src/waveform/renderers/waveformmarkrange.h @@ -14,9 +14,7 @@ class SkinContext; class WaveformSignalColors; #ifdef MIXXX_USE_QOPENGL -namespace qopengl { -class WaveformRenderMarkRange; -} +class OGLWaveformRenderMarkRange; #endif class WaveformMarkRange { @@ -78,7 +76,7 @@ class WaveformMarkRange { friend class WaveformRenderMarkRange; #ifdef MIXXX_USE_QOPENGL - friend class qopengl::WaveformRenderMarkRange; + friend class OGLWaveformRenderMarkRange; #endif friend class WOverview; }; diff --git a/src/waveform/renderers/waveformrendererabstract.h b/src/waveform/renderers/waveformrendererabstract.h index 5f003470dc89..c3b7866a70b6 100644 --- a/src/waveform/renderers/waveformrendererabstract.h +++ b/src/waveform/renderers/waveformrendererabstract.h @@ -10,9 +10,7 @@ class SkinContext; class WaveformWidgetRenderer; #ifdef MIXXX_USE_QOPENGL -namespace qopengl { -class IWaveformRenderer; -} +class IOGLWaveformRenderer; #endif class WaveformRendererAbstract { @@ -29,7 +27,7 @@ class WaveformRendererAbstract { virtual void onSetTrack() {} #ifdef MIXXX_USE_QOPENGL - virtual qopengl::IWaveformRenderer* qopenglWaveformRenderer() { + virtual IOGLWaveformRenderer* qopenglWaveformRenderer() { return nullptr; } #endif diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index a7186ef400cb..7f9426790c04 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -40,7 +40,7 @@ #include "waveform/widgets/softwarewaveformwidget.h" #include "waveform/widgets/waveformwidgetabstract.h" #ifdef MIXXX_USE_QOPENGL -#include "waveform/widgets/qopengl/rgbwaveformwidget.h" +#include "waveform/widgets/qopengl/oglrgbwaveformwidget.h" #endif #include "widget/wvumeter.h" #include "widget/wvumetergl.h" @@ -683,7 +683,7 @@ void WaveformWidgetFactory::render() { continue; } #ifdef MIXXX_USE_QOPENGL - qopengl::IWaveformWidget* qopenglWaveformWidget = + IOGLWaveformWidget* qopenglWaveformWidget = pWaveformWidget->qopenglWaveformWidget(); if (qopenglWaveformWidget) { qopenglWaveformWidget->renderGL(); @@ -918,12 +918,12 @@ void WaveformWidgetFactory::evaluateWidgets() { developerOnly = QtRGBWaveformWidget::developerOnly(); break; #ifdef MIXXX_USE_QOPENGL - case WaveformWidgetType::QOpenGLRGBWaveform: - widgetName = qopengl::RGBWaveformWidget::getWaveformWidgetName(); - useOpenGl = qopengl::RGBWaveformWidget::useOpenGl(); - useOpenGles = qopengl::RGBWaveformWidget::useOpenGles(); - useOpenGLShaders = qopengl::RGBWaveformWidget::useOpenGLShaders(); - developerOnly = qopengl::RGBWaveformWidget::developerOnly(); + case WaveformWidgetType::OGLRGBWaveform: + widgetName = OGLRGBWaveformWidget::getWaveformWidgetName(); + useOpenGl = OGLRGBWaveformWidget::useOpenGl(); + useOpenGles = OGLRGBWaveformWidget::useOpenGles(); + useOpenGLShaders = OGLRGBWaveformWidget::useOpenGLShaders(); + developerOnly = OGLRGBWaveformWidget::developerOnly(); break; #endif default: @@ -1033,8 +1033,8 @@ WaveformWidgetAbstract* WaveformWidgetFactory::createWaveformWidget( widget = new QtRGBWaveformWidget(viewer->getGroup(), viewer); break; #ifdef MIXXX_USE_QOPENGL - case WaveformWidgetType::QOpenGLRGBWaveform: - widget = new qopengl::RGBWaveformWidget(viewer->getGroup(), viewer); + case WaveformWidgetType::OGLRGBWaveform: + widget = new OGLRGBWaveformWidget(viewer->getGroup(), viewer); break; #endif default: diff --git a/src/waveform/widgets/qopengl/ioglwaveformwidget.h b/src/waveform/widgets/qopengl/ioglwaveformwidget.h new file mode 100644 index 000000000000..c71c8fd00b8f --- /dev/null +++ b/src/waveform/widgets/qopengl/ioglwaveformwidget.h @@ -0,0 +1,8 @@ +#pragma once + +class IOGLWaveformWidget; + +class IOGLWaveformWidget { + public: + virtual void renderGL() = 0; +}; diff --git a/src/waveform/widgets/qopengl/iwaveformwidget.h b/src/waveform/widgets/qopengl/iwaveformwidget.h deleted file mode 100644 index 2ed9ebe4527a..000000000000 --- a/src/waveform/widgets/qopengl/iwaveformwidget.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -namespace qopengl { -class IWaveformWidget; -} - -class qopengl::IWaveformWidget { - public: - virtual void renderGL() = 0; -}; diff --git a/src/waveform/widgets/qopengl/oglrgbwaveformwidget.cpp b/src/waveform/widgets/qopengl/oglrgbwaveformwidget.cpp new file mode 100644 index 000000000000..18c02b06df44 --- /dev/null +++ b/src/waveform/widgets/qopengl/oglrgbwaveformwidget.cpp @@ -0,0 +1,34 @@ +#include "waveform/widgets/qopengl/oglrgbwaveformwidget.h" + +#include "waveform/renderers/qopengl/oglwaveformrenderbackground.h" +#include "waveform/renderers/qopengl/oglwaveformrenderbeat.h" +#include "waveform/renderers/qopengl/oglwaveformrendererendoftrack.h" +#include "waveform/renderers/qopengl/oglwaveformrendererpreroll.h" +#include "waveform/renderers/qopengl/oglwaveformrendererrgb.h" +#include "waveform/renderers/qopengl/oglwaveformrendermark.h" +#include "waveform/renderers/qopengl/oglwaveformrendermarkrange.h" +#include "waveform/widgets/qopengl/moc_oglrgbwaveformwidget.cpp" + +OGLRGBWaveformWidget::OGLRGBWaveformWidget(const QString& group, QWidget* parent) + : OGLWaveformWidget(group, parent) { + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + + m_initSuccess = init(); +} + +OGLRGBWaveformWidget::~OGLRGBWaveformWidget() { +} + +void OGLRGBWaveformWidget::castToQWidget() { + m_widget = this; +} + +void OGLRGBWaveformWidget::paintEvent(QPaintEvent* event) { + Q_UNUSED(event); +} diff --git a/src/waveform/widgets/qopengl/rgbwaveformwidget.h b/src/waveform/widgets/qopengl/oglrgbwaveformwidget.h similarity index 67% rename from src/waveform/widgets/qopengl/rgbwaveformwidget.h rename to src/waveform/widgets/qopengl/oglrgbwaveformwidget.h index b14bbdf2d86b..353622a429f9 100644 --- a/src/waveform/widgets/qopengl/rgbwaveformwidget.h +++ b/src/waveform/widgets/qopengl/oglrgbwaveformwidget.h @@ -1,20 +1,16 @@ #pragma once -#include "waveform/widgets/qopengl/waveformwidget.h" +#include "waveform/widgets/qopengl/oglwaveformwidget.h" class WaveformWidgetFactory; -namespace qopengl { -class RGBWaveformWidget; -} - -class qopengl::RGBWaveformWidget : public qopengl::WaveformWidget { +class OGLRGBWaveformWidget : public OGLWaveformWidget { Q_OBJECT public: - ~RGBWaveformWidget() override; + ~OGLRGBWaveformWidget() override; WaveformWidgetType::Type getType() const override { - return WaveformWidgetType::QOpenGLRGBWaveform; + return WaveformWidgetType::OGLRGBWaveform; } static inline QString getWaveformWidgetName() { @@ -38,6 +34,6 @@ class qopengl::RGBWaveformWidget : public qopengl::WaveformWidget { void paintEvent(QPaintEvent* event) override; private: - RGBWaveformWidget(const QString& group, QWidget* parent); + OGLRGBWaveformWidget(const QString& group, QWidget* parent); friend class ::WaveformWidgetFactory; }; diff --git a/src/waveform/widgets/qopengl/waveformwidget.cpp b/src/waveform/widgets/qopengl/oglwaveformwidget.cpp similarity index 73% rename from src/waveform/widgets/qopengl/waveformwidget.cpp rename to src/waveform/widgets/qopengl/oglwaveformwidget.cpp index 5415a573b5de..ec1e74ddeecf 100644 --- a/src/waveform/widgets/qopengl/waveformwidget.cpp +++ b/src/waveform/widgets/qopengl/oglwaveformwidget.cpp @@ -1,15 +1,13 @@ -#include "waveform/widgets/qopengl/waveformwidget.h" +#include "waveform/widgets/qopengl/oglwaveformwidget.h" -#include "waveform/renderers/qopengl/iwaveformrenderer.h" +#include "waveform/renderers/qopengl/ioglwaveformrenderer.h" #include "widget/wwaveformviewer.h" -using namespace qopengl; - -WaveformWidget::WaveformWidget(const QString& group, QWidget* parent) +OGLWaveformWidget::OGLWaveformWidget(const QString& group, QWidget* parent) : WGLWidget(parent), WaveformWidgetAbstract(group) { } -WaveformWidget::~WaveformWidget() { +OGLWaveformWidget::~OGLWaveformWidget() { makeCurrentIfNeeded(); for (int i = 0; i < m_rendererStack.size(); ++i) { delete m_rendererStack[i]; @@ -18,7 +16,7 @@ WaveformWidget::~WaveformWidget() { doneCurrent(); } -void WaveformWidget::renderGL() { +void OGLWaveformWidget::renderGL() { makeCurrentIfNeeded(); if (shouldOnlyDrawBackground()) { @@ -33,7 +31,7 @@ void WaveformWidget::renderGL() { doneCurrent(); } -void WaveformWidget::initializeGL() { +void OGLWaveformWidget::initializeGL() { makeCurrentIfNeeded(); for (int i = 0; i < m_rendererStack.size(); ++i) { m_rendererStack[i]->qopenglWaveformRenderer()->initializeOpenGLFunctions(); @@ -42,7 +40,7 @@ void WaveformWidget::initializeGL() { doneCurrent(); } -void WaveformWidget::handleEventFromWindow(QEvent* ev) { +void OGLWaveformWidget::handleEventFromWindow(QEvent* ev) { auto viewer = dynamic_cast(parent()); if (viewer) { viewer->handleEventFromWindow(ev); diff --git a/src/waveform/widgets/qopengl/waveformwidget.h b/src/waveform/widgets/qopengl/oglwaveformwidget.h similarity index 51% rename from src/waveform/widgets/qopengl/waveformwidget.h rename to src/waveform/widgets/qopengl/oglwaveformwidget.h index 4535289076ae..e016bb53b738 100644 --- a/src/waveform/widgets/qopengl/waveformwidget.h +++ b/src/waveform/widgets/qopengl/oglwaveformwidget.h @@ -1,28 +1,24 @@ #pragma once -#include "waveform/widgets/qopengl/iwaveformwidget.h" +#include "waveform/widgets/qopengl/ioglwaveformwidget.h" #include "waveform/widgets/waveformwidgetabstract.h" #include "widget/wglwidget.h" class WWaveformViewer; -namespace qopengl { -class WaveformWidget; -} - -class qopengl::WaveformWidget : public ::WGLWidget, - public ::WaveformWidgetAbstract, - public qopengl::IWaveformWidget { +class OGLWaveformWidget : public WGLWidget, + public WaveformWidgetAbstract, + public IOGLWaveformWidget { Q_OBJECT public: - explicit WaveformWidget(const QString& group, QWidget* parent); - ~WaveformWidget() override; + explicit OGLWaveformWidget(const QString& group, QWidget* parent); + ~OGLWaveformWidget() override; - qopengl::IWaveformWidget* qopenglWaveformWidget() override { + IOGLWaveformWidget* qopenglWaveformWidget() override { return this; } - // override for IWaveformWidget + // override for IOGLWaveformWidget void renderGL() override; // overrides for WGLWidget diff --git a/src/waveform/widgets/qopengl/rgbwaveformwidget.cpp b/src/waveform/widgets/qopengl/rgbwaveformwidget.cpp deleted file mode 100644 index dbbe742cb92d..000000000000 --- a/src/waveform/widgets/qopengl/rgbwaveformwidget.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "waveform/widgets/qopengl/rgbwaveformwidget.h" - -#include "waveform/renderers/qopengl/waveformrenderbackground.h" -#include "waveform/renderers/qopengl/waveformrenderbeat.h" -#include "waveform/renderers/qopengl/waveformrendererendoftrack.h" -#include "waveform/renderers/qopengl/waveformrendererpreroll.h" -#include "waveform/renderers/qopengl/waveformrendererrgb.h" -#include "waveform/renderers/qopengl/waveformrendermark.h" -#include "waveform/renderers/qopengl/waveformrendermarkrange.h" -#include "waveform/widgets/qopengl/moc_rgbwaveformwidget.cpp" - -using namespace qopengl; - -RGBWaveformWidget::RGBWaveformWidget(const QString& group, QWidget* parent) - : WaveformWidget(group, parent) { - addRenderer(); - addRenderer(); - addRenderer(); - addRenderer(); - addRenderer(); - addRenderer(); - addRenderer(); - - m_initSuccess = init(); -} - -RGBWaveformWidget::~RGBWaveformWidget() { -} - -void RGBWaveformWidget::castToQWidget() { - m_widget = this; -} - -void RGBWaveformWidget::paintEvent(QPaintEvent* event) { - Q_UNUSED(event); -} diff --git a/src/waveform/widgets/waveformwidgetabstract.h b/src/waveform/widgets/waveformwidgetabstract.h index b607b74847e9..49d29f2ebea9 100644 --- a/src/waveform/widgets/waveformwidgetabstract.h +++ b/src/waveform/widgets/waveformwidgetabstract.h @@ -9,9 +9,7 @@ #include "widget/wglwidget.h" #ifdef MIXXX_USE_QOPENGL -namespace qopengl { -class IWaveformWidget; -} +class IOGLWaveformWidget; #endif class VSyncThread; @@ -39,7 +37,7 @@ class WaveformWidgetAbstract : public WaveformWidgetRenderer { #ifdef MIXXX_USE_QOPENGL // Derived classes that implement the IWaveformWidget // interface should return this - virtual qopengl::IWaveformWidget* qopenglWaveformWidget() { + virtual IOGLWaveformWidget* qopenglWaveformWidget() { return nullptr; } #endif diff --git a/src/waveform/widgets/waveformwidgettype.h b/src/waveform/widgets/waveformwidgettype.h index 5f15e8f4025c..224fa1e6308e 100644 --- a/src/waveform/widgets/waveformwidgettype.h +++ b/src/waveform/widgets/waveformwidgettype.h @@ -23,7 +23,7 @@ class WaveformWidgetType { QtRGBWaveform, // 15 RGB Qt GLSLRGBStackedWaveform, // 16 RGB Stacked #ifdef MIXXX_USE_QOPENGL - QOpenGLRGBWaveform, // 17 RGB (QOpenGL) + OGLRGBWaveform, // 17 RGB (QOpenGL) #endif Count_WaveformwidgetType // Also used as invalid value };