From: Simon A. Eugster Date: Sun, 5 Sep 2010 13:33:24 +0000 (+0000) Subject: Waveform: Skip rows instead of columns when realtime enabled. Avoids horizontal gaps. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=79e0f399b22a4eaeb6bec26c11ddc0edfd20356c;p=kdenlive Waveform: Skip rows instead of columns when realtime enabled. Avoids horizontal gaps. svn path=/trunk/kdenlive/; revision=4845 --- diff --git a/src/colorcorrection/waveformgenerator.cpp b/src/colorcorrection/waveformgenerator.cpp index 05d278d1..21d4b9cc 100644 --- a/src/colorcorrection/waveformgenerator.cpp +++ b/src/colorcorrection/waveformgenerator.cpp @@ -77,9 +77,11 @@ QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QIm const float wPrediv = (float)(ww-1)/(iw-1); const uchar *bits = image.bits(); - const uint stepsize = 4*accelFactor; + const uchar *bitsStart = bits; - for (uint i = 0, x = 0; i < byteCount; i += stepsize) { + for (uint i = 0, x = 0; i < byteCount; i += 4) { + + Q_ASSERT(bits < bitsStart + byteCount); col = (QRgb *)bits; @@ -96,9 +98,15 @@ QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QIm dx = x*wPrediv; waveValues[(int)dx][(int)dy]++; - bits += stepsize; - x += stepsize; - x %= iw; // Modulo image width, to represent the current x position in the image + bits += 4; + x += 4; + if (x > iw) { + x -= iw; + if (accelFactor > 1) { + bits += 4*iw*(accelFactor-1); + i += 4*iw*(accelFactor-1); + } + } } switch (paintMode) {