From 8f6ee81ee97bd89df9bbc6d4353df05542c3ac64 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 23 Jan 2012 13:49:35 +0100 Subject: directfb: Use QPlatformPixmap::fromFile for Qt resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move to fromFile to load Qt resources for two reasons. The first is that ::fromData creates a QBuffer on our raw data and is passing that to the QImageReaders. Right now we there is a QFile -> QByteArray -> QBuffer transition that wastes cycles. The other reason is that QPlatformPixmap::fromData did/does not check if the decoded image is null and might cause a crash because of that. Change-Id: I7cb92d84874323e7205ab28883cc0fe9ecca1e27 Reviewed-by: Jørgen Lind --- src/plugins/platforms/directfb/qdirectfbblitter.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp index e1b46e86d3..acd6dc9900 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp +++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp @@ -247,14 +247,8 @@ bool QDirectFbBlitterPlatformPixmap::fromFile(const QString &filename, const cha return QBlittablePlatformPixmap::fromFile(filename, format, flags); // Deal with resources - if (filename.startsWith(QLatin1Char(':'))) { // resource - QFile file(filename); - if (!file.open(QIODevice::ReadOnly)) - return false; - const QByteArray data = file.readAll(); - file.close(); - return fromData(reinterpret_cast(data.constData()), data.size(), format, flags); - } + if (filename.startsWith(QLatin1Char(':'))) + return QBlittablePlatformPixmap::fromFile(filename, format, flags); // Try to use directfb to load it. DFBDataBufferDescription description; -- cgit v1.2.3