#include "retracer.h"
#include "apitracecall.h"
+#include "thumbnail.h"
#include "image.hpp"
*/
void Retracer::run()
{
- QString msg;
+ QString msg = QLatin1String("Replay finished!");
/*
* Construct command line
QString prog;
QStringList arguments;
- if (m_api == trace::API_GL) {
+ switch (m_api) {
+ case trace::API_GL:
prog = QLatin1String("glretrace");
- } else if (m_api == trace::API_EGL) {
+ break;
+ case trace::API_EGL:
prog = QLatin1String("eglretrace");
- } else {
- Q_ASSERT(0);
+ break;
+ case trace::API_DX:
+ case trace::API_D3D7:
+ case trace::API_D3D8:
+ case trace::API_D3D9:
+ case trace::API_D3D10:
+ case trace::API_D3D10_1:
+ case trace::API_D3D11:
+#ifdef Q_OS_WIN
+ prog = QLatin1String("d3dretrace");
+#else
+ prog = QLatin1String("wine");
+ arguments << QLatin1String("d3dretrace.exe");
+#endif
+ break;
+ default:
+ emit finished(QLatin1String("Unsupported API"));
return;
}
/*
* Parse JSON from the output.
*
- * XXX: QJSON expects blocking IO.
- *
* XXX: QJSON's scanner is inneficient as it abuses single
* character QIODevice::peek (not cheap), instead of maintaining a
* lookahead character on its own.
bool ok = false;
QJson::Parser jsonParser;
+#if 0
parsedJson = jsonParser.parse(&io, &ok).toMap();
+#else
+ /*
+ * XXX: QJSON expects blocking IO, and it looks like
+ * BlockingIODevice does not work reliably in all cases.
+ */
+ process.waitForFinished(-1);
+ parsedJson = jsonParser.parse(&process, &ok).toMap();
+#endif
if (!ok) {
msg = QLatin1String("failed to parse JSON");
}
Q_ASSERT(readBytes == rowBytes);
}
- QImage thumbnail = snapshot.scaled(16, 16, Qt::KeepAspectRatio, Qt::FastTransformation);
- thumbnails.append(thumbnail);
+ QImage thumb = thumbnail(snapshot);
+ thumbnails.append(thumb);
}
Q_ASSERT(process.state() != QProcess::Running);
} else {
QByteArray output;
output = process.readAllStandardOutput();
- msg = QString::fromUtf8(output);
+ if (output.length() < 80) {
+ msg = QString::fromUtf8(output);
+ }
}
}