diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2011-02-09 09:45:09 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2011-02-09 10:05:32 (GMT) |
commit | ca663a7252637f8066a0e7368650e72094220b69 (patch) | |
tree | 3825175436bacc1edb4aed4801defaa6355d37d5 /src/gui/image | |
parent | 50e7bea8bb4ce5a97ab8ff9c7062fc0fa092aec0 (diff) | |
download | Qt-ca663a7252637f8066a0e7368650e72094220b69.zip Qt-ca663a7252637f8066a0e7368650e72094220b69.tar.gz Qt-ca663a7252637f8066a0e7368650e72094220b69.tar.bz2 |
Recreate Symbian raster backing store when WA_TranslucentBackground set
Task-number: QTBUG-17288
Reviewed-by: Jani Hautakangas
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 26 | ||||
-rw-r--r-- | src/gui/image/qpixmap_s60_p.h | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index dbe8177..a7aeb84 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -1012,6 +1012,32 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) } } +void QS60PixmapData::convertToDisplayMode(TDisplayMode mode) +{ + if (!cfbsBitmap || cfbsBitmap->DisplayMode() == mode) + return; + if (image.depth() != TDisplayModeUtils::NumDisplayModeBitsPerPixel(mode)) { + qWarning("Cannot convert display mode due to depth mismatch"); + return; + } + + const TSize size = cfbsBitmap->SizeInPixels(); + QScopedPointer<CFbsBitmap> newBitmap(createSymbianCFbsBitmap(size, mode)); + + const uchar *sptr = const_cast<const QImage &>(image).bits(); + symbianBitmapDataAccess->beginDataAccess(newBitmap.data()); + uchar *dptr = (uchar*)newBitmap->DataAddress(); + Mem::Copy(dptr, sptr, image.byteCount()); + symbianBitmapDataAccess->endDataAccess(newBitmap.data()); + + QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); + delete cfbsBitmap; + lock.relock(); + cfbsBitmap = newBitmap.take(); + setSerialNumber(cfbsBitmap->Handle()); + UPDATE_BUFFER(); +} + QPixmapData *QS60PixmapData::createCompatiblePixmapData() const { return new QS60PixmapData(pixelType()); diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index e4060dc..c1d7941 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -54,6 +54,7 @@ // #include <QtGui/private/qpixmap_raster_p.h> +#include <displaymode.h> QT_BEGIN_NAMESPACE @@ -107,6 +108,8 @@ public: void* toNativeType(NativeType type); void fromNativeType(void* pixmap, NativeType type); + void convertToDisplayMode(TDisplayMode mode); + private: void release(); void fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat=false); |