QImageReader: add tracepoints for image loading

Change-Id: I5fe25793eeda01a4fa1658091890af23f66b7089
Reviewed-by: Rafael Roquetto <rafael@roquetto.com>
bb10
Giuseppe D'Angelo 2018-06-19 22:40:56 +02:00
parent 8ec98fc2dc
commit 72fc65784d
2 changed files with 16 additions and 1 deletions

View File

@ -165,6 +165,7 @@
#endif
#include <private/qimagereaderwriterhelpers_p.h>
#include <qtgui_tracepoints_p.h>
#include <algorithm>
@ -1250,7 +1251,18 @@ bool QImageReader::read(QImage *image)
d->handler->setOption(QImageIOHandler::Quality, d->quality);
// read the image
if (!d->handler->read(image)) {
if (Q_TRACE_ENABLED(QImageReader_read_before_reading)) {
QString fileName = QStringLiteral("unknown");
if (QFile *file = qobject_cast<QFile *>(d->device))
fileName = file->fileName();
Q_TRACE(QImageReader_read_before_reading, this, fileName);
}
const bool result = d->handler->read(image);
Q_TRACE(QImageReader_read_after_reading, this, result);
if (!result) {
d->imageReaderError = InvalidDataError;
d->errorString = QImageReader::tr("Unable to read image data");
return false;

View File

@ -8,3 +8,6 @@ QFontDatabase_addApplicationFont(const QString &filename)
QFontDatabase_load(const QString &family, int pointSize)
QFontDatabase_loadEngine(const QString &family, int pointSize)
QFontDatabasePrivate_addAppFont(const QString &fileName)
QImageReader_read_before_reading(QImageReader *reader, const QString &filename)
QImageReader_read_after_reading(QImageReader *reader, bool result)