diff -r e1bea15f9a39 -r 79859ed3eea9 webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp --- a/webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp Thu Aug 19 10:58:56 2010 +0300 +++ b/webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp Tue Aug 31 16:17:46 2010 +0300 @@ -34,7 +34,6 @@ // ----------------------------------------------------------------------------- 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 ) ); @@ -55,7 +54,6 @@ 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 ) { @@ -83,7 +81,7 @@ CMaskedBitmap::CMaskedBitmap(CFbsBitmap* aBitmap, CFbsBitmap* aMask) -: iBitmap(aBitmap),iMask(aMask),i_DecodingCompleted(ETrue) +: iBitmap(aBitmap),iMask(aMask) { } @@ -186,8 +184,6 @@ err = BitmapUtil::CopyBitmap( aBitmap, *iBitmap ); } } - if(!err) - SetInitialisationCompletionStatus(ETrue); return err; } @@ -219,7 +215,7 @@ } } - if( !err && maskHandle && iMask) + if( !err && maskHandle ) { if( aDuplicate ) { @@ -234,8 +230,6 @@ iBitmap->Reset(); } } - if(!err) - SetInitialisationCompletionStatus(ETrue); return err; } @@ -253,8 +247,7 @@ void CMaskedBitmap::Reset() { iBitmap->Reset(); - if(iMask) iMask->Reset(); - SetInitialisationCompletionStatus(EFalse); + iMask->Reset(); } @@ -279,7 +272,7 @@ // ----------------------------------------------------------------------------- TBool CMaskedBitmap::HasMask() const { - return (iMask && iMask->Handle()!=0 ); + return ( iMask->Handle() != 0 ); } // ----------------------------------------------------------------------------- @@ -302,7 +295,7 @@ } if( iBitmap->Handle() ) { - if( HasMask() ) + if( iMask->Handle() ) { aContext.BitBltMasked( aPoint, iBitmap, s, iMask, iInvertMask ); } @@ -324,7 +317,7 @@ } if( iBitmap->Handle() ) { - if( HasMask() ) + if( iMask->Handle() ) { aContext.BitBltMasked( aPoint, iBitmap, aSource, iMask, iInvertMask ); @@ -349,7 +342,7 @@ if( iBitmap->Handle() ) { // ### FIXME DrawBitmapMasked is too buggy to use 2.8/week52, so no transparency with scaling - if( HasMask() ) + if( iMask->Handle() ) { aContext.DrawBitmapMasked( aTarget, iBitmap, s, iMask, iInvertMask ); } @@ -372,7 +365,7 @@ if( iBitmap->Handle() ) { // ### FIXME DrawBitmapMasked is too buggy to use 2.8/week52, so no transparency with scaling - if( HasMask() ) + if( iMask->Handle() ) { aContext.DrawBitmapMasked( aTarget, iBitmap, aSource, iMask, iInvertMask ); } @@ -448,8 +441,10 @@ void CMaskedBitmap::Resize(TSize aSize) { iBitmap->Resize(aSize); - if (HasMask()) + if (iMask) + { iMask->Resize(aSize); + } } // ----------------------------------------------------------------------------- @@ -477,7 +472,6 @@ { gc.SetBrushStyle(CGraphicsContext::ENullBrush); TPoint off(srcPt.iX, srcPt.iY); - for (TInt x = off.iX; xLockHeap(); - - if ( aTrgRect.Width() < 0 || aTrgRect.Height() < 0 ) - { - trgBmp->UnlockHeap(); - return; - } + TSize sz = trgBmp->SizeInPixels(); TUint32* buf = (TUint32*)(trgBmp->DataAddress()); @@ -600,8 +589,10 @@ TBool CMaskedBitmap::IsFullyTransparent() { - if (!HasMask()) + if (!iMask || !iMask->Handle()) + { return EFalse; + } if( iMask->DisplayMode() != EGray2 ) { @@ -639,20 +630,21 @@ if ( iBitmap && iBitmap->Handle() ) iBitmap->CompressInBackground(); - if ( HasMask() ) + if ( iMask && iMask->Handle() ) iMask->CompressInBackground(); } -CMaskedBitmap* CMaskedBitmap::ScaleImageToSize( TSize newSize, bool storeScaledImage) +CMaskedBitmap* CMaskedBitmap::ScaleImageToSize( TSize newSize ) { - - if (storeScaledImage && iScaledBitmap && iScaledBitmap->SizeInPixels() == newSize) + if (iScaledBitmap && iScaledBitmap->SizeInPixels() == newSize) return iScaledBitmap; - CMaskedBitmap* scaledBitmap = CMaskedBitmap::NewL(); + delete iScaledBitmap; + iScaledBitmap = NULL; + iScaledBitmap = CMaskedBitmap::NewL(); - CFbsBitmap& bmp = scaledBitmap->BitmapModifyable(); + CFbsBitmap& bmp = iScaledBitmap->BitmapModifyable(); bmp.Create(newSize, iBitmap->DisplayMode()); // scale the image quickly @@ -664,7 +656,7 @@ bitGc->DrawBitmap(TRect(TPoint(0,0), newSize), iBitmap, iBitmap->SizeInPixels()); CleanupStack::PopAndDestroy(2); - CFbsBitmap& msk = scaledBitmap->MaskModifyable(); + CFbsBitmap& msk = iScaledBitmap->MaskModifyable(); if( HasMask() ) { msk.Create(newSize, iMask->DisplayMode()); @@ -677,24 +669,8 @@ bitGc->DrawBitmap(TRect(TPoint(0,0), newSize), iMask, iMask->SizeInPixels()); CleanupStack::PopAndDestroy(2); } - if (storeScaledImage) { - delete iScaledBitmap; - iScaledBitmap = NULL; - iScaledBitmap = scaledBitmap; - } - return scaledBitmap; + + return iScaledBitmap; } -void CMaskedBitmap::SetInitialisationCompletionStatus(TBool aDecodingCompleted) -{ - i_DecodingCompleted = aDecodingCompleted; -} - - -TBool CMaskedBitmap::IsCompletlyInitialised() -{ - return i_DecodingCompleted; -} - - // End of File