Skip to content

Commit

Permalink
reverted back to using qopengl namespace, added qopengl:: where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
m0dB committed Oct 23, 2022
1 parent ceca510 commit 50bc499
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
36 changes: 17 additions & 19 deletions src/waveform/renderers/qopengl/waveformrendermark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,29 @@ namespace {
constexpr int kMaxCueLabelLength = 23;
} // namespace

using namespace qopengl;

WaveformRenderMark::WaveformRenderMark(WaveformWidgetRenderer* waveformWidget)
qopengl::WaveformRenderMark::WaveformRenderMark(WaveformWidgetRenderer* waveformWidget)
: WaveformRenderer(waveformWidget) {
}

WaveformRenderMark::~WaveformRenderMark() {
qopengl::WaveformRenderMark::~WaveformRenderMark() {
for (const auto& pMark : m_marks) {
pMark->m_pTexture.reset();
}
}

void WaveformRenderMark::setup(const QDomNode& node, const SkinContext& context) {
void qopengl::WaveformRenderMark::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 qopengl::WaveformRenderMark::initializeGL() {
initGradientShader();
initTextureShader();

generatePlayPosMarkTexture();
}

void WaveformRenderMark::initGradientShader() {
void qopengl::WaveformRenderMark::initGradientShader() {
QString vertexShaderCode =
"\
uniform mat4 matrix;\n\
Expand Down Expand Up @@ -82,7 +80,7 @@ void main()\n\
}
}

void WaveformRenderMark::initTextureShader() {
void qopengl::WaveformRenderMark::initTextureShader() {
QString vertexShaderCode =
"\
uniform mat4 matrix;\n\
Expand Down Expand Up @@ -122,7 +120,7 @@ void main()\n\
}
}

void WaveformRenderMark::drawTexture(int x, int y, QOpenGLTexture* texture) {
void qopengl::WaveformRenderMark::drawTexture(int x, int y, QOpenGLTexture* texture) {
const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio();
const float texx1 = 0.f;
const float texy1 = 0.f;
Expand Down Expand Up @@ -163,7 +161,7 @@ void WaveformRenderMark::drawTexture(int x, int y, QOpenGLTexture* texture) {
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void WaveformRenderMark::fillRectWithGradient(
void qopengl::WaveformRenderMark::fillRectWithGradient(
const QRectF& rect, QColor color, Qt::Orientation orientation) {
const float grdx1 = 0.f;
const float grdy1 = 0.f;
Expand Down Expand Up @@ -200,7 +198,7 @@ void WaveformRenderMark::fillRectWithGradient(
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void WaveformRenderMark::renderGL() {
void qopengl::WaveformRenderMark::renderGL() {
const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio();
QMap<WaveformMarkPointer, int> marksOnScreen;

Expand Down Expand Up @@ -327,7 +325,7 @@ void WaveformRenderMark::renderGL() {
drawTexture(drawOffset, 0, m_pPlayPosMarkTexture.get());
}

void WaveformRenderMark::generatePlayPosMarkTexture() {
void qopengl::WaveformRenderMark::generatePlayPosMarkTexture() {
float imgwidth;
float imgheight;

Expand Down Expand Up @@ -419,7 +417,7 @@ void WaveformRenderMark::generatePlayPosMarkTexture() {
m_pPlayPosMarkTexture->setWrapMode(QOpenGLTexture::ClampToBorder);
}

void WaveformRenderMark::drawTriangle(QPainter* painter,
void qopengl::WaveformRenderMark::drawTriangle(QPainter* painter,
const QBrush& fillColor,
QPointF p0,
QPointF p1,
Expand All @@ -433,14 +431,14 @@ void WaveformRenderMark::drawTriangle(QPainter* painter,
painter->fillPath(triangle, fillColor);
}

void WaveformRenderMark::resizeGL(int, int) {
void qopengl::WaveformRenderMark::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 qopengl::WaveformRenderMark::onSetTrack() {
slotCuesUpdated();

TrackPointer trackInfo = m_waveformRenderer->getTrackInfo();
Expand All @@ -450,14 +448,14 @@ void WaveformRenderMark::onSetTrack() {
connect(trackInfo.get(),
&Track::cuesUpdated,
this,
&WaveformRenderMark::slotCuesUpdated);
&qopengl::WaveformRenderMark::slotCuesUpdated);
}

void WaveformRenderMark::slotCuesUpdated() {
void qopengl::WaveformRenderMark::slotCuesUpdated() {
m_bCuesUpdates = true;
}

void WaveformRenderMark::checkCuesUpdated() {
void qopengl::WaveformRenderMark::checkCuesUpdated() {
if (!m_bCuesUpdates) {
return;
}
Expand Down Expand Up @@ -496,7 +494,7 @@ void WaveformRenderMark::checkCuesUpdated() {
}
}

void WaveformRenderMark::generateMarkImage(WaveformMarkPointer pMark) {
void qopengl::WaveformRenderMark::generateMarkImage(WaveformMarkPointer pMark) {
// Load the pixmap from file.
// If that succeeds loading the text and stroke is skipped.
const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio();
Expand Down
14 changes: 6 additions & 8 deletions src/waveform/renderers/qopengl/waveformrendermarkrange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
#include "widget/wskincolor.h"
#include "widget/wwidget.h"

using namespace qopengl;

WaveformRenderMarkRange::WaveformRenderMarkRange(WaveformWidgetRenderer* waveformWidget)
qopengl::WaveformRenderMarkRange::WaveformRenderMarkRange(WaveformWidgetRenderer* waveformWidget)
: WaveformRenderer(waveformWidget) {
}

WaveformRenderMarkRange::~WaveformRenderMarkRange() {
qopengl::WaveformRenderMarkRange::~WaveformRenderMarkRange() {
}

void WaveformRenderMarkRange::initializeGL() {
void qopengl::WaveformRenderMarkRange::initializeGL() {
QString vertexShaderCode =
"\
uniform mat4 matrix;\n\
Expand Down Expand Up @@ -58,7 +56,7 @@ void main()\n\
return;
}
}
void WaveformRenderMarkRange::fillRect(
void qopengl::WaveformRenderMarkRange::fillRect(
const QRectF& rect, QColor color) {
const float posx1 = rect.x();
const float posx2 = rect.x() + rect.width();
Expand All @@ -79,7 +77,7 @@ void WaveformRenderMarkRange::fillRect(
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void WaveformRenderMarkRange::setup(const QDomNode& node, const SkinContext& context) {
void qopengl::WaveformRenderMarkRange::setup(const QDomNode& node, const SkinContext& context) {
m_markRanges.clear();
m_markRanges.reserve(1);

Expand All @@ -97,7 +95,7 @@ void WaveformRenderMarkRange::setup(const QDomNode& node, const SkinContext& con
}
}

void WaveformRenderMarkRange::renderGL() {
void qopengl::WaveformRenderMarkRange::renderGL() {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Expand Down

0 comments on commit 50bc499

Please sign in to comment.