satui/satplugin/aisatpluginsrc/caisatengine.cpp
branchRCL_3
changeset 6 1b9ee3c7442d
parent 0 ff3b6d0fd310
child 9 71e7b994dff4
--- a/satui/satplugin/aisatpluginsrc/caisatengine.cpp	Fri Mar 12 15:45:50 2010 +0200
+++ b/satui/satplugin/aisatpluginsrc/caisatengine.cpp	Mon Mar 15 12:42:43 2010 +0200
@@ -314,30 +314,37 @@
     {
     TFLOGSTRING( "CAiSatPlugin::DuplicateBitmap() called" )
 
+    TInt error( KErrGeneral );
+
+    // Get display mode about bitmap
+    TDisplayMode bmpDisplayMode = aSrcBmp->DisplayMode();
+
     // Get size and scan line length of the source bitmap.
     TSize size = aSrcBmp->SizeInPixels();
     TInt scanLineLength = CFbsBitmap::ScanLineLength( 
-                            size.iWidth, aSrcBmp->DisplayMode() );
-    TInt error( KErrNone );
-    // Copy the data area of the source bimap to the dest bitmap.
-    if ( aSrcBmp && aSrcBmp->DataAddress() )
+                            size.iWidth, bmpDisplayMode );
+    TInt bitmapHeight = size.iHeight;
+
+    TUint* bufUint = new TUint[ scanLineLength ];
+    if ( bufUint )
         {
-        TAny* bitmapData( NULL );
-        
-        bitmapData = memcpy(
-            (TAny*)aDestBmp->DataAddress(), 
-            (TAny*)aSrcBmp->DataAddress(), 
-            scanLineLength * size.iHeight );
-        
-        if ( NULL == bitmapData )
+        TPtr8 bufPtr ( ( TUint8* )bufUint, scanLineLength, scanLineLength );
+        // Initialize the pixel data for destination bitmap
+        for ( TInt pixelIndex = 0; pixelIndex < bitmapHeight; ++pixelIndex )
             {
-            TFLOGSTRING( "CAiSatPlugin::DuplicateBitmap() \
-                Failed to copy memory data of bitmap." )
-            error = KErrBadHandle;
+            TPoint pixelPoint( 0, pixelIndex );
+            aSrcBmp->GetScanLine( bufPtr, pixelPoint,
+            scanLineLength, bmpDisplayMode );
+            aDestBmp->SetScanLine( bufPtr, pixelIndex );
             }
+        error = KErrNone;
+        TFLOGSTRING3( "CAiSatPlugin::DuplicateBitmap() \
+        scanLineLength = %d bitmapHeight = %d", scanLineLength, bitmapHeight )
         }
 
+    delete bufUint;
+    bufUint = NULL;
+
     TFLOGSTRING( "CAiSatPlugin::DuplicateBitmap() exits" )
-
     return error;
     }