Store only one value for afterglow

This commit is contained in:
Gitea
2019-09-17 23:20:56 +02:00
parent 50fb47f513
commit 09e1d1ff16
2 changed files with 3 additions and 3 deletions

View File

@@ -34,7 +34,6 @@ void OsciWidget::setAfterglow(float afterglow){
m_afterglow = afterglow;
// percentage of the image that should be visible after one second
// i.e. factor^fps=afterglow -> factor = afterglow^(1/fps)
m_afterglowColor = 255 * pow(afterglow, 1.0/m_fps);
}
void OsciWidget::setLightspeed(int lightspeed) {
@@ -86,7 +85,8 @@ void OsciWidget::updateFrameBuffer()
// darkening last frame
painter.setCompositionMode(QPainter::CompositionMode_Multiply);
painter.setPen({});
painter.setBrush(QColor(m_afterglowColor, m_afterglowColor, m_afterglowColor));
auto afterglowColor = 255 * pow(m_afterglow, 1.0/m_fps);
painter.setBrush(QColor(afterglowColor, afterglowColor, afterglowColor));
painter.drawRect(m_pixmap.rect());
// drawing new lines ontop

View File

@@ -44,7 +44,7 @@ private:
private:
float m_factor{2.f};
int m_fps{30}, m_afterglowColor{175};
int m_fps{30};
float m_afterglow{0.2};
float m_lightspeed{35.f};