src/gui/styles/qs60style_s60.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 22 79de32ba3296
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
   753                 targetSize,
   753                 targetSize,
   754                 KAknsDrawParamDefault | KAknsDrawParamRGBOnly);
   754                 KAknsDrawParamDefault | KAknsDrawParamRGBOnly);
   755 
   755 
   756             if (drawn)
   756             if (drawn)
   757                 result = fromFbsBitmap(background, NULL, flags, targetSize);
   757                 result = fromFbsBitmap(background, NULL, flags, targetSize);
   758             // if drawing fails in skin server, just ignore the background (probably OOM occured)
   758             // if drawing fails in skin server, just ignore the background (probably OOM case)
   759 
   759 
   760             CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext
   760             CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext
   761     //        QS60WindowSurface::lockBitmapHeap();
   761     //        QS60WindowSurface::lockBitmapHeap();
   762             break;
   762             break;
   763         }
   763         }
   785                 constructedFromTheme = !animation->isResourceBased();
   785                 constructedFromTheme = !animation->isResourceBased();
   786             }
   786             }
   787 
   787 
   788             const int currentFrame = QS60StylePrivate::currentAnimationFrame(part);
   788             const int currentFrame = QS60StylePrivate::currentAnimationFrame(part);
   789             if (constructedFromTheme && aknAnimation && aknAnimation->BitmapAnimData()->FrameArray().Count() > 0) {
   789             if (constructedFromTheme && aknAnimation && aknAnimation->BitmapAnimData()->FrameArray().Count() > 0) {
   790                 //Animation was created succesfully and contains frames, just fetch current frame
   790                 //Animation was created successfully and contains frames, just fetch current frame
   791                 if(currentFrame >= aknAnimation->BitmapAnimData()->FrameArray().Count())
   791                 if(currentFrame >= aknAnimation->BitmapAnimData()->FrameArray().Count())
   792                     User::Leave(KErrOverflow);
   792                     User::Leave(KErrOverflow);
   793                 const CBitmapFrameData* frameData = aknAnimation->BitmapAnimData()->FrameArray().At(currentFrame);
   793                 const CBitmapFrameData* frameData = aknAnimation->BitmapAnimData()->FrameArray().At(currentFrame);
   794                 if (frameData) {
   794                 if (frameData) {
   795                     animationFrame = frameData->Bitmap();
   795                     animationFrame = frameData->Bitmap();
   857     CleanupStack::PushL(bitmapDev);
   857     CleanupStack::PushL(bitmapDev);
   858     CFbsBitGc* bitmapGc = NULL;
   858     CFbsBitGc* bitmapGc = NULL;
   859     User::LeaveIfError(bitmapDev->CreateContext(bitmapGc));
   859     User::LeaveIfError(bitmapDev->CreateContext(bitmapGc));
   860     CleanupStack::PushL(bitmapGc);
   860     CleanupStack::PushL(bitmapGc);
   861 
   861 
   862 #ifndef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
       
   863     frame->LockHeap();
   862     frame->LockHeap();
   864     memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4);  // 4: argb bytes
   863     memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4);  // 4: argb bytes
   865     frame->UnlockHeap();
   864     frame->UnlockHeap();
   866 #endif
       
   867 
   865 
   868     const TRect outerRect(TPoint(0, 0), targetSize);
   866     const TRect outerRect(TPoint(0, 0), targetSize);
   869     const TRect innerRect = innerRectFromElement(frameElement, outerRect);
   867     const TRect innerRect = innerRectFromElement(frameElement, outerRect);
   870 
   868 
   871     TAknsItemID frameSkinID, centerSkinID;
   869     TAknsItemID frameSkinID, centerSkinID;
   976     }
   974     }
   977 }
   975 }
   978 
   976 
   979 TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect)
   977 TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect)
   980 {
   978 {
   981     TInt widthShrink = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth);
   979     TInt widthShrink = QS60StylePrivate::pixelMetric(PM_FrameCornerWidth);
   982     TInt heightShrink = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerHeight);
   980     TInt heightShrink = QS60StylePrivate::pixelMetric(PM_FrameCornerHeight);
   983     switch(frameElement) {
   981     switch(frameElement) {
   984         case QS60StylePrivate::SF_PanelBackground:
   982         case QS60StylePrivate::SF_PanelBackground:
   985             // panel should have slightly slimmer border to enable thin line of background graphics between closest component
   983             // panel should have slightly slimmer border to enable thin line of background graphics between closest component
   986             widthShrink = widthShrink-2;
   984             widthShrink = widthShrink - 2;
   987             heightShrink = heightShrink-2;
   985             heightShrink = heightShrink - 2;
   988             break;
   986             break;
   989         case QS60StylePrivate::SF_ToolTip:
   987         case QS60StylePrivate::SF_ToolTip:
   990             widthShrink = widthShrink>>1;
   988             widthShrink = widthShrink >> 1;
   991             heightShrink = heightShrink>>1;
   989             heightShrink = heightShrink >> 1;
   992             break;
   990             break;
   993         case QS60StylePrivate::SF_ListHighlight:
   991         case QS60StylePrivate::SF_ListHighlight:
   994             widthShrink = widthShrink-2;
   992             widthShrink = widthShrink - 2;
   995             heightShrink = heightShrink-2;
   993             heightShrink = heightShrink - 2;
       
   994             break;
       
   995         case QS60StylePrivate::SF_PopupBackground:
       
   996             widthShrink = widthShrink + 5;
       
   997             heightShrink = heightShrink + 5;
   996             break;
   998             break;
   997         default:
   999         default:
   998             break;
  1000             break;
   999     }
  1001     }
  1000     TRect innerRect(outerRect);
  1002     TRect innerRect(outerRect);
  1094 
  1096 
  1095         activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 2;
  1097         activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 2;
  1096         activeLayoutIndex += (!landscape) ? 1 : 0;
  1098         activeLayoutIndex += (!landscape) ? 1 : 0;
  1097     }
  1099     }
  1098 
  1100 
  1099     m_pmPointer = data[activeLayoutIndex];
  1101     setCurrentLayout(activeLayoutIndex);
  1100 }
  1102 }
  1101 
  1103 
  1102 Q_GLOBAL_STATIC(QList<QS60StyleAnimation *>, m_animations)
  1104 Q_GLOBAL_STATIC(QList<QS60StyleAnimation *>, m_animations)
  1103 
  1105 
  1104 QS60StylePrivate::QS60StylePrivate()
  1106 QS60StylePrivate::QS60StylePrivate()
  1119         &KAknsIIDQsnLineColors,
  1121         &KAknsIIDQsnLineColors,
  1120         &KAknsIIDQsnOtherColors,
  1122         &KAknsIIDQsnOtherColors,
  1121         &KAknsIIDQsnParentColors,
  1123         &KAknsIIDQsnParentColors,
  1122         &KAknsIIDQsnTextColors
  1124         &KAknsIIDQsnTextColors
  1123     };
  1125     };
  1124     Q_ASSERT((int)list <= (int)sizeof(idMap)/sizeof(idMap[0]));
  1126     Q_ASSERT((int)list < (int)sizeof(idMap)/sizeof(idMap[0]));
  1125     const QColor color = QS60StyleModeSpecifics::colorValue(*idMap[(int) list], index - 1);
  1127     const QColor color = QS60StyleModeSpecifics::colorValue(*idMap[(int) list], index - 1);
  1126     return option ? QS60StylePrivate::stateColor(color, option) : color;
  1128     return option ? QS60StylePrivate::stateColor(color, option) : color;
  1127 }
  1129 }
  1128 
  1130 
  1129 // In some cases, the AVKON UI themegraphic is already in 'disabled state'.
  1131 // In some cases, the AVKON UI themegraphic is already in 'disabled state'.