Skip to content

Commit

Permalink
using prefix OGL instead of namespace qopengl
Browse files Browse the repository at this point in the history
  • Loading branch information
m0dB committed Oct 22, 2022
1 parent ceca510 commit f286928
Show file tree
Hide file tree
Showing 39 changed files with 287 additions and 366 deletions.
26 changes: 13 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/waveform/renderers/qopengl/fixedpointcalc.h
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -26,7 +24,7 @@ void WaveformRenderBackground::setup(const QDomNode& node,
setDirty(true);
}

void WaveformRenderBackground::renderGL() {
void OGLWaveformRenderBackground::renderGL() {
if (isDirty()) {
// TODO @m0dB
// generateImage();
Expand All @@ -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(
Expand Down
28 changes: 28 additions & 0 deletions src/waveform/renderers/qopengl/oglwaveformrenderbackground.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include <QColor>
#include <QImage>

#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);
};
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
#include "waveform/renderers/qopengl/waveformrenderbeat.h"
#include "waveform/renderers/qopengl/oglwaveformrenderbeat.h"

#include <QDomNode>

#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\
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@
#include <QOpenGLShaderProgram>

#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;
Expand All @@ -27,5 +23,5 @@ class qopengl::WaveformRenderBeat : public qopengl::WaveformRenderer {
QVector<float> m_beatLineVertices;
QOpenGLShaderProgram m_shaderProgram;

DISALLOW_COPY_AND_ASSIGN(WaveformRenderBeat);
DISALLOW_COPY_AND_ASSIGN(OGLWaveformRenderBeat);
};
9 changes: 9 additions & 0 deletions src/waveform/renderers/qopengl/oglwaveformrenderer.cpp
Original file line number Diff line number Diff line change
@@ -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;
21 changes: 21 additions & 0 deletions src/waveform/renderers/qopengl/oglwaveformrenderer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include <QOpenGLFunctions>

#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;
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "waveform/renderers/qopengl/waveformrendererendoftrack.h"
#include "waveform/renderers/qopengl/oglwaveformrendererendoftrack.h"

#include <QDomNode>
#include <QPaintEvent>
Expand All @@ -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"

Expand All @@ -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(
Expand All @@ -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()) {
Expand All @@ -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\
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
};
Loading

0 comments on commit f286928

Please sign in to comment.