diff options
author | Sami Merila <sami.merila@nokia.com> | 2011-08-31 06:50:34 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2011-08-31 06:50:34 (GMT) |
commit | c9b243870d21f1070b073faf7e9df524fc3f123a (patch) | |
tree | 4e230b9452e6f1806192901bf3ccdffb585f4281 /src/gui | |
parent | 06f67c6a0bbf5ca4d91fff8d04d5036f5ae1e827 (diff) | |
download | Qt-c9b243870d21f1070b073faf7e9df524fc3f123a.zip Qt-c9b243870d21f1070b073faf7e9df524fc3f123a.tar.gz Qt-c9b243870d21f1070b073faf7e9df524fc3f123a.tar.bz2 |
Improve robustness of QS60Style when creating native theme bitmaps
Three robustness improvements:
a) When doing a compatibility check for a style part, make check
always pass if the part is supported by all platform versions.
b) Re-attempt icon creation without a mask, if creation with
mask fails.
c) Paint theme background with white (instead of just giving up)
in error cases.
Task-number: QTBUG-21119
Reviewed-by: Miikka Heikkinen
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 33619d6..489ad09 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -929,6 +929,16 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( fallbackGraphicID , fallbackGraphicsMaskID); + // If drawing fails, re-try without a mask. + if (!icon) { + AknsUtils::CreateIconL( + skinInstance, + skinId, + icon, + (fallbackGraphicID != KErrNotFound ? AknIconUtils::AvkonIconFileName() : KNullDesC), + fallbackGraphicID); + } + result = fromFbsBitmap(icon, iconMask, flags, targetSize); delete icon; delete iconMask; @@ -961,9 +971,14 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( targetSize, drawParam); - if (drawn) + if (drawn) { result = fromFbsBitmap(background, NULL, flags, targetSize); - // if drawing fails in skin server, just ignore the background (probably OOM case) + } else { + // if drawing fails in skin server, draw background as white + QPixmap defaultBg = QPixmap(targetSize.iWidth, targetSize.iHeight); + defaultBg.fill(Qt::white); + result = defaultBg; + } CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext // QS60WindowSurface::lockBitmapHeap(); @@ -1225,6 +1240,9 @@ TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameEl bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease) { + if (supportedRelease == ES60_All) + return true; + const QSysInfo::S60Version currentRelease = QSysInfo::s60Version(); return ( (currentRelease == QSysInfo::SV_S60_3_1 && supportedRelease & ES60_3_1) || (currentRelease == QSysInfo::SV_S60_3_2 && supportedRelease & ES60_3_2) || |