blob: 98fadd3c51048ebc4011f450a8a0fde9e868e1fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#include <QPainter>
#include <QGLContext>
#include <QtDebug>
#include "waveform/widgets/qthsvwaveformwidget.h"
#include "waveform/renderers/waveformwidgetrenderer.h"
#include "waveform/renderers/waveformrenderbackground.h"
#include "waveform/renderers/waveformrendermark.h"
#include "waveform/renderers/waveformrendermarkrange.h"
#include "waveform/renderers/waveformrendererhsv.h"
#include "waveform/renderers/waveformrendererpreroll.h"
#include "waveform/renderers/waveformrendererendoftrack.h"
#include "waveform/renderers/waveformrenderbeat.h"
QtHSVWaveformWidget::QtHSVWaveformWidget(const char* group, QWidget* parent)
: QGLWidget(parent),
WaveformWidgetAbstract(group) {
if (QGLContext::currentContext() != context()) {
makeCurrent();
}
addRenderer<WaveformRenderBackground>();
addRenderer<WaveformRendererEndOfTrack>();
addRenderer<WaveformRendererPreroll>();
addRenderer<WaveformRenderMarkRange>();
addRenderer<WaveformRendererHSV>();
addRenderer<WaveformRenderBeat>();
addRenderer<WaveformRenderMark>();
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_OpaquePaintEvent);
m_initSuccess = init();
}
QtHSVWaveformWidget::~QtHSVWaveformWidget() {
}
void QtHSVWaveformWidget::castToQWidget() {
m_widget = static_cast<QWidget*>(static_cast<QGLWidget*>(this));
}
void QtHSVWaveformWidget::paintEvent(QPaintEvent* event) {
Q_UNUSED(event);
}
mixxx::Duration QtHSVWaveformWidget::render() {
PerformanceTimer timer;
mixxx::Duration t1;
//mixxx::Duration t2, t3;
timer.start();
// QPainter makes QGLContext::currentContext() == context()
// this may delayed until previous buffer swap finished
QPainter painter(this);
t1 = timer.restart();
draw(&painter, NULL);
//t2 = timer.restart();
//qDebug() << "QtHSVWaveformWidget "<< t1 << t2;
return t1; // return timer for painter setup
}
|