summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap.cpp
diff options
context:
space:
mode:
authorgunnar <gunnar@trolltech.com>2009-08-24 09:37:21 (GMT)
committergunnar <gunnar@trolltech.com>2009-08-24 10:55:39 (GMT)
commitdd21f5600a8bf07d1ac9b5367005790db86892ae (patch)
tree8b83795c3c20064da0bd3f1196df14ea38d6ef7f /src/gui/image/qpixmap.cpp
parentd1111859c26526227c07793aa6747efa65496055 (diff)
downloadQt-dd21f5600a8bf07d1ac9b5367005790db86892ae.zip
Qt-dd21f5600a8bf07d1ac9b5367005790db86892ae.tar.gz
Qt-dd21f5600a8bf07d1ac9b5367005790db86892ae.tar.bz2
make QPixmap rely on QPixmapData for loading from files and from data...
Reviewed-By: Eskil
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r--src/gui/image/qpixmap.cpp29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 00e78ad..658b8e0 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -832,20 +832,11 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
if (QPixmapCache::find(key, *this))
return true;
- QImage image = QImageReader(fileName, format).read();
- if (image.isNull())
- return false;
-
- QPixmap pm;
- if (data->pixelType() == QPixmapData::BitmapType)
- pm = QBitmap::fromImage(image, flags);
- else
- pm = fromImage(image, flags);
- if (!pm.isNull()) {
- *this = pm;
+ if (data->fromFile(fileName, format, flags)) {
QPixmapCache::insert(key, *this);
return true;
}
+
return false;
}
@@ -870,21 +861,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags)
{
- QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buf), len);
- QBuffer b(&a);
- b.open(QIODevice::ReadOnly);
-
- QImage image = QImageReader(&b, format).read();
- QPixmap pm;
- if (data->pixelType() == QPixmapData::BitmapType)
- pm = QBitmap::fromImage(image, flags);
- else
- pm = fromImage(image, flags);
- if (!pm.isNull()) {
- *this = pm;
- return true;
- }
- return false;
+ return data->fromData(buf, len, format, flags);
}
/*!