diff -r b01126ce0bec -r ba63c83f4716 taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/src/previewprovidercrp.cpp --- a/taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/src/previewprovidercrp.cpp Wed Sep 15 12:00:00 2010 +0300 +++ b/taskswitcher/contextengine/tsfswpreviewprovider/wsplugin/src/previewprovidercrp.cpp Wed Oct 13 14:18:30 2010 +0300 @@ -33,7 +33,7 @@ // CONSTANTS const TInt KImpId( 0x20016BEC ); -const TInt64 KMinTimeForOrientationSwitch = 500000; // 0.5 second +const TInt KMinTimeForOrientationSwitch = 1; // 1 second // -------------------------------------------------------------------------- // CPreviewProviderCRP::CreateL @@ -126,7 +126,7 @@ iScreenshotMode = static_cast( in.ReadInt32L() ); break; case NPreviewMsg::ETakePreview: - ScreenshotL( FALSE ); + ScreenshotL(); break; case NPreviewMsg::EAckPreviewReady: RemoveScreenshot( in.ReadInt32L() ); @@ -172,18 +172,21 @@ { TTime currTime; currTime.HomeTime(); - TTimeIntervalMicroSeconds micSecondsFrom = currTime.MicroSecondsFrom( iScreenChangedTime ); - if ( micSecondsFrom.Int64() > KMinTimeForOrientationSwitch ) + TTimeIntervalSeconds secondsFrom; + TInt err = currTime.SecondsFrom( iScreenChangedTime, secondsFrom ); + if ( err != KErrNone || secondsFrom.Int() > KMinTimeForOrientationSwitch ) { if ( iLastWgIdRedraw ) { - TRAP_IGNORE( ScreenshotL( FALSE ) ); + TRAP_IGNORE( ScreenshotL() ); } } else { // Reset time to allow screenshot taking on next wg change iScreenChangedTime = 0; + // Order screenshot rotation + BitmapRotationNeeded( iPrevId?iPrevId:iPrevReg, iClockwiseRot ); } iPrevReg = 0; } @@ -195,9 +198,7 @@ iScreenChangedTime.HomeTime(); if ( iLastWgIdRedraw ) { - TRAP_IGNORE( - ScreenshotL( TRUE ); - ); + TRAP_IGNORE( ScreenshotL() ); } } else if ( aEvent.Type() == TWservCrEvent::EScreenDrawing ) @@ -212,22 +213,13 @@ // CPreviewProviderCRP::ScaleComplete // -------------------------------------------------------------------------- // -void CPreviewProviderCRP::ScaleCompleteL( const CFbsBitmap& aBitmap, - TBool aRotation ) +void CPreviewProviderCRP::ScaleCompleteL( const CFbsBitmap& aBitmap ) { TSLOG_CONTEXT( ScaleComplete, TSLOG_LOCAL ); TSLOG_IN(); - TInt msgType = NPreviewMsg::EPreviewReady; - if ( aRotation ) - { - msgType = iClockwiseRot ? - NPreviewMsg::EBitmapRotationNeeded90 : - NPreviewMsg::EBitmapRotationNeeded270; - } - const TInt msg[] = { - msgType, + NPreviewMsg::EPreviewReady, iPrevId?iPrevId:iPrevReg, aBitmap.Handle() }; @@ -260,6 +252,28 @@ TSLOG_OUT(); } + +// -------------------------------------------------------------------------- +// CPreviewProviderCRP::BitmapRotationNeeded +// -------------------------------------------------------------------------- +// +void CPreviewProviderCRP::BitmapRotationNeeded( TInt aWgId, TBool aClockwise ) + { + TSLOG_CONTEXT( BitmapRotationNeeded, TSLOG_LOCAL ); + TSLOG_IN(); + + const TInt msg[] = { + aClockwise ? NPreviewMsg::EBitmapRotationNeeded90 : NPreviewMsg::EBitmapRotationNeeded270, + aWgId, + 0 + }; + TPckgC buf(msg); + SendMessage(buf); + + TSLOG_OUT(); + } + + // -------------------------------------------------------------------------- // CPreviewProviderCRP::Register // -------------------------------------------------------------------------- @@ -299,12 +313,12 @@ // CPreviewProviderCRP::ScreenShotL // -------------------------------------------------------------------------- // -void CPreviewProviderCRP::ScreenshotL( TBool aRotation ) +void CPreviewProviderCRP::ScreenshotL() { CFbsBitmap* screenshot = new (ELeave)CFbsBitmap(); CleanupStack::PushL( screenshot ); ScreenshotL( *screenshot ); - ScaleCompleteL( *screenshot, aRotation ); + ScaleCompleteL( *screenshot ); iScreenshots.InsertL( screenshot, iScreenshots.Count() ); CleanupStack::Pop( screenshot ); CheckOverflow();