audiowaveformview: optimizes waveform to only redraw when necessary

Draws to a pixmap only when the waveform changes so it doesn't have to be
regenerated on every draw. Also renames WaveformView to AudioWaveformView
This commit is contained in:
itsmattkc
2020-03-18 14:44:05 +11:00
parent 5bdee74205
commit fed17e35fa
7 changed files with 207 additions and 184 deletions
@@ -32,7 +32,7 @@
#include "common/qtutils.h"
#include "config/config.h"
#include "node/block/transition/transition.h"
#include "widget/viewer/waveformview.h"
#include "widget/viewer/audiowaveformview.h"
TimelineViewBlockItem::TimelineViewBlockItem(Block *block, QGraphicsItem* parent) :
TimelineViewRect(parent),
@@ -93,7 +93,7 @@ void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsI
QByteArray w = wave_file.readAll();
// FIXME: Hardcoded channel count
WaveformView::DrawWaveform(painter,
AudioWaveformView::DrawWaveform(painter,
rect().toRect(),
this->GetScale(),
reinterpret_cast<const SampleSummer::Sum*>(w.constData()),