diff options
author | Shane Kearns <shane.kearns@sosco.com> | 2009-10-20 11:34:55 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@sosco.com> | 2009-10-20 11:45:02 (GMT) |
commit | f7d826f1a42c912f1db15da0a1cefe13bdd54906 (patch) | |
tree | 8c230d1d670130687a4301c0d4b90e7a5052a0df | |
parent | da3e89e8d98a4d3322eae94aafd38ddb444f144e (diff) | |
download | Qt-f7d826f1a42c912f1db15da0a1cefe13bdd54906.zip Qt-f7d826f1a42c912f1db15da0a1cefe13bdd54906.tar.gz Qt-f7d826f1a42c912f1db15da0a1cefe13bdd54906.tar.bz2 |
Use premultiplied alpha pixel format in Symbian
Gives better performance in the raster paint engine.
For Symbian 9.3 onwards, this can also be used as the native pixmap
format. For 9.2, conversion is required.
Reviewed-by: Sami Merila
Reviewed-by: Jani Hautakangas
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 19 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 10 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 7 | ||||
-rw-r--r-- | src/s60installs/eabi/QtGuiu.def | 39 | ||||
-rw-r--r-- | src/s60installs/eabi/QtMultimediau.def | 6 | ||||
-rw-r--r-- | src/s60installs/eabi/QtNetworku.def | 2 | ||||
-rw-r--r-- | src/s60installs/eabi/QtScriptu.def | 1 | ||||
-rw-r--r-- | src/s60installs/eabi/QtXmlu.def | 1 | ||||
-rw-r--r-- | src/s60installs/eabi/phononu.def | 10 | ||||
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 2 |
11 files changed, 78 insertions, 26 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 9ae8d72..666d608 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -496,11 +496,12 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags mode = EColor16MU; break; case QImage::Format_ARGB32_Premultiplied: -#if !defined(__SERIES60_31__) && !defined(__S60_32__) - mode = EColor16MAP; - break; -#endif - destFormat = QImage::Format_ARGB32; + if (S60->supportsPremultipliedAlpha) { + mode = Q_SYMBIAN_ECOLOR16MAP; + break; + } else { + destFormat = QImage::Format_ARGB32; + } // Fall through intended case QImage::Format_ARGB32: mode = EColor16MA; @@ -690,6 +691,10 @@ void QS60PixmapData::beginDataAccess() bytes = newBytes; TDisplayMode mode = cfbsBitmap->DisplayMode(); QImage::Format format = qt_TDisplayMode2Format(mode); + //on S60 3.1, premultiplied alpha pixels are stored in a bitmap with 16MA type + if (format == QImage::Format_ARGB32) + format = QImage::Format_ARGB32_Premultiplied; // pixel data is actually in premultiplied format + TSize size = cfbsBitmap->SizeInPixels(); QVector<QRgb> savedColorTable; @@ -794,8 +799,8 @@ void* QS60PixmapData::toNativeType(NativeType type) bool needsCopy = false; QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) { - // Convert argb32_premultiplied to argb32 since Symbian 9.2 and Symbian 9.3 do + if (!(S60->supportsPremultipliedAlpha)) { + // Convert argb32_premultiplied to argb32 since Symbian 9.2 does // not support premultipied format. if (image.format() == QImage::Format_ARGB32_Premultiplied) { diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index cb9dda4..656bbc9 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1056,6 +1056,13 @@ void qt_init(QApplicationPrivate * /* priv */, int) TDisplayMode mode = S60->screenDevice()->DisplayMode(); S60->screenDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(mode); + //NB: RWsSession::GetColorModeList tells you what window modes are supported, + //not what bitmap formats. + if(QSysInfo::symbianVersion() == QSysInfo::SV_9_2) + S60->supportsPremultipliedAlpha = 0; + else + S60->supportsPremultipliedAlpha = 1; + RProcess me; TSecureId securId = me.SecureId(); S60->uid = securId.operator TUid(); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index d33791b..e25bc81 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -81,6 +81,9 @@ QT_BEGIN_NAMESPACE // system events seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; +//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 +#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13) + class QS60Data { public: @@ -108,6 +111,7 @@ public: int mouseInteractionEnabled : 1; int virtualMouseRequired : 1; int qtOwnsS60Environment : 1; + int supportsPremultipliedAlpha : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); static inline RWsSession& wsSession(); @@ -199,7 +203,7 @@ inline void QS60Data::updateScreenSize() S60->screenHeightInPixels = params.iPixelSize.iHeight; S60->screenWidthInTwips = params.iTwipsSize.iWidth; S60->screenHeightInTwips = params.iTwipsSize.iHeight; - + S60->virtualMouseMaxAccel = qMax(S60->screenHeightInPixels, S60->screenWidthInPixels) / 20; TReal inches = S60->screenHeightInTwips / (TReal)KTwipsPerInch; @@ -302,11 +306,9 @@ static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode) case EColor16MA: format = QImage::Format_ARGB32; break; -#if !defined(__SERIES60_31__) && !defined(__S60_32__) - case EColor16MAP: + case Q_SYMBIAN_ECOLOR16MAP: format = QImage::Format_ARGB32_Premultiplied; break; -#endif default: format = QImage::Format_Invalid; break; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index cde48d8..d760016 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -747,9 +747,8 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr QPixmap result; // QS60WindowSurface::unlockBitmapHeap(); - static const bool canDoEColor16MAP = !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); - static const TDisplayMode displayMode = canDoEColor16MAP ? TDisplayMode(13) : EColor16MA; // 13 = EColor16MAP - static const TInt drawParam = canDoEColor16MAP ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly; + static const TDisplayMode displayMode = S60->supportsPremultipliedAlpha ? Q_SYMBIAN_ECOLOR16MAP : EColor16MA; + static const TInt drawParam = S60->supportsPremultipliedAlpha ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly; CFbsBitmap *frame = new (ELeave) CFbsBitmap(); //offscreen CleanupStack::PushL(frame); @@ -776,7 +775,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr frameSkinID, centerSkinID, drawParam ); - if (canDoEColor16MAP) { + if (S60->supportsPremultipliedAlpha) { if (drawn) result = fromFbsBitmap(frame, NULL, flags, QImage::Format_ARGB32_Premultiplied); } else { diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 7c3542e..97d6bee 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -2288,7 +2288,7 @@ EXPORTS _ZN13QGestureEvent11setAcceptedEP8QGestureb @ 2287 NONAME _ZN13QGestureEvent6acceptEP8QGesture @ 2288 NONAME _ZN13QGestureEvent6ignoreEP8QGesture @ 2289 NONAME - _ZN13QGestureEvent7gestureEN2Qt11GestureTypeE @ 2290 NONAME + _ZN13QGestureEvent7gestureEN2Qt11GestureTypeE @ 2290 NONAME ABSENT ; MISSING: _ZN13QGestureEventC1ERK5QListIP8QGestureE @ 2291 NONAME _ZN13QGestureEventC2ERK5QListIP8QGestureE @ 2292 NONAME _ZN13QGraphicsItem10addToIndexEv @ 2293 NONAME @@ -2651,8 +2651,8 @@ EXPORTS _ZN13QSwipeGesture13setSwipeAngleEf @ 2650 NONAME _ZN13QSwipeGesture16staticMetaObjectE @ 2651 NONAME DATA 16 _ZN13QSwipeGesture19getStaticMetaObjectEv @ 2652 NONAME - _ZN13QSwipeGesture20setVerticalDirectionENS_14SwipeDirectionE @ 2653 NONAME - _ZN13QSwipeGesture22setHorizontalDirectionENS_14SwipeDirectionE @ 2654 NONAME + _ZN13QSwipeGesture20setVerticalDirectionENS_14SwipeDirectionE @ 2653 NONAME ABSENT ; MISSING: + _ZN13QSwipeGesture22setHorizontalDirectionENS_14SwipeDirectionE @ 2654 NONAME ABSENT ; MISSING: _ZN13QSwipeGestureC1EP7QObject @ 2655 NONAME _ZN13QSwipeGestureC2EP7QObject @ 2656 NONAME _ZN13QTextDocument10adjustSizeEv @ 2657 NONAME @@ -6369,12 +6369,12 @@ EXPORTS _ZN8QGesture15setTargetObjectEP7QObject @ 6368 NONAME _ZN8QGesture16staticMetaObjectE @ 6369 NONAME DATA 16 _ZN8QGesture19getStaticMetaObjectEv @ 6370 NONAME - _ZN8QGestureC1EN2Qt11GestureTypeEP7QObject @ 6371 NONAME + _ZN8QGestureC1EN2Qt11GestureTypeEP7QObject @ 6371 NONAME ABSENT ; MISSING: _ZN8QGestureC1EP7QObject @ 6372 NONAME - _ZN8QGestureC1ER15QGesturePrivateN2Qt11GestureTypeEP7QObject @ 6373 NONAME - _ZN8QGestureC2EN2Qt11GestureTypeEP7QObject @ 6374 NONAME + _ZN8QGestureC1ER15QGesturePrivateN2Qt11GestureTypeEP7QObject @ 6373 NONAME ABSENT ; MISSING: + _ZN8QGestureC2EN2Qt11GestureTypeEP7QObject @ 6374 NONAME ABSENT ; MISSING: _ZN8QGestureC2EP7QObject @ 6375 NONAME - _ZN8QGestureC2ER15QGesturePrivateN2Qt11GestureTypeEP7QObject @ 6376 NONAME + _ZN8QGestureC2ER15QGesturePrivateN2Qt11GestureTypeEP7QObject @ 6376 NONAME ABSENT ; MISSING: _ZN8QGestureD0Ev @ 6377 NONAME _ZN8QGestureD1Ev @ 6378 NONAME _ZN8QGestureD2Ev @ 6379 NONAME @@ -11557,4 +11557,29 @@ EXPORTS qt_pixmap_cleanup_hook @ 11556 NONAME DATA 4 qt_pixmap_cleanup_hook_64 @ 11557 NONAME DATA 4 qt_tab_all_widgets @ 11558 NONAME DATA 1 + _ZN18QGuiPlatformPlugin11qt_metacallEN11QMetaObject4CallEiPPv @ 11559 NONAME + _ZN18QGuiPlatformPlugin11qt_metacastEPKc @ 11560 NONAME + _ZN18QGuiPlatformPlugin12platformHintENS_12PlatformHintE @ 11561 NONAME + _ZN18QGuiPlatformPlugin14fileSystemIconERK9QFileInfo @ 11562 NONAME + _ZN18QGuiPlatformPlugin16staticMetaObjectE @ 11563 NONAME DATA 16 + _ZN18QGuiPlatformPlugin19getStaticMetaObjectEv @ 11564 NONAME + _ZN18QGuiPlatformPlugin19systemIconThemeNameEv @ 11565 NONAME + _ZN18QGuiPlatformPlugin20iconThemeSearchPathsEv @ 11566 NONAME + _ZN18QGuiPlatformPlugin7paletteEv @ 11567 NONAME + _ZN18QGuiPlatformPlugin9styleNameEv @ 11568 NONAME + _ZN18QGuiPlatformPluginC1EP7QObject @ 11569 NONAME + _ZN18QGuiPlatformPluginC2EP7QObject @ 11570 NONAME + _ZN18QGuiPlatformPluginD0Ev @ 11571 NONAME + _ZN18QGuiPlatformPluginD1Ev @ 11572 NONAME + _ZN18QGuiPlatformPluginD2Ev @ 11573 NONAME + _ZN8QGestureC1ER15QGesturePrivateP7QObject @ 11574 NONAME + _ZN8QGestureC2ER15QGesturePrivateP7QObject @ 11575 NONAME + _ZNK13QGestureEvent7gestureEN2Qt11GestureTypeE @ 11576 NONAME + _ZNK18QGuiPlatformPlugin10metaObjectEv @ 11577 NONAME + _ZTI18QGuiPlatformPlugin @ 11578 NONAME + _ZTI27QGuiPlatformPluginInterface @ 11579 NONAME + _ZTV18QGuiPlatformPlugin @ 11580 NONAME + _ZThn8_N18QGuiPlatformPluginD0Ev @ 11581 NONAME + _ZThn8_N18QGuiPlatformPluginD1Ev @ 11582 NONAME + _Z22qt_paint_device_metricPK12QPaintDeviceNS_17PaintDeviceMetricE @ 11583 NONAME diff --git a/src/s60installs/eabi/QtMultimediau.def b/src/s60installs/eabi/QtMultimediau.def index 787ad3a..30f921c 100644 --- a/src/s60installs/eabi/QtMultimediau.def +++ b/src/s60installs/eabi/QtMultimediau.def @@ -115,8 +115,8 @@ EXPORTS _ZN19QAbstractAudioInput6notifyEv @ 114 NONAME _ZN19QVideoSurfaceFormat11setPropertyEPKcRK8QVariant @ 115 NONAME _ZN19QVideoSurfaceFormat11setViewportERK5QRect @ 116 NONAME - _ZN19QVideoSurfaceFormat12setFrameRateERK5QPairIiiE @ 117 NONAME - _ZN19QVideoSurfaceFormat12setFrameRateEii @ 118 NONAME + _ZN19QVideoSurfaceFormat12setFrameRateERK5QPairIiiE @ 117 NONAME ABSENT + _ZN19QVideoSurfaceFormat12setFrameRateEii @ 118 NONAME ABSENT _ZN19QVideoSurfaceFormat12setFrameSizeERK5QSizeNS_12ViewportModeE @ 119 NONAME _ZN19QVideoSurfaceFormat12setFrameSizeEiiNS_12ViewportModeE @ 120 NONAME _ZN19QVideoSurfaceFormat16setYuvColorSpaceENS_13YuvColorSpaceE @ 121 NONAME @@ -275,4 +275,6 @@ EXPORTS _ZThn8_N18QAudioEnginePluginD0Ev @ 274 NONAME _ZThn8_N18QAudioEnginePluginD1Ev @ 275 NONAME _Zls6QDebugRK19QVideoSurfaceFormat @ 276 NONAME + _ZTV28QAudioEngineFactoryInterface @ 277 NONAME ABSENT + _ZN19QVideoSurfaceFormat12setFrameRateEf @ 278 NONAME diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def index f216f85..e561511 100644 --- a/src/s60installs/eabi/QtNetworku.def +++ b/src/s60installs/eabi/QtNetworku.def @@ -989,4 +989,6 @@ EXPORTS _ZlsR11QDataStreamRK21QNetworkCacheMetaData @ 988 NONAME _ZrsR11QDataStreamR12QHostAddress @ 989 NONAME _ZrsR11QDataStreamR21QNetworkCacheMetaData @ 990 NONAME + _ZN15QNetworkRequest20setOriginatingObjectEP7QObject @ 991 NONAME + _ZNK15QNetworkRequest17originatingObjectEv @ 992 NONAME diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def index d0a3e3e..1592664 100644 --- a/src/s60installs/eabi/QtScriptu.def +++ b/src/s60installs/eabi/QtScriptu.def @@ -341,4 +341,5 @@ EXPORTS _ZThn8_N22QScriptExtensionPluginD1Ev @ 340 NONAME _ZlsR11QDataStreamRK18QScriptContextInfo @ 341 NONAME _ZrsR11QDataStreamR18QScriptContextInfo @ 342 NONAME + _Z5qHashRK13QScriptString @ 343 NONAME diff --git a/src/s60installs/eabi/QtXmlu.def b/src/s60installs/eabi/QtXmlu.def index d1ba69d..cc5115c 100644 --- a/src/s60installs/eabi/QtXmlu.def +++ b/src/s60installs/eabi/QtXmlu.def @@ -458,4 +458,3 @@ EXPORTS _ZThn8_N18QXmlDefaultHandler18unparsedEntityDeclERK7QStringS2_S2_S2_ @ 457 NONAME _ZThn8_NK18QXmlDefaultHandler11errorStringEv @ 458 NONAME _ZlsR11QTextStreamRK8QDomNode @ 459 NONAME - diff --git a/src/s60installs/eabi/phononu.def b/src/s60installs/eabi/phononu.def index 651a0b8..af1e3cc 100644 --- a/src/s60installs/eabi/phononu.def +++ b/src/s60installs/eabi/phononu.def @@ -534,4 +534,14 @@ EXPORTS _ZThn8_N6Phonon19AbstractAudioOutputD1Ev @ 533 NONAME _ZThn8_N6Phonon6EffectD0Ev @ 534 NONAME _ZThn8_N6Phonon6EffectD1Ev @ 535 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 536 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 537 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 538 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 539 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 540 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 541 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 542 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 543 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 544 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 545 NONAME diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 36c1518..9f5aee2 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -1144,7 +1144,7 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data() // QTest::newRow("EColor16MA small trans") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 0); // QTest::newRow("EColor16MA big trans") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0, 0); -#if !defined(__SERIES60_31__) && !defined(__S60_32__) +#if !defined(__SERIES60_31__) QTest::newRow("EColor16MAP small") << EColor16MAP << smallWidth << smallHeight << QColor(Qt::red); QTest::newRow("EColor16MAP big") << EColor16MAP << largeWidth << largeHeight << QColor(Qt::red); #endif |