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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#include "widget/wspinny.h"
WSpinny::WSpinny(
QWidget* parent,
const QString& group,
UserSettingsPointer pConfig,
VinylControlManager* pVCMan,
BaseTrackPlayer* pPlayer)
: WSpinnyBase(parent, group, pConfig, pVCMan, pPlayer) {
}
void WSpinny::draw() {
double scaleFactor = devicePixelRatioF();
QPainter p(paintDevice());
p.setRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::SmoothPixmapTransform);
if (m_pBgImage) {
p.drawImage(rect(), *m_pBgImage, m_pBgImage->rect());
}
if (m_bShowCover && !m_loadedCoverScaled.isNull()) {
// Some covers aren't square, so center them.
double x = (width() - m_loadedCoverScaled.width() / scaleFactor) / 2;
double y = (height() - m_loadedCoverScaled.height() / scaleFactor) / 2;
p.drawPixmap(QPointF(x, y), m_loadedCoverScaled);
}
if (m_pMaskImage) {
p.drawImage(rect(), *m_pMaskImage, m_pMaskImage->rect());
}
#ifdef __VINYLCONTROL__
// Overlay the signal quality drawing if vinyl is active
if (m_bVinylActive && m_bSignalActive) {
// draw the last good image
p.drawImage(this->rect(), m_qImage);
}
#endif
// To rotate the foreground image around the center of the image,
// we use the classic trick of translating the coordinate system such that
// the origin is at the center of the image. We then rotate the coordinate system,
// and draw the image at the corner.
p.translate(width() / 2, height() / 2);
bool paintGhost = m_bGhostPlayback && m_pGhostImage && !m_pGhostImage->isNull();
if (paintGhost) {
p.save();
}
if (paintGhost) {
p.restore();
p.save();
p.rotate(m_fGhostAngle);
p.drawImage(QPointF(-m_ghostImageScaled.width() / scaleFactor / 2.0,
-m_ghostImageScaled.height() / scaleFactor / 2.0),
m_ghostImageScaled);
//Rotate back to the playback position (not the ghost position),
//and draw the beat marks from there.
p.restore();
}
if (m_pFgImage && !m_pFgImage->isNull()) {
// Now rotate the image and draw it on the screen.
p.rotate(m_fAngle);
p.drawImage(QPointF(-m_fgImageScaled.width() / scaleFactor / 2.0,
-m_fgImageScaled.height() / scaleFactor / 2.0),
m_fgImageScaled);
}
}
void WSpinny::coverChanged() {
}
|