summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2011-02-09 09:45:09 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-02-10 09:59:55 (GMT)
commit5ee97f48e908d00b5e4dcd221310389b9f6133b3 (patch)
treeb4a37291c5b2d5c43fc3cba428f1cff971cde636
parentd0b2922bc2f8f40828598aac19617184007c7df5 (diff)
downloadQt-5ee97f48e908d00b5e4dcd221310389b9f6133b3.zip
Qt-5ee97f48e908d00b5e4dcd221310389b9f6133b3.tar.gz
Qt-5ee97f48e908d00b5e4dcd221310389b9f6133b3.tar.bz2
Recreate Symbian raster backing store when WA_TranslucentBackground set
Task-number: QTBUG-17288 Reviewed-by: Jani Hautakangas (cherry picked from commit ca663a7252637f8066a0e7368650e72094220b69)
-rw-r--r--src/gui/image/qpixmap_s60.cpp26
-rw-r--r--src/gui/image/qpixmap_s60_p.h3
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp17
3 files changed, 42 insertions, 4 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);
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index 7dc5cb7..9f371a8 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -61,13 +61,11 @@ struct QS60WindowSurfacePrivate
QList<QImage*> bufferImages;
};
-QS60WindowSurface::QS60WindowSurface(QWidget* widget)
- : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
+TDisplayMode displayMode(bool opaque)
{
TDisplayMode mode = S60->screenDevice()->DisplayMode();
- bool isOpaque = qt_widget_private(widget)->isOpaque;
- if (isOpaque) {
+ if (opaque) {
mode = EColor16MU;
} else {
if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3)
@@ -75,7 +73,13 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget)
else
mode = EColor16MA; // Symbian prior to Symbian^3 sw accelerates EColor16MA
}
+ return mode;
+}
+QS60WindowSurface::QS60WindowSurface(QWidget* widget)
+ : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
+{
+ TDisplayMode mode = displayMode(qt_widget_private(widget)->isOpaque);
// We create empty CFbsBitmap here -> it will be resized in setGeometry
CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new
qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
@@ -121,6 +125,11 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn)
if (!qt_widget_private(window())->isOpaque) {
QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data());
+
+ TDisplayMode mode = displayMode(false);
+ if (pixmapData->cfbsBitmap->DisplayMode() != mode)
+ pixmapData->convertToDisplayMode(mode);
+
pixmapData->beginDataAccess();
QPainter p(&pixmapData->image);