webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp
changeset 38 6297cdf66332
parent 17 c8a366e56285
child 64 ac77f89b1d9e
child 65 5bfc169077b2
--- a/webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp	Thu Jan 07 13:31:38 2010 +0200
+++ b/webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp	Mon Jan 18 21:20:18 2010 +0200
@@ -34,6 +34,7 @@
 // -----------------------------------------------------------------------------
 TInt BitmapUtil::CopyBitmap( const CFbsBitmap& aSource, CFbsBitmap& aDestination )
     {
+    // TODO - how to check if source or destination is null reference
     TSize size( aSource.SizeInPixels() );
     TDisplayMode displayMode( aSource.DisplayMode() );
     TInt err( aDestination.Create( size, displayMode ) );
@@ -54,6 +55,7 @@
 TInt BitmapUtil::CopyBitmapData( const CFbsBitmap& aSource, CFbsBitmap& aDestination,
                                    const TSize& aSize, const TDisplayMode& aDisplayMode )
     {
+    // TODO - how to check if source or destination is null reference
     HBufC8* scanLine = HBufC8::New( aSource.ScanLineLength( aSize.iWidth, aDisplayMode ) );
     if( scanLine )
         {
@@ -215,7 +217,7 @@
             }
         }
 
-    if( !err && maskHandle )
+    if( !err && maskHandle && iMask)
         {
         if( aDuplicate )
             {
@@ -247,7 +249,7 @@
 void CMaskedBitmap::Reset()
     {
     iBitmap->Reset();
-    iMask->Reset();
+    if(iMask) iMask->Reset();
     }
 
 
@@ -272,7 +274,7 @@
 // -----------------------------------------------------------------------------
 TBool CMaskedBitmap::HasMask() const
     {
-    return ( iMask->Handle() != 0 );
+    return (iMask && iMask->Handle()!=0 );
     }
 
 // -----------------------------------------------------------------------------
@@ -295,7 +297,7 @@
         }
     if( iBitmap->Handle() )
         {
-        if( iMask->Handle() )
+        if( HasMask() )
             {
             aContext.BitBltMasked( aPoint, iBitmap, s, iMask, iInvertMask );
             }
@@ -317,7 +319,7 @@
         }
     if( iBitmap->Handle() )
         {
-        if( iMask->Handle() )
+        if( HasMask() )
             {
 
             aContext.BitBltMasked( aPoint, iBitmap, aSource, iMask, iInvertMask );
@@ -342,7 +344,7 @@
     if( iBitmap->Handle() )
         {
         // ### FIXME DrawBitmapMasked is too buggy to use 2.8/week52, so no transparency with scaling
-        if( iMask->Handle() )
+        if( HasMask() )
             {
             aContext.DrawBitmapMasked( aTarget, iBitmap, s, iMask, iInvertMask );
             }
@@ -365,7 +367,7 @@
     if( iBitmap->Handle() )
         {
         // ### FIXME DrawBitmapMasked is too buggy to use 2.8/week52, so no transparency with scaling
-        if( iMask->Handle() )
+        if( HasMask() )
             {
             aContext.DrawBitmapMasked( aTarget, iBitmap, aSource, iMask, iInvertMask );
             }
@@ -441,10 +443,8 @@
 void CMaskedBitmap::Resize(TSize aSize)
     {
     iBitmap->Resize(aSize);
-    if (iMask)
-        {
+    if (HasMask())
         iMask->Resize(aSize);
-        }
     }
 
 // -----------------------------------------------------------------------------
@@ -589,10 +589,8 @@
 
 TBool CMaskedBitmap::IsFullyTransparent()
     {
-    if (!iMask || !iMask->Handle())
-        {
+    if (!HasMask())
         return EFalse;
-        }
 
     if( iMask->DisplayMode() != EGray2 )
         {
@@ -630,7 +628,7 @@
 		if ( iBitmap && iBitmap->Handle() ) 
 			iBitmap->CompressInBackground();
 		
-        if ( iMask && iMask->Handle() )
+        if ( HasMask() )
             iMask->CompressInBackground();
         
     }