Commit 6fcba2eb authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Initialize averaging buffer with initial speed value

BUG:234308
parent 1da74f32
......@@ -39,8 +39,14 @@ qreal KisDynamicSensorSpeed::value(const KisPaintInformation& info) {
const qreal blendExponent = 0.05;
qreal currentSpeed = info.drawingSpeed() / maxSpeed;
m_speed = qMin(1.0, (m_speed * (1 - blendExponent) +
currentSpeed * blendExponent));
if (m_speed >= 0.0) {
m_speed = qMin(1.0, (m_speed * (1 - blendExponent) +
currentSpeed * blendExponent));
} else {
m_speed = currentSpeed;
}
return m_speed;
}
......
......@@ -43,14 +43,10 @@ public:
virtual ~KisDynamicSensorSpeed() { }
virtual qreal value(const KisPaintInformation& info);
void reset() {
m_lastTime = 0;
m_lastMove = 0.0;
m_speed = 0.0;
m_speed = -1.0;
}
private:
double m_speed;
double m_lastMove;
int m_lastTime;
};
class KisDynamicSensorDrawingAngle : public KisDynamicSensor
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment