idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp
branchRCL_3
changeset 34 d05a55b217df
parent 30 b8fae6b8a148
child 38 79311d856354
--- a/idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp	Wed Mar 31 21:17:19 2010 +0300
+++ b/idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp	Wed Apr 14 15:47:59 2010 +0300
@@ -141,6 +141,7 @@
     delete iBgImage;
     delete iBgImagePath;
     delete iOomSysHandler;
+    delete iSpMask;   
     }
 
 // -----------------------------------------------------------------------------
@@ -182,7 +183,7 @@
             {
             SystemGc().DrawBitmap( iRect, wallpaper );
             }
-	        DrawStatusPaneMask();		
+        DrawStatusPaneMask();
         }
     
     // Skin bg is used by default
@@ -220,6 +221,34 @@
             }
         }
     iBgContext->SetRect( iRect );
+    
+    // create status pane mask image and set size
+    if( iSpMask )
+        {
+        delete iSpMask;
+        iSpMask = NULL;
+        }
+    
+    TRect spRect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, spRect );
+    
+    TInt err( KErrNone );    
+    
+    if( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        TRAP( err, iSpMask = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
+                KAknsIIDQgnGrafBgLscTopMaskIcon ) );
+        }
+    else
+        {
+        TRAP( err, iSpMask = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
+                KAknsIIDQgnGrafBgPrtTopMaskIcon ) );        
+        }
+    
+    if( iSpMask )
+        {
+        AknIconUtils::SetSize( iSpMask, spRect.Size(), EAspectRatioNotPreserved );
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -511,7 +540,7 @@
             }
         else if ( selectedIndex == 1 )
             {
-            if ( CXnOomSysHandler::HeapAvailable( CXnOomSysHandler::EMem2MB ) )
+            if ( CXnOomSysHandler::HeapAvailable( CXnOomSysHandler::EMem6MB ) )
                 {
             CXnAppUiAdapter& appui( iViewManager.AppUiAdapter() );
             
@@ -674,7 +703,7 @@
             if( path != KNullDesC && !bitmap )
                 {
                 TInt err = CacheWallpaperL( path, *viewData );
-                if( err == KErrNone )
+                if( err == KErrNone && viewData == &iViewManager.ActiveViewData() )
                     {
                     drawingNeeded = ETrue;
                     }
@@ -683,6 +712,13 @@
         if( drawingNeeded )
             {
             UpdateScreen();
+            
+            TInt err = AknsWallpaperUtils::SetIdleWallpaper( 
+                iViewManager.ActiveViewData().WallpaperImagePath(), NULL );
+            if( err == KErrNone )
+                {
+                iIntUpdate++;
+                }   
             }    
         }
     else
@@ -948,34 +984,11 @@
 //
 void CXnBackgroundManager::DrawStatusPaneMask() const
     {
-    TRect spRect;
-    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, spRect );
-    
-    CFbsBitmap* maskBmp( NULL );
-    TInt err( KErrNone );
-    
-    if( Layout_Meta_Data::IsLandscapeOrientation() )
-        {
-        TRAP( err, maskBmp = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
-                KAknsIIDQgnGrafBgLscTopMaskIcon ) );
-        }
-    else
+    if( iSpMask )
         {
-        TRAP( err, maskBmp = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
-                KAknsIIDQgnGrafBgPrtTopMaskIcon ) );        
-        }
-    
-    if( err )
-        {
-        return;
-        }
-    
-    // draw mask
-    if( maskBmp )
-        {
-        AknIconUtils::SetSize( maskBmp, spRect.Size(), EAspectRatioNotPreserved );
-        SystemGc().DrawBitmap( spRect, maskBmp );
-        delete maskBmp;        
+        TSize bmpSize = iSpMask->SizeInPixels();
+        TRect spRect( 0, 0, bmpSize.iWidth, bmpSize.iHeight );
+        SystemGc().DrawBitmap( spRect, iSpMask );
         }
     }