idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp
branchRCL_3
changeset 18 d05a55b217df
parent 17 b8fae6b8a148
child 19 79311d856354
equal deleted inserted replaced
17:b8fae6b8a148 18:d05a55b217df
   139     iFsSession.Close();
   139     iFsSession.Close();
   140     delete iBgContext;
   140     delete iBgContext;
   141     delete iBgImage;
   141     delete iBgImage;
   142     delete iBgImagePath;
   142     delete iBgImagePath;
   143     delete iOomSysHandler;
   143     delete iOomSysHandler;
       
   144     delete iSpMask;   
   144     }
   145     }
   145 
   146 
   146 // -----------------------------------------------------------------------------
   147 // -----------------------------------------------------------------------------
   147 // CXnBackgroundManager::Draw
   148 // CXnBackgroundManager::Draw
   148 // -----------------------------------------------------------------------------
   149 // -----------------------------------------------------------------------------
   180             }
   181             }
   181         else
   182         else
   182             {
   183             {
   183             SystemGc().DrawBitmap( iRect, wallpaper );
   184             SystemGc().DrawBitmap( iRect, wallpaper );
   184             }
   185             }
   185 	        DrawStatusPaneMask();		
   186         DrawStatusPaneMask();
   186         }
   187         }
   187     
   188     
   188     // Skin bg is used by default
   189     // Skin bg is used by default
   189     else
   190     else
   190         {  
   191         {  
   218             iBgImage = NULL;
   219             iBgImage = NULL;
   219             TRAP_IGNORE( iBgImage = iSkinSrv.WallpaperImageL( *iBgImagePath ) );
   220             TRAP_IGNORE( iBgImage = iSkinSrv.WallpaperImageL( *iBgImagePath ) );
   220             }
   221             }
   221         }
   222         }
   222     iBgContext->SetRect( iRect );
   223     iBgContext->SetRect( iRect );
       
   224     
       
   225     // create status pane mask image and set size
       
   226     if( iSpMask )
       
   227         {
       
   228         delete iSpMask;
       
   229         iSpMask = NULL;
       
   230         }
       
   231     
       
   232     TRect spRect;
       
   233     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, spRect );
       
   234     
       
   235     TInt err( KErrNone );    
       
   236     
       
   237     if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   238         {
       
   239         TRAP( err, iSpMask = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
       
   240                 KAknsIIDQgnGrafBgLscTopMaskIcon ) );
       
   241         }
       
   242     else
       
   243         {
       
   244         TRAP( err, iSpMask = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
       
   245                 KAknsIIDQgnGrafBgPrtTopMaskIcon ) );        
       
   246         }
       
   247     
       
   248     if( iSpMask )
       
   249         {
       
   250         AknIconUtils::SetSize( iSpMask, spRect.Size(), EAspectRatioNotPreserved );
       
   251         }
   223     }
   252     }
   224 
   253 
   225 // -----------------------------------------------------------------------------
   254 // -----------------------------------------------------------------------------
   226 // CXnBackgroundManager::MakeVisible
   255 // CXnBackgroundManager::MakeVisible
   227 // -----------------------------------------------------------------------------
   256 // -----------------------------------------------------------------------------
   509             {
   538             {
   510             AddWallpaperL( KNullDesC );
   539             AddWallpaperL( KNullDesC );
   511             }
   540             }
   512         else if ( selectedIndex == 1 )
   541         else if ( selectedIndex == 1 )
   513             {
   542             {
   514             if ( CXnOomSysHandler::HeapAvailable( CXnOomSysHandler::EMem2MB ) )
   543             if ( CXnOomSysHandler::HeapAvailable( CXnOomSysHandler::EMem6MB ) )
   515                 {
   544                 {
   516             CXnAppUiAdapter& appui( iViewManager.AppUiAdapter() );
   545             CXnAppUiAdapter& appui( iViewManager.AppUiAdapter() );
   517             
   546             
   518             appui.EffectManager()->BeginFullscreenEffectL(
   547             appui.EffectManager()->BeginFullscreenEffectL(
   519                 KGfxContextOpenWallpaperView, iViewManager.ActiveViewData() );        
   548                 KGfxContextOpenWallpaperView, iViewManager.ActiveViewData() );        
   672             const TDesC& path = viewData->WallpaperImagePath();
   701             const TDesC& path = viewData->WallpaperImagePath();
   673             CFbsBitmap* bitmap = viewData->WallpaperImage();
   702             CFbsBitmap* bitmap = viewData->WallpaperImage();
   674             if( path != KNullDesC && !bitmap )
   703             if( path != KNullDesC && !bitmap )
   675                 {
   704                 {
   676                 TInt err = CacheWallpaperL( path, *viewData );
   705                 TInt err = CacheWallpaperL( path, *viewData );
   677                 if( err == KErrNone )
   706                 if( err == KErrNone && viewData == &iViewManager.ActiveViewData() )
   678                     {
   707                     {
   679                     drawingNeeded = ETrue;
   708                     drawingNeeded = ETrue;
   680                     }
   709                     }
   681                 }
   710                 }
   682             }
   711             }
   683         if( drawingNeeded )
   712         if( drawingNeeded )
   684             {
   713             {
   685             UpdateScreen();
   714             UpdateScreen();
       
   715             
       
   716             TInt err = AknsWallpaperUtils::SetIdleWallpaper( 
       
   717                 iViewManager.ActiveViewData().WallpaperImagePath(), NULL );
       
   718             if( err == KErrNone )
       
   719                 {
       
   720                 iIntUpdate++;
       
   721                 }   
   686             }    
   722             }    
   687         }
   723         }
   688     else
   724     else
   689         {
   725         {
   690         if( iBgImagePath )
   726         if( iBgImagePath )
   946 // CXnBackgroundManager::DrawStatusPaneMask
   982 // CXnBackgroundManager::DrawStatusPaneMask
   947 // -----------------------------------------------------------------------------
   983 // -----------------------------------------------------------------------------
   948 //
   984 //
   949 void CXnBackgroundManager::DrawStatusPaneMask() const
   985 void CXnBackgroundManager::DrawStatusPaneMask() const
   950     {
   986     {
   951     TRect spRect;
   987     if( iSpMask )
   952     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, spRect );
   988         {
   953     
   989         TSize bmpSize = iSpMask->SizeInPixels();
   954     CFbsBitmap* maskBmp( NULL );
   990         TRect spRect( 0, 0, bmpSize.iWidth, bmpSize.iHeight );
   955     TInt err( KErrNone );
   991         SystemGc().DrawBitmap( spRect, iSpMask );
   956     
       
   957     if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   958         {
       
   959         TRAP( err, maskBmp = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
       
   960                 KAknsIIDQgnGrafBgLscTopMaskIcon ) );
       
   961         }
       
   962     else
       
   963         {
       
   964         TRAP( err, maskBmp = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
       
   965                 KAknsIIDQgnGrafBgPrtTopMaskIcon ) );        
       
   966         }
       
   967     
       
   968     if( err )
       
   969         {
       
   970         return;
       
   971         }
       
   972     
       
   973     // draw mask
       
   974     if( maskBmp )
       
   975         {
       
   976         AknIconUtils::SetSize( maskBmp, spRect.Size(), EAspectRatioNotPreserved );
       
   977         SystemGc().DrawBitmap( spRect, maskBmp );
       
   978         delete maskBmp;        
       
   979         }
   992         }
   980     }
   993     }
   981 
   994 
   982 // -----------------------------------------------------------------------------
   995 // -----------------------------------------------------------------------------
   983 // CXnBackgroundManager::OOMSysHandler
   996 // CXnBackgroundManager::OOMSysHandler