diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2012-01-23 12:49:35 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-19 05:32:11 (GMT) |
commit | 6878047681820124e58d33355f35a7fc114a47bc (patch) | |
tree | 4b7487b7a75261ba21cb7c2a772547014dd18db6 /src | |
parent | 36820a366bf678cfcf184cb6a30f3e81c9aa0576 (diff) | |
download | Qt-6878047681820124e58d33355f35a7fc114a47bc.zip Qt-6878047681820124e58d33355f35a7fc114a47bc.tar.gz Qt-6878047681820124e58d33355f35a7fc114a47bc.tar.bz2 |
directfb: Use QPlatformPixmap::fromFile for Qt resources
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: I800bfe4cd9b5d6a0d3531ed33f4228770703e94f
Original-Id: I7cb92d84874323e7205ab28883cc0fe9ecca1e27
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/directfb/qdirectfbblitter.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp index 66efe1c..a116699 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 QBlittablePixmapData::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<const uchar*>(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; |