skins/AknSkins/srvsrc/AknsSrvWallpaperCache.cpp
branchRCL_3
changeset 58 a2f9480e2280
parent 45 6ef40bf8fd34
child 106 e4e3998ddda2
--- a/skins/AknSkins/srvsrc/AknsSrvWallpaperCache.cpp	Tue May 11 17:09:13 2010 +0300
+++ b/skins/AknSkins/srvsrc/AknsSrvWallpaperCache.cpp	Tue May 25 13:47:21 2010 +0300
@@ -61,7 +61,6 @@
 TAknsSrvWallpaper* CAknsSrvWallpaperCache::AddL( RFs& aRFs, const TDesC& aFileName, 
         const TSize aTrgSize, const TSize aMaxSize )
     {
-    
     if ( aFileName.Length() == 0 )
         {
         return NULL;
@@ -73,100 +72,58 @@
         return NULL;
         }
     
-    TBool cached = EFalse;
     TAknsSrvWallpaper* wp = NULL;
-    
     wp = CachedImage( aFileName );
-    if ( !wp )
+    if ( wp )
         {
-        wp = new ( ELeave ) TAknsSrvWallpaper;
-        ZeroItem ( *wp );
-        CleanupStack::PushL( wp );
+        return wp;
         }
-    else
-        {
-        cached = ETrue;
-        }
+
+    wp = new ( ELeave ) TAknsSrvWallpaper;
+    ZeroItem ( *wp );
+    CleanupStack::PushL( wp );
 
     
     _LIT( KSvgFileExt, ".svg" );
     TBool isSvgFormat = aFileName.Right(4).CompareF( KSvgFileExt ) == 0;
     
-    TBool needDecodePortrait = EFalse;
-    TBool needDecodeLandscape = EFalse;    
+    TSize prtSize, lscSize;
 
     if( aTrgSize.iHeight >= aTrgSize.iWidth ) //Portait
         {
-        if ( aTrgSize != iPrtSize || ( !wp->iPortrait && !wp->iPortraitMask) )
-            {
-            needDecodePortrait = ETrue;
-            iPrtSize = aTrgSize;
-            }
+        prtSize = aTrgSize;
+        lscSize = TSize( aTrgSize.iHeight, aTrgSize.iWidth );
         }
     else //Landscape
         {
-        if ( aTrgSize != iLscSize || ( !wp->iLandscape && !wp->iLandscapeMask ) )
-            {
-            needDecodeLandscape = ETrue;
-            iLscSize = aTrgSize;
-            }
+        prtSize = TSize( aTrgSize.iHeight, aTrgSize.iWidth );
+        lscSize = aTrgSize;
         }
     
     if( isSvgFormat )   
         {
-        if( needDecodePortrait )
-            {
-            CAknsSrvSVGImageDecoder* svgdecoder = CAknsSrvSVGImageDecoder::NewL();
-            CleanupStack::PushL( svgdecoder );
-            svgdecoder->DecodeImageL(
-                aFileName,
-                aTrgSize,
-                wp->iPortrait,
-                wp->iPortraitMask );
-            CleanupStack::PopAndDestroy( svgdecoder );
-            }
-        if( needDecodeLandscape )
-            {
-            CAknsSrvSVGImageDecoder* svgdecoder = CAknsSrvSVGImageDecoder::NewL();
-            CleanupStack::PushL( svgdecoder );
-            svgdecoder->DecodeImageL(
-                aFileName,
-                aTrgSize,
-                wp->iLandscape,
-                wp->iLandscapeMask );
-            CleanupStack::PopAndDestroy( svgdecoder );
-            }
+        CAknsSrvSVGImageDecoder* svgdecoder = CAknsSrvSVGImageDecoder::NewL();
+        CleanupStack::PushL( svgdecoder );
+        svgdecoder->DecodeImageL( aFileName, prtSize, wp->iPortrait,
+            wp->iPortraitMask );
+        svgdecoder->DecodeImageL( aFileName, lscSize, wp->iLandscape,
+            wp->iLandscapeMask );
+        CleanupStack::PopAndDestroy( svgdecoder );
         }
     else
         {
-        if( needDecodePortrait )
-            {
-            CAknsSrvImageConverter::DecodeImageL(
-                aRFs,
-                aFileName,
-                aTrgSize,
-                wp->iPortrait,
-                wp->iPortraitMask,
-                aMaxSize );
-            }
-        if( needDecodeLandscape )
-            {
-            CAknsSrvImageConverter::DecodeImageL(
-                aRFs,
-                aFileName,
-                aTrgSize,
-                wp->iLandscape,
-                wp->iLandscapeMask,
-                aMaxSize );
-            }
+        CAknsSrvImageConverter::DecodeImageL( aRFs, aFileName, prtSize,
+            wp->iPortrait, wp->iPortraitMask, aMaxSize );
+        CAknsSrvImageConverter::DecodeImageL( aRFs, aFileName, lscSize,
+            wp->iLandscape, wp->iLandscapeMask, aMaxSize );
         }
+
     wp->iName.Copy( aFileName );
-    if ( !cached )
-        {
-        RemoveOldestItem();        
-        iCache.Append( wp );
-        CleanupStack::Pop( wp ); 
-        }
+
+    RemoveOldestItem();
+    iCache.Append( wp );
+    CleanupStack::Pop( wp ); 
+
     return wp;
     }