aboutsummaryrefslogtreecommitdiff
path: root/stfreader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'stfreader.cc')
-rw-r--r--stfreader.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/stfreader.cc b/stfreader.cc
index 270a39c..efe7412 100644
--- a/stfreader.cc
+++ b/stfreader.cc
@@ -45,7 +45,7 @@ StfReader::StrokeHandler::~StrokeHandler()
bool StfReader::parseV1(BitReader& br)
{
- quint64 cur_time = 0;
+ quint64 stroke_time = 0;
while (!br.atEnd()) {
syncV1(br);
@@ -76,18 +76,18 @@ bool StfReader::parseV1(BitReader& br)
}
/* Start of a stroke. */
- cur_time += time;
+ stroke_time += time;
p0.setX(br.readBits(16));
p0.setY(br.readBits(16));
f0 = readForce(br);
- quint64 stroke_time = cur_time;
-
if (handler) {
- bool res = handler->startStroke(p0, f0, cur_time);
+ bool res = handler->startStroke(p0, f0, stroke_time);
if (!res) return false;
}
+ quint64 point_time = 0;
+
while (!br.atEnd()) {
header = readHeader(br);
if (header == 0 || header == 1) {
@@ -112,7 +112,7 @@ bool StfReader::parseV1(BitReader& br)
if (time == 0) {
if (handler) {
- bool res = handler->endStroke(stroke_time);
+ bool res = handler->endStroke(stroke_time + ((point_time * 1000ULL) / speed));
if (!res) return false;
}
break;
@@ -151,10 +151,10 @@ bool StfReader::parseV1(BitReader& br)
pa *= 256 / static_cast<int>(time);
f0 += deltaf;
- stroke_time += time;
+ point_time += time;
if (handler) {
- bool res = handler->strokePoint(p0, f0, stroke_time);
+ bool res = handler->strokePoint(p0, f0, stroke_time + ((point_time * 1000ULL) / speed));
if (!res) return false;
}
}