diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmportalbutton.cpp --- a/idlehomescreen/widgetmanager/src/wmportalbutton.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmportalbutton.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -35,6 +35,7 @@ #include #include +#include "wmimageconverter.h" #include "wmportalbutton.h" #include "wmcommon.h" #include "wmplugin.h" @@ -139,10 +140,13 @@ KAknsIIDQsnFrButtonCenterInactive ); // start image converter for the icon - iImageConverter = CWmImageConverter::NewL( this ); + iImageConverter = CWmImageConverter::NewL(); TSize iconsize( LayoutIconSize() ); iImageConverter->HandleIconString( - iconsize.iWidth, iconsize.iHeight, aIcon ); + iconsize, + aIcon, + iButtonIcon, + iButtonIconMask ); // observe our own press events SetObserver( this ); @@ -351,11 +355,12 @@ // resize icon if ( iButtonIcon && iButtonIconMask ) { - TSize size = LayoutIconSize(); - AknIconUtils::SetSize( - iButtonIcon, size, EAspectRatioPreserved ); - AknIconUtils::SetSize( - iButtonIconMask, size, EAspectRatioPreserved ); + iImageConverter->UpdateImageSize( + LayoutIconSize(), + iWmMainContainer->Configuration().PortalButtonIcon( + iPortalButtonIndex ), + *iButtonIcon, + *iButtonIconMask ); } TBool landscape = Layout_Meta_Data::IsLandscapeOrientation(); @@ -364,43 +369,6 @@ } // --------------------------------------------------------- -// CWmPortalButton::NotifyCompletion -// --------------------------------------------------------- -// -void CWmPortalButton::NotifyCompletion( TInt aError ) - { - if ( KErrNone == aError ) - { - // take ownership of icon - delete iButtonIcon; - iButtonIcon = NULL; - iButtonIcon = iImageConverter->Bitmap(); - delete iButtonIconMask; - iButtonIconMask = NULL; - iButtonIconMask = iImageConverter->Mask(); - if ( iButtonIcon && iButtonIconMask ) - { - TSize size = LayoutIconSize(); - if ( iButtonIcon->SizeInPixels() != size ) - { - AknIconUtils::SetSize( - iButtonIcon, size, EAspectRatioPreserved ); - } - if ( iButtonIconMask->SizeInPixels() != size ) - { - AknIconUtils::SetSize( - iButtonIconMask, size, EAspectRatioPreserved ); - } - DrawDeferred(); - } - } - else - { - // no image available. Do nothing. - } - } - -// --------------------------------------------------------- // CWmPortalButton::Draw // --------------------------------------------------------- // @@ -468,7 +436,13 @@ imageLayout.LayoutRect( rect, AknLayoutScalable_Apps ::wgtman_btn_pane_g1( variety ).LayoutLine() ); } - imageLayout.DrawImage( gc, iButtonIcon, iButtonIconMask ); + + gc.DrawBitmapMasked( + imageLayout.Rect(), + iButtonIcon, + TRect(TPoint( 0, 0 ), iButtonIcon->SizeInPixels() ), + iButtonIconMask, + EFalse ); } // draw text if portrait