diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-11-04 14:48:40 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-11-04 14:48:40 (GMT) |
commit | b4ef8b906c88e5d60e687d9018af93de0e735e0c (patch) | |
tree | fe4167319039047ba3ac0c97651dddc0a526349b /src/gui/image/qpixmap_s60.cpp | |
parent | f4f6012d181cf60fd04fc5bf69b21786977f0de0 (diff) | |
parent | 9cda9fb4bb496a7c589767bdcead131dbcdeeb79 (diff) | |
download | Qt-b4ef8b906c88e5d60e687d9018af93de0e735e0c.zip Qt-b4ef8b906c88e5d60e687d9018af93de0e735e0c.tar.gz Qt-b4ef8b906c88e5d60e687d9018af93de0e735e0c.tar.bz2 |
Merge commit 's60/4.6' into mmfphonon
Diffstat (limited to 'src/gui/image/qpixmap_s60.cpp')
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 7086341..cd8a4d4 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -73,27 +73,27 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, used to lock the global bitmap heap. Only used in S60 v3.1 and S60 v3.2. */ +_LIT(KFBSERVLargeBitmapAccessName,"FbsLargeBitmapAccess"); class QSymbianFbsClient { public: - QSymbianFbsClient() : heapLock(0), heapLocked(false) + QSymbianFbsClient() : heapLocked(false) { - QT_TRAP_THROWING(heapLock = new(ELeave) CFbsBitmap); - heapLock->Create(TSize(0,0), S60->screenDevice()->DisplayMode()); + heapLock.OpenGlobal(KFBSERVLargeBitmapAccessName); } ~QSymbianFbsClient() { - delete heapLock; + heapLock.Close(); } bool lockHeap() { bool wasLocked = heapLocked; - if (heapLock && !heapLocked) { - heapLock->LockHeap(ETrue); + if (heapLock.Handle() && !heapLocked) { + heapLock.Wait(); heapLocked = true; } @@ -104,8 +104,8 @@ public: { bool wasLocked = heapLocked; - if (heapLock && heapLocked) { - heapLock->UnlockHeap(ETrue); + if (heapLock.Handle() && heapLocked) { + heapLock.Signal(); heapLocked = false; } @@ -115,7 +115,7 @@ public: private: - CFbsBitmap *heapLock; + RMutex heapLock; bool heapLocked; }; @@ -169,7 +169,7 @@ public: inline void beginDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) + if (symbianVersion == QSysInfo::SV_9_2) heapWasLocked = qt_symbianFbsClient()->lockHeap(); else bitmap->LockHeap(ETrue); @@ -177,7 +177,7 @@ public: inline void endDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) { + if (symbianVersion == QSysInfo::SV_9_2) { if (!heapWasLocked) qt_symbianFbsClient()->unlockHeap(); } else { @@ -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; } @@ -751,9 +752,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*>(sgImage), QPixmapData::SgImage); + QPixmap pixmap(data.take()); return pixmap; } |