aboutsummaryrefslogtreecommitdiff
path: root/stfreader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'stfreader.cc')
-rw-r--r--stfreader.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/stfreader.cc b/stfreader.cc
index ff5e4f4..ad15b59 100644
--- a/stfreader.cc
+++ b/stfreader.cc
@@ -45,12 +45,12 @@ StfReader::StrokeHandler::~StrokeHandler()
bool StfReader::parseV1(BitReader& br)
{
- qint64 cur_time = 0;
+ quint64 cur_time = 0;
while (!br.atEnd()) {
syncV1(br);
quint8 header = br.readBits(8);
- qint64 time;
+ quint64 time;
QPoint p0, pa;
int f0;
@@ -81,6 +81,8 @@ bool StfReader::parseV1(BitReader& br)
p0.setY(br.readBits(16));
f0 = readForce(br);
+ quint64 stroke_time = cur_time;
+
if (handler) {
bool res = handler->startStroke(p0, f0, cur_time);
if (!res) return false;
@@ -110,7 +112,7 @@ bool StfReader::parseV1(BitReader& br)
if (time == 0) {
if (handler) {
- bool res = handler->endStroke(cur_time);
+ bool res = handler->endStroke(stroke_time);
if (!res) return false;
}
break;
@@ -149,12 +151,13 @@ bool StfReader::parseV1(BitReader& br)
pa *= 256 / static_cast<int>(time);
f0 += deltaf;
+ stroke_time += time;
+
if (handler) {
- bool res = handler->strokePoint(p0, f0, cur_time);
+ bool res = handler->strokePoint(p0, f0, stroke_time);
if (!res) return false;
}
}
-
}
return false;