uiacceltk/hitchcock/Client/src/alfimageloaderutil.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Utility for loading skin graphics.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "alf/alfimageloaderutil.h"
       
    22 #include "alf/alfbitmapprovider.h"
       
    23 #include "alf/alfstatic.h"
       
    24 #include "alf/alfenv.h"
       
    25 #include <SVGEngineInterfaceImpl.h>
       
    26 #include <SVGRequestObserver.h>
       
    27 #include <AknsItemData.h>
       
    28 #include <AknsUtils.h>
       
    29 
       
    30 #include <uiacceltk/HuiUtil.h>
       
    31 
       
    32 // Set this flag to ETrue if autosize textures need to be exluded from Avkon
       
    33 // icon cache, e.g. because it get filled with different size variants of same icon.
       
    34 // Excluding is likely to decrease texture upload performance.
       
    35 const TBool KExcludeAutosizeTextureIconsFromAvkonIconCache = EFalse;
       
    36 
       
    37 const TInt KSkinFrameBorderWidthDefaultValue = 8;
       
    38 const TInt KSkinFrameBorderWidthSmallValue = 4;
       
    39 const TInt KSkinFrameBorderWidthSmallestValue = 1;
       
    40 const TInt KSkinFrameWidthMinValue = 1;
       
    41 
       
    42 const TInt KAlfImageLoaderDefaultWidth = 4;
       
    43 const TInt KAlfImageLoaderDefaultHeight = 4;
       
    44 const TScaleMode KAlfImageLoaderDefaultScaleMode = EAspectRatioPreserved;
       
    45 
       
    46 struct TAlfProvidedBitmap
       
    47     {
       
    48     TInt iId;
       
    49     TSize iPreferredSize;        
       
    50     };
       
    51 
       
    52 /**
       
    53  * Base class of the image loader classes
       
    54  */
       
    55 class CAlfImageLoader: public CBase, public MAlfBitmapProvider, public MAlfTextureAutoSizeObserver
       
    56 	{
       
    57 public:
       
    58 	CAlfImageLoader();
       
    59 
       
    60     ~CAlfImageLoader();
       
    61 
       
    62     /**
       
    63      * Set size of the icon. This must be called before creating texture.
       
    64      * This call only sets information and dees *NOT* cause any scalable icon rasterization.
       
    65      *
       
    66      * @param aSize     Size in pixel.
       
    67      */
       
    68 	void SetSize(TSize aSize) {iSize = aSize;}
       
    69 
       
    70 	void SetScaleMode(TScaleMode aScaleMode) {iScaleMode = aScaleMode;}
       
    71 
       
    72     /**
       
    73      * Set skin instance, which is acquired from AknsUtils::SkinInstance().
       
    74      *
       
    75      * @param aSkinInstance     An Avkon skin instamce.
       
    76      */
       
    77 	void SetSkinInstance(MAknsSkinInstance *aSkinInstance) {iSkinInstance = aSkinInstance;}
       
    78 
       
    79 public:
       
    80     // From MHuiBitmapProvider
       
    81 	virtual void ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap) ;
       
    82 
       
    83     // From MHuiTextureAutoSizeObserver
       
    84     virtual TBool PreferredSizeChanged(const CAlfTexture& aChangedTexture, TSize aPreferredSize);
       
    85 
       
    86 protected:
       
    87 	MAknsSkinInstance* GetValidSkinInstance();
       
    88     TSize PreferredSize(TInt aId) const;
       
    89 
       
    90 protected:
       
    91 	// common source info data
       
    92 	MAknsSkinInstance *iSkinInstance;
       
    93 	TSize iSize;
       
    94 	TScaleMode iScaleMode;
       
    95 	RArray<TAlfProvidedBitmap> iProvidedBitmaps;
       
    96 	TBool iExcludeFromAvkonIconCache;
       
    97 	};
       
    98 
       
    99 
       
   100 /**
       
   101  * Image loader utility for skin item image loading.
       
   102  *
       
   103  */
       
   104 NONSHARABLE_CLASS(CAlfSkinItemImageLoader): public CAlfImageLoader
       
   105 {
       
   106 public:
       
   107 
       
   108     /**
       
   109      * Default constructor      
       
   110      */
       
   111     CAlfSkinItemImageLoader();
       
   112 
       
   113     /**
       
   114      * Construct an icon source information with Avkon skin item ID. AknsUtils::CreateIconL()
       
   115      * will be called in RAlfImageLoaderUtil::CreateIconL().
       
   116      *
       
   117      * @param aInstance     Skin instance.
       
   118      * @param aID  An ID of the graphical item (e.g. an icon).
       
   119      * @param aBitmapId  ID of the bitmap when fallback is used.
       
   120      * @param aMaskId  ID of the mask bitmap when fallback is used.
       
   121      */
       
   122     CAlfSkinItemImageLoader( const TAknsItemID &aID, TInt aBitmapId, TInt aMaskId );
       
   123 
       
   124     /**
       
   125      * Construct an icon source information with Avkon skin item ID. AknsUtils::CreateIconL()
       
   126      * will be called in RAlfImageLoaderUtil::CreateIconL().
       
   127      *
       
   128      * @param aFileName  File name of graphics file e.g. mif file) when sepcified item is not found in the current skin.
       
   129      */
       
   130 	void ConstructL( const TDesC &aFileName );
       
   131 
       
   132 	/**
       
   133      * Destructor
       
   134      */		
       
   135 	~CAlfSkinItemImageLoader();
       
   136 
       
   137     /**
       
   138      * Implementation of MAlfBitmapProvider interface.
       
   139      *
       
   140      * @param aId     A unique ID of the texture needed to provide bitmaps.
       
   141      * @param aBitmap     A bitmap.
       
   142      * @param aMaskBitmap     A mask bitmap.
       
   143      */
       
   144 	virtual void ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap) ;
       
   145 
       
   146 protected:
       
   147 	TAknsItemID iId;
       
   148 	HBufC* iFileName;
       
   149 	TInt iBitmapId;
       
   150 	TInt iMaskId;
       
   151 };
       
   152 
       
   153 
       
   154 /**
       
   155  * Image loader utility for skin frame item image loading.
       
   156  *
       
   157  */
       
   158 NONSHARABLE_CLASS(CAlfSkinFrameItemImageLoader): public CAlfSkinItemImageLoader
       
   159 {
       
   160 public:
       
   161 
       
   162     enum TFrameParts
       
   163             {
       
   164             EFramePartCornerTl = 0,
       
   165             EFramePartCornerTr,
       
   166             EFramePartCornerBl, 
       
   167             EFramePartCornerBr,
       
   168             EFramePartSideT,
       
   169             EFramePartSideB,
       
   170             EFramePartSideL,
       
   171             EFramePartSideR,
       
   172             EFramePartCenter
       
   173             };
       
   174             
       
   175     /**
       
   176      * Create MAlfBitmapProvider instance to load frame image with Avkon skin item ID.
       
   177      * @param aFrameID  An Akvon skin item ID of the graphical frame item to load.
       
   178      * @param aInnerRect Inner rect of the frame
       
   179      * @param aOuterRect Outer rect of the frame
       
   180      */
       
   181     CAlfSkinFrameItemImageLoader( const TAknsItemID &aFrameID, const TRect& aInnerRect, const TRect& aOuterRect );
       
   182 
       
   183     /**
       
   184      * Construct an icon source information with Avkon skin item ID. AknsUtils::CreateIconL()
       
   185      * will be called in RAlfImageLoaderUtil::CreateIconL().
       
   186      *
       
   187      * @param aFileName  File name of graphics file e.g. mif file) when sepcified item is not found in the current skin.
       
   188      * @param aBitmapId  ID of the bitmap when fallback is used.
       
   189      * @param aMaskId  ID of the mask bitmap when fallback is used.
       
   190      */
       
   191 	void ConstructL( const TDesC &aFileName, TInt aBitmapId, TInt aMaskId );
       
   192 
       
   193 	/**
       
   194      * Destructor
       
   195      */		
       
   196 	~CAlfSkinFrameItemImageLoader();
       
   197 
       
   198     /**
       
   199      * Implementation of MAlfBitmapProvider interface.
       
   200      *
       
   201      * @param aId     A unique ID of the texture needed to provide bitmaps.
       
   202      * @param aBitmap     A bitmap.
       
   203      * @param aMaskBitmap     A mask bitmap.
       
   204      */
       
   205 	virtual void ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap) ;
       
   206 
       
   207 private:
       
   208     
       
   209     TSize GetFramePartSize(const TFrameParts aFramePart, const TSize& aFullFrameSize) const;
       
   210     TPoint GetFramePartPos(const TFrameParts aFramePart, const TSize& aFullFrameSize) const;
       
   211     TRect AdjustedOuterRect(const TSize& aFullFrameSize) const;
       
   212     TRect AdjustedInnerRect(const TSize& aFullFrameSize) const;
       
   213     TInt FrameBorderWidth() const;
       
   214 
       
   215 private:
       
   216 
       
   217     TRect iInnerRect; 
       
   218     TRect iOuterRect;
       
   219 };
       
   220 
       
   221 /**
       
   222  * Image loader utility for loading Svg Images
       
   223  *
       
   224  */
       
   225 NONSHARABLE_CLASS(CAlfSvgImageLoader): public CAlfImageLoader, public MSvgRequestObserver
       
   226 {
       
   227 public:
       
   228 
       
   229     /**
       
   230      * Construct an SVG loader
       
   231      *
       
   232      * @param aSVGFile     Svg File name.     
       
   233      */
       
   234     static CAlfSvgImageLoader* NewLC(const TDesC& aSVGFile); 
       
   235 
       
   236     /**
       
   237      * Destructor
       
   238      */		
       
   239 	~CAlfSvgImageLoader();
       
   240     
       
   241     /**
       
   242      * Implementation of MAlfBitmapProvider interface.
       
   243      *
       
   244      * @param aId     A unique ID of the texture needed to provide bitmaps.
       
   245      * @param aBitmap     A bitmap.
       
   246      * @param aMaskBitmap     A mask bitmap.
       
   247      */
       
   248 	virtual void ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap) ;
       
   249 	
       
   250     /**
       
   251      * Implementation of MSvgRequestObserver interface. - UpdateScreen
       
   252      */
       
   253 	void UpdateScreen();
       
   254 	
       
   255     /**
       
   256      * Implementation of MSvgRequestObserver interface. - ScriptCall
       
   257      */	
       
   258 	TBool ScriptCall( const TDesC& aScript,CSvgElementImpl* aCallerElement );
       
   259 	
       
   260     /**
       
   261      * Implementation of MSvgRequestObserver interface.- FetchImage
       
   262      */	
       
   263     TInt FetchImage( const TDesC& aUri, RFs& aSession, RFile& aFileHandle );
       
   264     
       
   265     /**
       
   266      * Implementation of MSvgRequestObserver interface.-UpdatePresentation
       
   267      */    
       
   268     void UpdatePresentation(const TInt32&  aNoOfAnimation);
       
   269     
       
   270     /**
       
   271      * Implementation of MSvgRequestObserver interface.-FetchFont
       
   272      */    
       
   273     TInt FetchFont( const TDesC& aUri, RFs& aSession, RFile& aFileHandle );	
       
   274 	
       
   275 private:	
       
   276 	CAlfSvgImageLoader();
       
   277 	void ConstructL(const TDesC& aSVGFile);
       
   278 	void LoadSVGFileL(TInt aId);
       
   279 private:
       
   280     CSvgEngineInterfaceImpl* iSvgEngine;//owned
       
   281     CFbsBitmap* iBitmap;//not owned
       
   282     CFbsBitmap* iMask; //not owned
       
   283     CFbsBitmap* iDummyBitmap;//owned
       
   284     HBufC* iFileName;
       
   285 };
       
   286 
       
   287 CAlfSvgImageLoader::~CAlfSvgImageLoader()
       
   288 {
       
   289 	delete iSvgEngine;
       
   290     delete iDummyBitmap;
       
   291     delete iBitmap;
       
   292     delete iMask; 	
       
   293     delete iFileName;
       
   294 }
       
   295 // -----------------------------------------------------------------------------
       
   296 // CSVGPerfTestAppView::UpdateScreen
       
   297 // -----------------------------------------------------------------------------
       
   298 //
       
   299 void CAlfSvgImageLoader::UpdateScreen()
       
   300     {
       
   301     }
       
   302     
       
   303 // -----------------------------------------------------------------------------
       
   304 // CSVGPerfTestAppView::ScriptCall
       
   305 // -----------------------------------------------------------------------------
       
   306 //
       
   307 TBool CAlfSvgImageLoader::ScriptCall(
       
   308     const TDesC& /*aScript*/,
       
   309     CSvgElementImpl* /*aCallerElement*/ )
       
   310     {
       
   311     return EFalse;
       
   312     }
       
   313 
       
   314 // -----------------------------------------------------------------------------
       
   315 // CAlfSvgImageLoader::FetchImage
       
   316 // -----------------------------------------------------------------------------
       
   317 //
       
   318 TInt CAlfSvgImageLoader:: FetchImage(
       
   319     const TDesC& /*aUri*/, RFs& /*aSession*/, RFile& /*aFileHandle*/ )
       
   320     {
       
   321     return KErrNotSupported;
       
   322     }
       
   323     
       
   324 // -----------------------------------------------------------------------------
       
   325 // CSVGPerfTestAppView::UpdatePresentation
       
   326 // -----------------------------------------------------------------------------
       
   327 //
       
   328 void CAlfSvgImageLoader::UpdatePresentation(
       
   329     const TInt32& /*aNoOfAnimation*/ )
       
   330     {
       
   331     }
       
   332     
       
   333 // -----------------------------------------------------------------------------
       
   334 // CAlfSvgImageLoader::UpdatePresentation
       
   335 // -----------------------------------------------------------------------------
       
   336 //    
       
   337 TInt CAlfSvgImageLoader::FetchFont( const TDesC& /*aUri*/, RFs& /*aSession*/, RFile& /*aFileHandle*/ )
       
   338     {
       
   339     return KErrNotSupported;
       
   340     }   
       
   341 
       
   342 
       
   343 void CAlfSvgImageLoader::LoadSVGFileL(TInt aId)
       
   344 {
       
   345   	// delete previous content
       
   346 	
       
   347 	delete iBitmap;
       
   348 	iBitmap = NULL;
       
   349 	delete iMask;
       
   350 	iMask = NULL;
       
   351 	
       
   352 	// create frame and frame mask buffers		
       
   353 	iBitmap = new( ELeave ) CFbsBitmap;
       
   354 	User::LeaveIfError( iBitmap->Create( PreferredSize(aId), EColor64K ) );
       
   355 
       
   356 	iMask = new( ELeave ) CFbsBitmap;
       
   357 	User::LeaveIfError( iMask->Create( PreferredSize(aId), EGray256 ) );
       
   358 	
       
   359 
       
   360     // If filename does not contain full path, then prepend the path from 
       
   361     // primary envs default texture manager.
       
   362     TFileName filename;
       
   363     TParsePtrC parse(*iFileName);
       
   364     if (!parse.DrivePresent())
       
   365         {
       
   366         filename.Append(CAlfStatic::Env().TextureManager().ImagePath());        
       
   367         }    
       
   368     filename.Append(*iFileName);
       
   369 	
       
   370 	// Load and render SVG file
       
   371 	TInt handle = 0;
       
   372 	iSvgEngine->PrepareDom( filename, handle ) ;
       
   373 	iSvgEngine->UseDom( handle, iBitmap, iMask );
       
   374 	
       
   375 	// check the aspect ratio (taken from AknSvgFormatHandler.cpp)
       
   376 	TSvgPreserveAspectAlignType alignTypeValue = ESvgPreserveAspectRatio_XmidYmid;
       
   377     TSvgMeetOrSliceType meetOrSliceTypeValue = ESvgMeetOrSlice_Meet;
       
   378     switch ( iScaleMode )
       
   379         {
       
   380         case EAspectRatioPreserved: // fall through
       
   381             {
       
   382             // use default
       
   383             break;
       
   384             }
       
   385         // Ensures SVG content fully covers            
       
   386         // the area of the icon whilst preserving aspect ratio.
       
   387         case EAspectRatioPreservedSlice:
       
   388             {
       
   389             // alignTypeValue use default
       
   390             meetOrSliceTypeValue = ESvgMeetOrSlice_Slice;
       
   391             break;
       
   392             } 
       
   393         // EAspectRatioPreservedAndUnusedSpaceRemoved is mapped to
       
   394         // the same values as EAspectRatioNotPreserved
       
   395         // because we already have a frame buffer
       
   396         // with the dimensions that preserves the aspect ratio.
       
   397         // This mapping ensures that SVG engine does not calculate aspect
       
   398         // ratio twice and potentially resulting in precision loss.
       
   399         case EAspectRatioPreservedAndUnusedSpaceRemoved:                        
       
   400         case EAspectRatioNotPreserved:
       
   401            {            
       
   402             alignTypeValue = ESvgPreserveAspectRatio_None;
       
   403            // meetOrSliceTypeValue use default
       
   404             break;
       
   405             }
       
   406         default:
       
   407             {
       
   408             __ASSERT_DEBUG( 0, USER_INVARIANT() );
       
   409            }
       
   410         }    
       
   411             
       
   412     iSvgEngine->SetPreserveAspectRatio( NULL, alignTypeValue, meetOrSliceTypeValue, ETrue);      
       
   413 	
       
   414 
       
   415 	// render frame and frame mask
       
   416 	iSvgEngine->Start();	
       
   417 	iSvgEngine->UseDom( handle, NULL, NULL );
       
   418 	iSvgEngine->DeleteDom( handle );  
       
   419 
       
   420 }
       
   421 
       
   422 CAlfSvgImageLoader* CAlfSvgImageLoader::NewLC(const TDesC& aSVGFile)
       
   423     {
       
   424     CAlfSvgImageLoader* self = new ( ELeave ) CAlfSvgImageLoader();
       
   425     CleanupStack::PushL( self );
       
   426     self->ConstructL(aSVGFile);
       
   427     return self;
       
   428     }
       
   429 
       
   430 CAlfSvgImageLoader::CAlfSvgImageLoader()
       
   431     {
       
   432     }
       
   433 
       
   434 void CAlfSvgImageLoader::ConstructL(const TDesC& aSVGFile)
       
   435     {
       
   436     iFileName = aSVGFile.AllocL();
       
   437     // Initialize SVG engine
       
   438     TFontSpec spec;
       
   439 	if ( !iDummyBitmap )
       
   440 	    {
       
   441 	    // Have to give some bitmap to the engine in the constructor.
       
   442 	    iDummyBitmap = new( ELeave ) CFbsBitmap;
       
   443 	    TInt error = iDummyBitmap->Create( TSize( 0, 0 ), EGray2 );
       
   444 	    if ( error != KErrNone )
       
   445 	        {
       
   446 	        delete iDummyBitmap;
       
   447 	        iDummyBitmap = NULL;
       
   448 	        User::Leave( error );
       
   449 	        }
       
   450 	    }
       
   451 	    
       
   452 	iSvgEngine = CSvgEngineInterfaceImpl::NewL( iDummyBitmap, this, spec );
       
   453 	iSvgEngine->SetBackgroundColor( 0 );
       
   454 	// No DRM check needed.
       
   455 	iSvgEngine->SetDRMMode( EFalse );
       
   456     }
       
   457 
       
   458 void CAlfSvgImageLoader::ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap)
       
   459 {
       
   460 	CAlfImageLoader::ProvideBitmapL (aId, aBitmap, aMaskBitmap);
       
   461 
       
   462 	LoadSVGFileL(aId);
       
   463 	aBitmap = iBitmap; //ownership transfered
       
   464 	aMaskBitmap = iMask; // ownership transfered
       
   465     iBitmap = NULL;
       
   466     iMask = NULL;
       
   467 }
       
   468 
       
   469 
       
   470 /**
       
   471  * Image loader utility for application icon loading.
       
   472  *
       
   473  */
       
   474 NONSHARABLE_CLASS(CAlfAppIconImageLoader): public CAlfImageLoader
       
   475 {
       
   476 public:
       
   477     /**
       
   478      * Construct an icon source information to create application icon. AknsUtils::CreateAppIconLC()
       
   479      * will be called in RAlfImageLoaderUtil::CreateIconL().
       
   480      *
       
   481      * @param aInstance     Skin instance.
       
   482      * @param aAppUid  Application UID of the icon to be created.
       
   483      * @param aType  Type of the application icon. Likely EAknsAppIconTypeContext is used...
       
   484      */
       
   485 	CAlfAppIconImageLoader(TUid aAppUid, TAknsAppIconType aType);
       
   486     
       
   487     /**
       
   488      * Implementation of MAlfBitmapProvider interface.
       
   489      *
       
   490      * @param aId     A unique ID of the texture needed to provide bitmaps.
       
   491      * @param aBitmap     A bitmap.
       
   492      * @param aMaskBitmap     A mask bitmap.
       
   493      */
       
   494 	virtual void ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap) ;
       
   495 private:
       
   496 	TUid iAppUid;
       
   497 	TAknsAppIconType iType;
       
   498 };
       
   499 
       
   500 // Image loader util
       
   501 EXPORT_C CAlfImageLoaderUtil::CAlfImageLoaderUtil()
       
   502 		:iSize(KAlfImageLoaderDefaultWidth,
       
   503 		       KAlfImageLoaderDefaultHeight), 
       
   504 		 iScaleMode(KAlfImageLoaderDefaultScaleMode)
       
   505 	{
       
   506 	}
       
   507 
       
   508 
       
   509 EXPORT_C CAlfImageLoaderUtil::~CAlfImageLoaderUtil()
       
   510 	{
       
   511 	for (TInt i=0; i<iImageLoaderList.Count(); i++)
       
   512 		delete iImageLoaderList[i];
       
   513 	iImageLoaderList.Close();
       
   514 	}
       
   515 
       
   516 
       
   517 EXPORT_C MAlfBitmapProvider* CAlfImageLoaderUtil::CreateImageLoaderL(
       
   518 				const TAknsItemID &aID, 
       
   519 				const TDesC &aFileName, 
       
   520 				TInt aBitmapId, 
       
   521 				TInt aMaskId)
       
   522 	{
       
   523 	// Create frame item loader, it can also handle normal items.
       
   524 	CAlfSkinFrameItemImageLoader* imgLoader = new (ELeave) CAlfSkinFrameItemImageLoader(
       
   525 			aID, TRect(0,0,0,0), TRect(0,0,0,0));
       
   526 
       
   527     CleanupStack::PushL( imgLoader );
       
   528     imgLoader->ConstructL( aFileName, aBitmapId, aMaskId );
       
   529 	imgLoader->SetSize(iSize);
       
   530 	imgLoader->SetScaleMode(iScaleMode);
       
   531 	imgLoader->SetSkinInstance(iSkinInstance);
       
   532 	iImageLoaderList.AppendL(imgLoader);
       
   533 	CleanupStack::Pop( imgLoader );
       
   534 	return imgLoader;
       
   535 	}
       
   536 
       
   537 EXPORT_C MAlfBitmapProvider* CAlfImageLoaderUtil::CreateImageLoaderL(
       
   538     const TAknsItemID &aFrameID, 
       
   539     const TRect& aInnerRect, 
       
   540     const TRect& aOuterRect)
       
   541     {
       
   542 	CAlfSkinItemImageLoader* imgLoader = new (ELeave) CAlfSkinFrameItemImageLoader(
       
   543 			aFrameID, aInnerRect, aOuterRect);
       
   544     CleanupStack::PushL( imgLoader );
       
   545 	imgLoader->SetSize(aOuterRect.Size());
       
   546 	imgLoader->SetScaleMode(iScaleMode);
       
   547 	imgLoader->SetSkinInstance(iSkinInstance);
       
   548 	iImageLoaderList.AppendL(imgLoader);
       
   549 	CleanupStack::Pop( imgLoader );	
       
   550 	return imgLoader;        
       
   551     }
       
   552 
       
   553 
       
   554 
       
   555 EXPORT_C MAlfBitmapProvider* CAlfImageLoaderUtil::CreateSVGImageLoaderL(
       
   556 				const TDesC &aFileName)
       
   557 	{
       
   558 	CAlfSvgImageLoader* imgLoader = CAlfSvgImageLoader::NewLC(aFileName);
       
   559 	imgLoader->SetSize(iSize);
       
   560 	imgLoader->SetScaleMode(iScaleMode);
       
   561     iImageLoaderList.AppendL(imgLoader);
       
   562 	CleanupStack::Pop( imgLoader );
       
   563 	return imgLoader;
       
   564 	}
       
   565 
       
   566 
       
   567 EXPORT_C MAlfBitmapProvider* CAlfImageLoaderUtil::CreateImageLoaderL(
       
   568 				TUid aAppUid, 
       
   569 				TAknsAppIconType aType)
       
   570 	{
       
   571 	CAlfAppIconImageLoader* imgLoader = new (ELeave) CAlfAppIconImageLoader(
       
   572 			aAppUid, aType);
       
   573     CleanupStack::PushL( imgLoader );
       
   574 	imgLoader->SetSize(iSize);
       
   575 	imgLoader->SetScaleMode(iScaleMode);
       
   576 	imgLoader->SetSkinInstance(iSkinInstance);
       
   577 	iImageLoaderList.AppendL(imgLoader);
       
   578 	CleanupStack::Pop( imgLoader );
       
   579 	return imgLoader;
       
   580 	}
       
   581 
       
   582 
       
   583 EXPORT_C void CAlfImageLoaderUtil::SetSize(TSize aSize, TScaleMode aMode)
       
   584 	{
       
   585 	iSize = aSize;
       
   586 	iScaleMode = aMode;
       
   587 	}
       
   588 
       
   589 
       
   590 EXPORT_C void CAlfImageLoaderUtil::SetSkinInstance(MAknsSkinInstance *aSkinInstance)
       
   591 	{
       
   592 	iSkinInstance = aSkinInstance;
       
   593 	}
       
   594 
       
   595 
       
   596 // Image loaders
       
   597 CAlfImageLoader::CAlfImageLoader():
       
   598     iSize(KAlfImageLoaderDefaultWidth,KAlfImageLoaderDefaultHeight), 
       
   599     iScaleMode(KAlfImageLoaderDefaultScaleMode)
       
   600     {
       
   601     }
       
   602 
       
   603 CAlfImageLoader::~CAlfImageLoader()
       
   604     {
       
   605     iProvidedBitmaps.Close();
       
   606     };
       
   607 
       
   608 MAknsSkinInstance* CAlfImageLoader::GetValidSkinInstance()
       
   609 	{
       
   610 	if (iSkinInstance == NULL)
       
   611 		{
       
   612 		return AknsUtils::SkinInstance();
       
   613 		}
       
   614 	else
       
   615 		{
       
   616 		return iSkinInstance;
       
   617 		}
       
   618 	}
       
   619 
       
   620 TSize CAlfImageLoader::PreferredSize(TInt aId) const
       
   621     {
       
   622     for(TInt i = 0; i < iProvidedBitmaps.Count(); i++)
       
   623         {
       
   624         if (iProvidedBitmaps[i].iId == aId)
       
   625             {
       
   626             // Already in list
       
   627             return iProvidedBitmaps[i].iPreferredSize;   
       
   628             }
       
   629         }
       
   630     return iSize;    
       
   631     }
       
   632 
       
   633 
       
   634 TBool CAlfImageLoader::PreferredSizeChanged(const CAlfTexture& aChangedTexture, TSize aPreferredSize)
       
   635     {
       
   636     // Check if any of my bitmaps preferred size has changed
       
   637     for(TInt ii = 0; ii < iProvidedBitmaps.Count(); ii++)
       
   638         {
       
   639         if (iProvidedBitmaps[ii].iId == aChangedTexture.Id())
       
   640             {
       
   641             iProvidedBitmaps[ii].iPreferredSize = aPreferredSize;     
       
   642             
       
   643             TInt flags = aChangedTexture.Flags();
       
   644             
       
   645             // Exclude autosized bitmaps from avkon icon cache
       
   646             if (KExcludeAutosizeTextureIconsFromAvkonIconCache && 
       
   647                 (flags & EAlfTextureFlagAutoSize))
       
   648                 {                
       
   649                 iExcludeFromAvkonIconCache = ETrue;
       
   650                 }            
       
   651 
       
   652             // If bitmap is excuded from avkon cache, we can use direct upload to gain slight
       
   653             // performance improvement in bitgdi. No fear of anyone sharing the bitmap or compressing
       
   654             // it etc.
       
   655             if (iExcludeFromAvkonIconCache)
       
   656                 {
       
   657                 flags |= 0x20; // "Secret" flag, not in public API    
       
   658                 CAlfTexture* changedTexture = const_cast<CAlfTexture*> (&aChangedTexture);
       
   659                 changedTexture->SetFlags(TAlfTextureFlags(flags));                    
       
   660                 }
       
   661             
       
   662             return ETrue;
       
   663             }
       
   664         }        
       
   665     return EFalse;
       
   666     }
       
   667 
       
   668 void CAlfImageLoader::ProvideBitmapL (TInt aId, CFbsBitmap *& /*aBitmap*/, CFbsBitmap *& /*aMaskBitmap*/)
       
   669     {
       
   670     for(TInt i = 0; i < iProvidedBitmaps.Count(); i++)
       
   671         {
       
   672         if (iProvidedBitmaps[i].iId == aId)
       
   673             {            
       
   674             // Already in list, do nothing
       
   675             return;   
       
   676             }
       
   677         }
       
   678     
       
   679     // If provided bitmap is not yet in the list, add it.    
       
   680     TAlfProvidedBitmap providedBitmap;
       
   681     providedBitmap.iId = aId;
       
   682     providedBitmap.iPreferredSize = iSize;        
       
   683     iProvidedBitmaps.AppendL(providedBitmap);            
       
   684     }
       
   685 
       
   686 
       
   687 CAlfSkinItemImageLoader::CAlfSkinItemImageLoader():
       
   688 		iId(KAknsIIDNone),
       
   689 		iFileName(NULL),
       
   690 		iBitmapId(0),
       
   691 		iMaskId(0)
       
   692 	{
       
   693 	}
       
   694 
       
   695 CAlfSkinItemImageLoader::CAlfSkinItemImageLoader(
       
   696 		const TAknsItemID &aID, 
       
   697 		TInt aBitmapId, 
       
   698 		TInt aMaskId):
       
   699 		iId(aID),
       
   700 		iBitmapId(aBitmapId),
       
   701 		iMaskId(aMaskId)
       
   702 	{
       
   703 	}
       
   704 
       
   705 void CAlfSkinItemImageLoader::ConstructL( const TDesC &aFileName )
       
   706 	{
       
   707 	iFileName = aFileName.AllocL();
       
   708 	}
       
   709 
       
   710 CAlfSkinItemImageLoader::~CAlfSkinItemImageLoader()
       
   711     {
       
   712     delete iFileName;
       
   713     }
       
   714 
       
   715 
       
   716 void CAlfSkinItemImageLoader::ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap)
       
   717 	{
       
   718 	CAlfImageLoader::ProvideBitmapL (aId, aBitmap, aMaskBitmap);
       
   719 	
       
   720 	AknsUtils::CreateIconL(
       
   721 					GetValidSkinInstance(), iId,
       
   722 					aBitmap, aMaskBitmap, 
       
   723 					*iFileName, iBitmapId, iMaskId);
       
   724 
       
   725     // Leave if bitmap or mask is NULL.
       
   726     User::LeaveIfNull( aBitmap );
       
   727     //User::LeaveIfNull( aMaskBitmap );
       
   728 
       
   729 	// Disable compression so that the bitmap may be able to be duplicated inside
       
   730 	// AlfTK when BITGDI renderer is in use.
       
   731 	AknIconUtils::DisableCompression( aBitmap );
       
   732 
       
   733     // Exclude from icon cache to avoid flooding it or to avoid bitmap sharing
       
   734     if (iExcludeFromAvkonIconCache)
       
   735         {
       
   736         AknIconUtils::ExcludeFromCache( aBitmap );    
       
   737         }
       
   738 
       
   739     // Set icon sizes and render them on the bitmaps.
       
   740     // This does the actual rendering to specified size. (SVG -> bitmap)
       
   741     AknIconUtils::SetSize( aBitmap, PreferredSize(aId), iScaleMode );
       
   742 	}
       
   743 
       
   744 
       
   745 
       
   746 CAlfSkinFrameItemImageLoader::CAlfSkinFrameItemImageLoader( const TAknsItemID &aFrameID, 
       
   747     const TRect& aInnerRect, 
       
   748     const TRect& aOuterRect ):
       
   749     iInnerRect(aInnerRect),
       
   750     iOuterRect(aOuterRect)
       
   751     {
       
   752     iId = aFrameID;                
       
   753 
       
   754     // Sanity check to avoid evil things happening later
       
   755     if (aOuterRect.iTl.iX - aInnerRect.iTl.iX > KSkinFrameWidthMinValue ||
       
   756         aOuterRect.iTl.iY - aInnerRect.iTl.iY > KSkinFrameWidthMinValue ||
       
   757         aOuterRect.iBr.iX - aInnerRect.iBr.iX < KSkinFrameWidthMinValue ||
       
   758         aOuterRect.iBr.iY - aInnerRect.iBr.iY < KSkinFrameWidthMinValue)
       
   759         {
       
   760         iInnerRect = TRect(0,0,0,0);
       
   761         iOuterRect = TRect(0,0,0,0);
       
   762         }    
       
   763     }
       
   764 
       
   765 void CAlfSkinFrameItemImageLoader::ConstructL( const TDesC &aFileName, TInt aBitmapId, TInt aMaskId )
       
   766 	{
       
   767 	iBitmapId = aBitmapId;
       
   768 	iMaskId = aMaskId;
       
   769 	iFileName = aFileName.AllocL();
       
   770 	}
       
   771 
       
   772 CAlfSkinFrameItemImageLoader::~CAlfSkinFrameItemImageLoader()
       
   773     {        
       
   774     // base class deletes iFileName
       
   775     }
       
   776 
       
   777 void CAlfSkinFrameItemImageLoader::ProvideBitmapL(TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap) 
       
   778     {
       
   779     CAknsItemData* itemData = NULL;    				
       
   780     itemData = AknsUtils::SkinInstance()->CreateUncachedItemDataL( iId, EAknsITImageTable );
       
   781 
       
   782     if (itemData)
       
   783         {
       
   784     	// Call grandparent class functionality instead of parent here.
       
   785     	CAlfImageLoader::ProvideBitmapL (aId, aBitmap, aMaskBitmap);
       
   786         
       
   787         CAknsImageTableItemData* itemTableData = static_cast<CAknsImageTableItemData*>(itemData);        
       
   788         CleanupStack::PushL( itemTableData );
       
   789         
       
   790         TSize frameSize = PreferredSize(aId);
       
   791 
       
   792         // Create target bitmap
       
   793         aBitmap = new CFbsBitmap();
       
   794         aBitmap->Create( frameSize, EColor64K );
       
   795 
       
   796         aMaskBitmap = new CFbsBitmap();
       
   797         aMaskBitmap->Create( frameSize, EGray256 );
       
   798 
       
   799         // Create bitmap device for target rendering
       
   800         CFbsBitmapDevice* targetDevice = CFbsBitmapDevice::NewL( aBitmap );
       
   801         CleanupStack::PushL( targetDevice );
       
   802 
       
   803         CFbsBitmapDevice* targetMaskDevice = CFbsBitmapDevice::NewL( aMaskBitmap );
       
   804         CleanupStack::PushL( targetMaskDevice );
       
   805 
       
   806         // Create bitmap graphics context
       
   807         CFbsBitGc* bitgc = CFbsBitGc::NewL();
       
   808         CleanupStack::PushL( bitgc );
       
   809         bitgc->Activate( targetDevice );
       
   810 
       
   811         CFbsBitGc* maskbitgc = CFbsBitGc::NewL();
       
   812         CleanupStack::PushL( maskbitgc );
       
   813         maskbitgc->Activate( targetMaskDevice );
       
   814         
       
   815         // Fill mask just in case there are unmasked elements in the frame
       
   816         maskbitgc->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   817         maskbitgc->SetBrushColor(KRgbWhite);
       
   818         maskbitgc->SetPenColor(KRgbWhite);
       
   819         maskbitgc->DrawRect(TRect(TPoint(0,0), frameSize));
       
   820         
       
   821         // 9 part frame graphics
       
   822         for (TInt count = 0; count < 9; count++)
       
   823             {
       
   824             TSize partsize = GetFramePartSize((TFrameParts)(count), frameSize);
       
   825             TPoint partpos = GetFramePartPos((TFrameParts)(count), frameSize);
       
   826             
       
   827             TAknsItemID partSkinId = itemTableData->ImageIID(count);
       
   828 
       
   829             CFbsBitmap* partBitmap = NULL;
       
   830             CFbsBitmap* partMaskBitmap = NULL;
       
   831             AknsUtils::GetCachedMaskedBitmap(AknsUtils::SkinInstance(), itemTableData->ImageIID(count), partBitmap, partMaskBitmap );
       
   832             
       
   833             TRect sourcerect = TRect(TPoint(0,0), partsize);    
       
   834 
       
   835             if (partBitmap)
       
   836                 {
       
   837                 AknIconUtils::SetSize( partBitmap, partsize, EAspectRatioNotPreserved );    
       
   838                 bitgc->BitBlt(partpos, partBitmap,sourcerect);                
       
   839                 }
       
   840                 
       
   841             if (partMaskBitmap)
       
   842                 {
       
   843                 AknIconUtils::SetSize( partMaskBitmap, partsize, EAspectRatioNotPreserved );    
       
   844                 maskbitgc->BitBlt(partpos, partMaskBitmap,sourcerect);                
       
   845                 }
       
   846             }
       
   847         
       
   848         CleanupStack::PopAndDestroy( maskbitgc );
       
   849         CleanupStack::PopAndDestroy( bitgc );
       
   850         CleanupStack::PopAndDestroy( targetMaskDevice );
       
   851         CleanupStack::PopAndDestroy( targetDevice );
       
   852         CleanupStack::PopAndDestroy( itemTableData );
       
   853         }
       
   854     else
       
   855         {
       
   856         // 1 part frame graphics comes from the base class
       
   857         CAlfSkinItemImageLoader::ProvideBitmapL(aId, aBitmap, aMaskBitmap);    
       
   858         }    
       
   859 
       
   860     }
       
   861 
       
   862 TSize CAlfSkinFrameItemImageLoader::GetFramePartSize(const TFrameParts aFramePart, const TSize& aFullFrameSize) const
       
   863     {
       
   864     TRect innerRect = AdjustedInnerRect(aFullFrameSize);
       
   865     TRect outerRect = AdjustedOuterRect(aFullFrameSize);    
       
   866     
       
   867     TSize size(0,0);
       
   868     
       
   869     switch (aFramePart)
       
   870         {
       
   871         case EFramePartCornerTl:
       
   872             size.iWidth = innerRect.iTl.iX - outerRect.iTl.iX;
       
   873             size.iHeight = innerRect.iTl.iY - outerRect.iTl.iY;
       
   874             break;
       
   875         case EFramePartCornerTr:
       
   876             size.iWidth = outerRect.iBr.iX - innerRect.iBr.iX;
       
   877             size.iHeight = innerRect.iTl.iY - outerRect.iTl.iY;
       
   878             break;
       
   879         case EFramePartCornerBl:
       
   880             size.iWidth = innerRect.iTl.iX - outerRect.iTl.iX;
       
   881             size.iHeight = outerRect.iBr.iY - innerRect.iBr.iY;					
       
   882             break;
       
   883         case EFramePartCornerBr:
       
   884             size.iWidth = outerRect.iBr.iX - innerRect.iBr.iX;
       
   885             size.iHeight = outerRect.iBr.iY - innerRect.iBr.iY;					
       
   886             break;
       
   887         case EFramePartSideT:
       
   888             size.iWidth = innerRect.iBr.iX - innerRect.iTl.iX;
       
   889             size.iHeight = innerRect.iTl.iY - outerRect.iTl.iY;					
       
   890             break;
       
   891         case EFramePartSideB:
       
   892             size.iWidth = innerRect.iBr.iX - innerRect.iTl.iX;
       
   893             size.iHeight = outerRect.iBr.iY - innerRect.iBr.iY;					
       
   894             break;
       
   895         case EFramePartSideL:
       
   896             size.iWidth = innerRect.iTl.iX - outerRect.iTl.iX;
       
   897             size.iHeight = innerRect.iBr.iY - innerRect.iTl.iY;					
       
   898             break;
       
   899         case EFramePartSideR:
       
   900             size.iWidth = outerRect.iBr.iX - innerRect.iBr.iX;
       
   901             size.iHeight = innerRect.iBr.iY - innerRect.iTl.iY;					
       
   902             break;
       
   903         case EFramePartCenter:
       
   904             size = innerRect.Size();
       
   905             break;
       
   906         default:
       
   907             break;
       
   908         }
       
   909     return size;
       
   910     }
       
   911 
       
   912 TPoint CAlfSkinFrameItemImageLoader::GetFramePartPos(const TFrameParts aFramePart, const TSize& aFullFrameSize) const
       
   913     {
       
   914     TRect innerRect = AdjustedInnerRect(aFullFrameSize);
       
   915     TRect outerRect = AdjustedOuterRect(aFullFrameSize);    
       
   916 
       
   917     TPoint pos(0,0);
       
   918 
       
   919     switch (aFramePart)
       
   920         {
       
   921         case EFramePartCornerTl:
       
   922             pos.iX = outerRect.iTl.iX;
       
   923             pos.iY = outerRect.iTl.iY;
       
   924             break;
       
   925         case EFramePartCornerTr:
       
   926             pos.iX = innerRect.iBr.iX;
       
   927             pos.iY = outerRect.iTl.iY;
       
   928             break;
       
   929         case EFramePartCornerBl:
       
   930             pos.iX = outerRect.iTl.iX;
       
   931             pos.iY = innerRect.iBr.iY;
       
   932             break;
       
   933         case EFramePartCornerBr:
       
   934             pos.iX = innerRect.iBr.iX;
       
   935             pos.iY = innerRect.iBr.iY;
       
   936             break;
       
   937         case EFramePartSideT:
       
   938             pos.iX = innerRect.iTl.iX;
       
   939             pos.iY = outerRect.iTl.iY;
       
   940             break;
       
   941         case EFramePartSideB:
       
   942             pos.iX = innerRect.iTl.iX;
       
   943             pos.iY = innerRect.iBr.iY;
       
   944             break;
       
   945         case EFramePartSideL:
       
   946             pos.iX = outerRect.iTl.iX;
       
   947             pos.iY = innerRect.iTl.iY;
       
   948             break;
       
   949         case EFramePartSideR:
       
   950             pos.iX = innerRect.iBr.iX;
       
   951             pos.iY = innerRect.iTl.iY;
       
   952             break;
       
   953         case EFramePartCenter:
       
   954             pos.iX = innerRect.iTl.iX;
       
   955             pos.iY = innerRect.iTl.iY;
       
   956             break;
       
   957         default:
       
   958             break;
       
   959         }
       
   960     return pos;
       
   961     }
       
   962 
       
   963 TRect CAlfSkinFrameItemImageLoader::AdjustedOuterRect(const TSize& aFullFrameSize) const
       
   964     {
       
   965     if (aFullFrameSize != iOuterRect.Size())
       
   966         {
       
   967         return TRect(TPoint(0,0), aFullFrameSize);    
       
   968         }
       
   969     return iOuterRect;    
       
   970     }
       
   971 
       
   972 TRect CAlfSkinFrameItemImageLoader::AdjustedInnerRect(const TSize& aFullFrameSize) const
       
   973     {
       
   974     TRect adjustedOuterRect = AdjustedOuterRect(aFullFrameSize);
       
   975     if (adjustedOuterRect != iOuterRect)
       
   976         {
       
   977         TInt adjustment = 0;
       
   978         
       
   979         if ((adjustedOuterRect.Width() >= KSkinFrameBorderWidthDefaultValue * 2) &&
       
   980             (adjustedOuterRect.Height() >= KSkinFrameBorderWidthDefaultValue * 2))
       
   981             {
       
   982             // Use default border width
       
   983             adjustment = KSkinFrameBorderWidthDefaultValue;
       
   984             }
       
   985         else if ((adjustedOuterRect.Width() >= KSkinFrameBorderWidthSmallValue * 2) &&
       
   986                  (adjustedOuterRect.Height() >= KSkinFrameBorderWidthSmallValue * 2))
       
   987             {
       
   988             // Frame size is too small, use small border
       
   989             adjustment = KSkinFrameBorderWidthSmallValue;
       
   990             }        
       
   991         else if ((adjustedOuterRect.Width() >= KSkinFrameBorderWidthSmallestValue * 2) &&
       
   992                  (adjustedOuterRect.Height() >= KSkinFrameBorderWidthSmallestValue * 2))
       
   993             {
       
   994             // Frame size is too small, use smallest border
       
   995             adjustment = KSkinFrameBorderWidthSmallestValue;
       
   996             }        
       
   997         else
       
   998             {
       
   999             // Frame size is too small, just draw the center part
       
  1000             adjustment = 0;    
       
  1001             }
       
  1002                                             
       
  1003         adjustedOuterRect.iTl.iX += adjustment;
       
  1004         adjustedOuterRect.iBr.iX -= adjustment;            
       
  1005         adjustedOuterRect.iTl.iY += adjustment;
       
  1006         adjustedOuterRect.iBr.iY -= adjustment;
       
  1007         
       
  1008         return adjustedOuterRect;    
       
  1009         }
       
  1010     
       
  1011     return iInnerRect;    
       
  1012     }
       
  1013 
       
  1014 
       
  1015 CAlfAppIconImageLoader::CAlfAppIconImageLoader(
       
  1016 		TUid aAppUid, 
       
  1017 		TAknsAppIconType aType):
       
  1018 		iAppUid(aAppUid),
       
  1019 		iType(aType)
       
  1020 	{
       
  1021 	}
       
  1022 
       
  1023 
       
  1024 void CAlfAppIconImageLoader::ProvideBitmapL (
       
  1025 		TInt aId, 
       
  1026 		CFbsBitmap *& aBitmap, 
       
  1027 		CFbsBitmap *& aMaskBitmap)
       
  1028 	{
       
  1029 	CAlfImageLoader::ProvideBitmapL (aId, aBitmap, aMaskBitmap);
       
  1030 
       
  1031     AknsUtils::CreateAppIconLC( 
       
  1032 					GetValidSkinInstance(), 
       
  1033 					iAppUid, iType,
       
  1034 					aBitmap, aMaskBitmap );
       
  1035 
       
  1036     // Leave if bitmap or mask is NULL.
       
  1037     User::LeaveIfNull( aBitmap );
       
  1038     //User::LeaveIfNull( aMaskBitmap );
       
  1039 
       
  1040 	// diable compression so that the bitmap may be able to be duplicated inside
       
  1041 	// AlfTK when BITGDI renderer is in use.
       
  1042 	AknIconUtils::DisableCompression( aBitmap );
       
  1043 
       
  1044     // Exclude from icon cache to avoid flooding it or to avoid bitmap sharing
       
  1045     if (iExcludeFromAvkonIconCache)
       
  1046         {
       
  1047         AknIconUtils::ExcludeFromCache( aBitmap );    
       
  1048         }
       
  1049 
       
  1050     // Set icon sizes and render them on the bitmaps.
       
  1051     // This does the actual rendering to specified size. (SVG -> bitmap)
       
  1052     AknIconUtils::SetSize( aBitmap, PreferredSize(aId), iScaleMode );
       
  1053     
       
  1054 	// pop the passed bitmap and mask 
       
  1055 	CleanupStack::Pop(2);
       
  1056 	}
       
  1057 
       
  1058 EXPORT_C CAlfAutoSizeImageLoaderUtil::CAlfAutoSizeImageLoaderUtil()
       
  1059     {
       
  1060     }
       
  1061 
       
  1062 EXPORT_C TBool CAlfAutoSizeImageLoaderUtil::PreferredSizeChanged(const CAlfTexture& aChangedTexture, TSize aPreferredSize)
       
  1063     {
       
  1064     TBool ret = EFalse;
       
  1065     TInt count = iImageLoaderList.Count();
       
  1066     for (TInt i=0; i<count;i++)
       
  1067         {
       
  1068         ret |= iImageLoaderList[i]->PreferredSizeChanged(aChangedTexture, aPreferredSize);    
       
  1069         }
       
  1070     return ret;    
       
  1071     }