diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-10-28 12:49:19 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-10-30 09:22:14 (GMT) |
commit | 79eef278228aac21fbf8b21eaa337f2922bc68c1 (patch) | |
tree | f5dee10e99a57e69713726d7195ccbd2df582677 /src/gui/image/qpixmap_s60.cpp | |
parent | 8efb1eb4b112dfe718f47a5b99cd9a839ac62752 (diff) | |
download | Qt-79eef278228aac21fbf8b21eaa337f2922bc68c1.zip Qt-79eef278228aac21fbf8b21eaa337f2922bc68c1.tar.gz Qt-79eef278228aac21fbf8b21eaa337f2922bc68c1.tar.bz2 |
Lazily construct QPixmapData's for null pixmaps
Reviewed-by: Trond
Diffstat (limited to 'src/gui/image/qpixmap_s60.cpp')
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 666d608..d4c97e1 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -311,7 +311,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h) CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const { QPixmapData *data = pixmapData(); - if (data->isNull()) + if (!data || data->isNull()) return 0; return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPixmapData::FbsBitmap)); @@ -337,8 +337,9 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) if (!bitmap) return QPixmap(); - QPixmap pixmap; - pixmap.pixmapData()->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::FbsBitmap); + QScopedPointer<QS60PixmapData> data(new QS60PixmapData(QPixmapData::PixmapType)); + data->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::FbsBitmap); + QPixmap pixmap(data.take()); return pixmap; } @@ -752,9 +753,9 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) if (!sgImage) return QPixmap(); - QPixmap pixmap; - pixmap.pixmapData()->fromNativeType(reinterpret_cast<void*>(sgImage), QPixmapData::SgImage); - + QScopedPointer<QS60PixmapData> data(new QS60PixmapData(QPixmapData::PixmapType)); + data->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::SgImage); + QPixmap pixmap(data.take()); return pixmap; } |