[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita/plugins/paintops/libpaintop/sensors
From: Cyrille Berger <cyb () lepi ! org>
Date: 2010-02-28 22:19:50
Message-ID: 1267395590.689669.8839.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1097315 by berger:
Fix: the speed sensor
BUG:228389
M +8 -0 kis_dynamic_sensors.cc
M +1 -8 kis_dynamic_sensors.h
--- trunk/koffice/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.cc \
#1097314:1097315 @@ -26,6 +26,14 @@
}
+qreal KisDynamicSensorSpeed::parameter(const KisPaintInformation& info) {
+ int dt = qMax(1, info.currentTime() - m_lastTime); // make sure dt > 1
+ m_lastTime = info.currentTime();
+ double currentMove = info.movement().norm() / dt;
+ m_speed = qMin(1.0, (m_speed * 0.9 + currentMove * 0.1)); // average it to get \
nicer result, at the price of being less mathematically correct, but we quicly reach \
a situation where dt = 1 and currentMove = 1 + return 1.0 - m_speed;
+}
+
KisDynamicSensorDrawingAngle::KisDynamicSensorDrawingAngle() : \
KisDynamicSensor(DrawingAngleId) {
--- trunk/koffice/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h \
#1097314:1097315 @@ -40,14 +40,7 @@
public:
KisDynamicSensorSpeed();
virtual ~KisDynamicSensorSpeed() { }
- virtual qreal parameter(const KisPaintInformation& info) {
- int dt = qMax(1, info.currentTime() - m_lastTime); // make sure dt > 1
- m_lastTime = info.currentTime();
- m_speed += (info.movement().norm() - m_lastMove) / dt;
- m_lastMove = info.movement().norm();
- m_speed = qMin(1.0, m_speed);
- return 1.0 - m_speed;
- }
+ virtual qreal parameter(const KisPaintInformation& info);
void reset() {
m_lastTime = 0;
m_lastMove = 0.0;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic