satui/satplugin/aisatpluginsrc/caisatengine.cpp
branchRCL_3
changeset 14 71e7b994dff4
parent 8 1b9ee3c7442d
equal deleted inserted replaced
11:ba42c4bd84dd 14:71e7b994dff4
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   117     // Active Idle framework will release the bitmap we would
   117     // Active Idle framework will release the bitmap we would
   118     // publish. So a new bitmap should be created to avoid
   118     // publish. So a new bitmap should be created to avoid
   119     // destroying the bitmap owned by UAA.
   119     // destroying the bitmap owned by UAA.
   120     if ( iIcon )
   120     if ( iIcon )
   121         {
   121         {
       
   122         TFLOGSTRING( "CAiSatEngine::ContentIconL iIcon != NULL" )
   122         // The bitmap for publishing.
   123         // The bitmap for publishing.
   123         CFbsBitmap* bitmapToPublish( NULL );    
   124         CFbsBitmap* bitmapToPublish( NULL );    
   124                   
   125                   
   125         bitmapToPublish = new (ELeave) CFbsBitmap;
   126         bitmapToPublish = new (ELeave) CFbsBitmap;
   126         CleanupStack::PushL( bitmapToPublish );
   127         CleanupStack::PushL( bitmapToPublish );
   127 
   128 
   128         TSize size = iIcon->SizeInPixels();
   129         TSize size = iIcon->SizeInPixels();
   129         TInt error = bitmapToPublish->Create( size, iIcon->DisplayMode() ); 
   130         TInt error = bitmapToPublish->Create( size, iIcon->DisplayMode() ); 
   130          
   131         TFLOGSTRING2( "CFbsBitmap::Create returns %d", error )
   131         // Duplicate the bitmap owned by UAA into the new bitmap.
   132         // Duplicate the bitmap owned by UAA into the new bitmap.
   132         if ( !error )
   133         if ( !error )
   133             {
   134             {
   134             error = DuplicateBitmap( bitmapToPublish, iIcon );        
   135             error = bitmapToPublish->Duplicate( iIcon->Handle() );
       
   136             TFLOGSTRING2( "CFbsBitmap::Duplicate returns %d", error )
   135             if ( !error )
   137             if ( !error )
   136                 {
   138                 {
   137                 // Create a icon from the bitmap and publish it.
   139                 // Create a icon from the bitmap and publish it.
   138                 aGulIcon = CGulIcon::NewL( bitmapToPublish );
   140                 aGulIcon = CGulIcon::NewL( bitmapToPublish );
   139                 CleanupStack::Pop( bitmapToPublish );        
   141                 CleanupStack::Pop( bitmapToPublish );        
   140                 TFLOGSTRING( "CAiSatEngine::ContentIconL create GulIcon" )                
   142                 TFLOGSTRING( "CAiSatEngine::ContentIconL create GulIcon" )
   141                 }
   143                 }
   142             } 
   144             } 
   143         if ( error )  
   145         if ( error )  
   144             {
   146             {
   145             CleanupStack::PopAndDestroy( bitmapToPublish );
   147             CleanupStack::PopAndDestroy( bitmapToPublish );
   146             aGulIcon = NULL;
   148             aGulIcon = NULL;
   147             }        
   149             }        
   148         }   
   150         }   
   149     TFLOGSTRING( "CAiSatEngine::ContentIconL exits" )    
   151     TFLOGSTRING( "CAiSatEngine::ContentIconL exits" )
   150     }
   152     }
   151 
   153 
   152 //------------------------------------------------------------------------------
   154 //------------------------------------------------------------------------------
   153 // Loads icon provided by SIM from RSatIcon
   155 // Loads icon provided by SIM from RSatIcon
   154 //------------------------------------------------------------------------------
   156 //------------------------------------------------------------------------------
   303     iSatService.SetIdleModeTextResponse( aResponse );
   305     iSatService.SetIdleModeTextResponse( aResponse );
   304 
   306 
   305     TFLOGSTRING( "CAiSatEngine::SendSatResponseL exits" )
   307     TFLOGSTRING( "CAiSatEngine::SendSatResponseL exits" )
   306     }
   308     }
   307       
   309       
   308 // ---------------------------------------------------------------------------
   310 // End Of File 
   309 // Duplicate a bitmap by copying memory.
       
   310 // ---------------------------------------------------------------------------
       
   311 //
       
   312 TInt CAiSatEngine::DuplicateBitmap( const CFbsBitmap* aDestBmp,
       
   313                                     const CFbsBitmap* aSrcBmp )
       
   314     {
       
   315     TFLOGSTRING( "CAiSatPlugin::DuplicateBitmap() called" )
       
   316 
       
   317     TInt error( KErrGeneral );
       
   318 
       
   319     // Get display mode about bitmap
       
   320     TDisplayMode bmpDisplayMode = aSrcBmp->DisplayMode();
       
   321 
       
   322     // Get size and scan line length of the source bitmap.
       
   323     TSize size = aSrcBmp->SizeInPixels();
       
   324     TInt scanLineLength = CFbsBitmap::ScanLineLength( 
       
   325                             size.iWidth, bmpDisplayMode );
       
   326     TInt bitmapHeight = size.iHeight;
       
   327 
       
   328     TUint* bufUint = new TUint[ scanLineLength ];
       
   329     if ( bufUint )
       
   330         {
       
   331         TPtr8 bufPtr ( ( TUint8* )bufUint, scanLineLength, scanLineLength );
       
   332         // Initialize the pixel data for destination bitmap
       
   333         for ( TInt pixelIndex = 0; pixelIndex < bitmapHeight; ++pixelIndex )
       
   334             {
       
   335             TPoint pixelPoint( 0, pixelIndex );
       
   336             aSrcBmp->GetScanLine( bufPtr, pixelPoint,
       
   337             scanLineLength, bmpDisplayMode );
       
   338             aDestBmp->SetScanLine( bufPtr, pixelIndex );
       
   339             }
       
   340         error = KErrNone;
       
   341         TFLOGSTRING3( "CAiSatPlugin::DuplicateBitmap() \
       
   342         scanLineLength = %d bitmapHeight = %d", scanLineLength, bitmapHeight )
       
   343         }
       
   344 
       
   345     delete bufUint;
       
   346     bufUint = NULL;
       
   347 
       
   348     TFLOGSTRING( "CAiSatPlugin::DuplicateBitmap() exits" )
       
   349     return error;
       
   350     }