summaryrefslogtreecommitdiff
path: root/tools/qttracereplay/main.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2010-02-18 11:58:03 +0100
committerSamuel Rødal <sroedal@trolltech.com>2010-02-18 13:48:56 +0100
commit37d4bde65a28a10efdd9c09b88007acd7339629a (patch)
treec6b502994ab7c754a591f667d8212d33a72c8ebc /tools/qttracereplay/main.cpp
parent5cd93666050076053d547d1b3ba4041b8fae58ec (diff)
downloadqt4-tools-37d4bde65a28a10efdd9c09b88007acd7339629a.tar.gz
Reduced the memory footprint of qttrace files.
A couple of improvements have been made: * Use single precision floats for the traces. * Reduce the number of variant wrapped transforms by introducing a new translate command. * Reduce the number of bytes streamed per image / pixmap draw command. * Add versioning info to qttrace files to be more future proof. Reviewed-by: Gunnar Sletta
Diffstat (limited to 'tools/qttracereplay/main.cpp')
-rw-r--r--tools/qttracereplay/main.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/qttracereplay/main.cpp b/tools/qttracereplay/main.cpp
index 82373f7402..be7906b97d 100644
--- a/tools/qttracereplay/main.cpp
+++ b/tools/qttracereplay/main.cpp
@@ -183,15 +183,21 @@ ReplayWidget::ReplayWidget(const QString &filename_, int from_, int to_, bool si
char *data;
uint size;
in.readBytes(data, size);
- bool isTraceFile = size == 7 && qstrncmp(data, "qttrace", 7) == 0;
- delete [] data;
+ bool isTraceFile = size >= 7 && qstrncmp(data, "qttrace", 7) == 0;
+
+ uint version = 0;
+ if (size == 9 && qstrncmp(data, "qttraceV2", 9) == 0) {
+ in.setFloatingPointPrecision(QDataStream::SinglePrecision);
+ in >> version;
+ }
+
if (!isTraceFile) {
printf("File '%s' is not a trace file\n", qPrintable(filename_));
return;
}
in >> buffer >> updates;
- printf("Read paint buffer with %d frames\n", buffer.numFrames());
+ printf("Read paint buffer version %d with %d frames\n", version, buffer.numFrames());
resize(buffer.boundingRect().size().toSize());