From: Simon A. Eugster Date: Wed, 1 Sep 2010 15:56:22 +0000 (+0000) Subject: Waveform and RGB Parade: X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=9ac9ee5976082747a2abf3bb7c42eeb4f89f4097;p=kdenlive Waveform and RGB Parade: * Make value stick to the line drawn through the mouse position svn path=/trunk/kdenlive/; revision=4804 --- diff --git a/src/colorcorrection/rgbparadegenerator.cpp b/src/colorcorrection/rgbparadegenerator.cpp index b3edd1bb..d356696d 100644 --- a/src/colorcorrection/rgbparadegenerator.cpp +++ b/src/colorcorrection/rgbparadegenerator.cpp @@ -183,10 +183,6 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize ¶deSize, const QIm davinci.drawText(partW + offset + d, wh-20, QString::number(maxG, 'f', 0)); davinci.drawText(2*partW + 2*offset + d, wh-20, QString::number(maxB, 'f', 0)); - davinci.drawText(ww-distRight+5, 10, "255"); - davinci.drawText(ww-distRight+5, partH+5, "0"); - - return parade; } diff --git a/src/rgbparade.cpp b/src/rgbparade.cpp index 7e0ca385..93bdd8f1 100644 --- a/src/rgbparade.cpp +++ b/src/rgbparade.cpp @@ -88,29 +88,40 @@ QRect RGBParade::scopeRect() QImage RGBParade::renderHUD(uint) { - if (scopeRect().height() > 0 && m_mouseWithinWidget) { - QImage hud(m_scopeRect.size(), QImage::Format_ARGB32); - hud.fill(qRgba(0,0,0,0)); + QImage hud(m_scopeRect.size(), QImage::Format_ARGB32); + hud.fill(qRgba(0,0,0,0)); + + QPainter davinci(&hud); + davinci.setPen(penLight); - QPainter davinci(&hud); - davinci.setPen(penLight); + int x = scopeRect().width()-30; + + davinci.drawText(x, scopeRect().height()-RGBParadeGenerator::distBottom, "0"); + davinci.drawText(x, 10, "255"); + + if (scopeRect().height() > 0 && m_mouseWithinWidget) { - int x = scopeRect().width()-30; int y = m_mousePos.y() - scopeRect().y(); // Draw a horizontal line through the current mouse position // and show the value of the waveform there davinci.drawLine(0, y, scopeRect().size().width()-RGBParadeGenerator::distRight, y); + // Make the value stick to the line unless it is at the top/bottom of the scope + const int top = 30; + const int bottom = 20+RGBParadeGenerator::distBottom; + int valY = y+5; + if (valY < top) { + valY = top; + } else if (valY > scopeRect().height()-bottom) { + valY = scopeRect().height()-bottom; + } int val = 255*(1-((float)y/(scopeRect().height()-RGBParadeGenerator::distBottom))); - davinci.drawText(x, scopeRect().height()/2, QVariant(val).toString()); - - emit signalHUDRenderingFinished(1, 1); - return hud; - } else { - emit signalHUDRenderingFinished(1, 1); - return QImage(); + davinci.drawText(x, valY, QVariant(val).toString()); } + + emit signalHUDRenderingFinished(1, 1); + return hud; } QImage RGBParade::renderScope(uint accelerationFactor, QImage qimage) { diff --git a/src/waveform.cpp b/src/waveform.cpp index cb7dcf5c..505c972f 100644 --- a/src/waveform.cpp +++ b/src/waveform.cpp @@ -119,8 +119,17 @@ QImage Waveform::renderHUD(uint) // and show the value of the waveform there davinci.drawLine(0, y, scopeRect().size().width()-m_textWidth.width(), y); + // Make the value stick to the line unless it is at the top/bottom of the scope + const int top = 30; + const int bottom = 20; + int valY = y+5; + if (valY < top) { + valY = top; + } else if (valY > scopeRect().height()-bottom) { + valY = scopeRect().height()-bottom; + } int val = 255*(1-(float)y/scopeRect().height()); - davinci.drawText(x, scopeRect().height()/2, QVariant(val).toString()); + davinci.drawText(x, valY, QVariant(val).toString()); } davinci.drawText(x, scopeRect().height(), "0"); davinci.drawText(x, 10, "255");