Skip to content

Commit

Permalink
Merge pull request #11333 from daschuer/painter_not_active_23
Browse files Browse the repository at this point in the history
Fix "Painter not active" warning after reloading a track.
  • Loading branch information
Swiftb0y authored Mar 6, 2023
2 parents 3aeafd6 + a750b8a commit 47834be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/widget/woverviewhsv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ bool WOverviewHSV::drawNextPixmapPart() {

const int dataSize = pWaveform->getDataSize();
const double audioVisualRatio = pWaveform->getAudioVisualRatio();
if (dataSize <= 0 || audioVisualRatio <= 0) {
const double trackSamples = getTrackSamples();
if (dataSize <= 0 || audioVisualRatio <= 0 || trackSamples <= 0) {
return false;
}

Expand All @@ -38,11 +39,12 @@ bool WOverviewHSV::drawNextPixmapPart() {
// by total_gain
// We keep full range waveform data to scale it on paint
m_waveformSourceImage = QImage(
static_cast<int>(getTrackSamples() / audioVisualRatio / 2),
static_cast<int>(trackSamples / audioVisualRatio / 2),
2 * 255,
QImage::Format_ARGB32_Premultiplied);
m_waveformSourceImage.fill(QColor(0, 0, 0, 0).value());
}
DEBUG_ASSERT(!m_waveformSourceImage.isNull());

// Always multiple of 2
const int waveformCompletion = pWaveform->getCompletion();
Expand Down
6 changes: 4 additions & 2 deletions src/widget/woverviewlmh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ bool WOverviewLMH::drawNextPixmapPart() {

const int dataSize = pWaveform->getDataSize();
const double audioVisualRatio = pWaveform->getAudioVisualRatio();
if (dataSize <= 0 || audioVisualRatio <= 0) {
const double trackSamples = getTrackSamples();
if (dataSize <= 0 || audioVisualRatio <= 0 || trackSamples <= 0) {
return false;
}

Expand All @@ -39,11 +40,12 @@ bool WOverviewLMH::drawNextPixmapPart() {
// by total_gain
// We keep full range waveform data to scale it on paint
m_waveformSourceImage = QImage(
static_cast<int>(getTrackSamples() / audioVisualRatio / 2),
static_cast<int>(trackSamples / audioVisualRatio / 2),
2 * 255,
QImage::Format_ARGB32_Premultiplied);
m_waveformSourceImage.fill(QColor(0, 0, 0, 0).value());
}
DEBUG_ASSERT(!m_waveformSourceImage.isNull());

// Always multiple of 2
const int waveformCompletion = pWaveform->getCompletion();
Expand Down
6 changes: 4 additions & 2 deletions src/widget/woverviewrgb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ bool WOverviewRGB::drawNextPixmapPart() {

const int dataSize = pWaveform->getDataSize();
const double audioVisualRatio = pWaveform->getAudioVisualRatio();
if (dataSize <= 0 || audioVisualRatio <= 0) {
const double trackSamples = getTrackSamples();
if (dataSize <= 0 || audioVisualRatio <= 0 || trackSamples <= 0) {
return false;
}

Expand All @@ -37,11 +38,12 @@ bool WOverviewRGB::drawNextPixmapPart() {
// by total_gain
// We keep full range waveform data to scale it on paint
m_waveformSourceImage = QImage(
static_cast<int>(getTrackSamples() / audioVisualRatio / 2),
static_cast<int>(trackSamples / audioVisualRatio / 2),
2 * 255,
QImage::Format_ARGB32_Premultiplied);
m_waveformSourceImage.fill(QColor(0, 0, 0, 0).value());
}
DEBUG_ASSERT(!m_waveformSourceImage.isNull());

// Always multiple of 2
const int waveformCompletion = pWaveform->getCompletion();
Expand Down

0 comments on commit 47834be

Please sign in to comment.