X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fcommon%2Fadaptor-impl.cpp;h=67e759f26cc86480c91a2861dff1791e59ecee15;hb=refs%2Fchanges%2F69%2F183769%2F9;hp=6f52ff625998fe1288bf39196b829671a86e9452;hpb=c97aabad2073f2a1516fe2025346dc9ddca18651;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp old mode 100644 new mode 100755 index 6f52ff6..67e759f --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -90,6 +90,7 @@ Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Con Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ) { Any winId = window.GetNativeHandle(); + Window& windowImpl = Dali::GetImplementation(window); Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions ); windowImpl.SetAdaptor(*adaptor); @@ -137,11 +138,22 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration ) mGLES = new GlImplementation(); } - mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel() ); + const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() ); + const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() ); + + mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable ); EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation(); - mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGLES, *eglSyncImpl, *mGestureManager, dataRetentionPolicy ); + mCore = Integration::Core::New( *this, + *mPlatformAbstraction, + *mGLES, + *eglSyncImpl, + *mGestureManager, + dataRetentionPolicy , + ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE, + depthBufferAvailable, + stencilBufferAvailable ); const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval(); if( 0u < timeInterval ) @@ -188,6 +200,38 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration ) { Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount()); } + if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 ) + { + Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false ); + } + if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 ) + { + Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() ); + } + if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 ) + { + Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false ); + } + if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 ) + { + Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false ); + } + if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 ) + { + Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() ); + } + if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f ) + { + Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() ); + } + if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f ) + { + Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() ); + } + if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 ) + { + Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() ); + } // Set max texture size if( mEnvironmentOptions->GetMaxTextureSize() > 0 ) @@ -273,8 +317,6 @@ void Adaptor::Start() // Initialize the thread controller mThreadController->Initialize(); - mState = RUNNING; - ProcessCoreEvents(); // Ensure any startup messages are processed. for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter ) @@ -286,6 +328,8 @@ void Adaptor::Start() // Dali::Internal::Adaptor::Adaptor::Pause void Adaptor::Pause() { + DALI_LOG_RELEASE_INFO( "Adaptor::Pause: mState [%d]\n", mState ); + // Only pause the adaptor if we're actually running. if( RUNNING == mState ) { @@ -302,14 +346,18 @@ void Adaptor::Pause() } mThreadController->Pause(); - mCore->Suspend(); mState = PAUSED; + + // Ensure any messages queued during pause callbacks are processed by doing another update. + RequestUpdateOnce(); } } // Dali::Internal::Adaptor::Adaptor::Resume void Adaptor::Resume() { + DALI_LOG_RELEASE_INFO( "Adaptor::Resume: mState [%d]\n", mState ); + // Only resume the adaptor if we are in the suspended state. if( PAUSED == mState ) { @@ -327,8 +375,8 @@ void Adaptor::Resume() (*iter)->OnResume(); } - // Resume core so it processes any requests as well - mCore->Resume(); + // trigger processing of events queued up while paused + mCore->ProcessEvents(); // Do at end to ensure our first update/render after resumption includes the processed messages as well mThreadController->Resume(); @@ -347,7 +395,6 @@ void Adaptor::Stop() } mThreadController->Stop(); - mCore->Suspend(); // Delete the TTS player for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++) @@ -439,12 +486,12 @@ Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode) return mTtsPlayers[mode]; } -bool Adaptor::AddIdle( CallbackBase* callback ) +bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd ) { bool idleAdded(false); // Only add an idle if the Adaptor is actually running - if( RUNNING == mState ) + if( RUNNING == mState || READY == mState || forceAdd ) { idleAdded = mCallbackManager->AddIdleCallback( callback ); } @@ -656,29 +703,48 @@ void Adaptor::ProcessCoreEvents() } } -void Adaptor::RequestUpdate() +void Adaptor::RequestUpdate( bool forceUpdate ) { - // When Dali applications are partially visible behind the lock-screen, - // the indicator must be updated (therefore allow updates in the PAUSED state) - if ( PAUSED == mState || - RUNNING == mState ) + switch( mState ) { - mThreadController->RequestUpdate(); + case RUNNING: + { + mThreadController->RequestUpdate(); + break; + } + case PAUSED: + case PAUSED_WHILE_HIDDEN: + { + // When Dali applications are partially visible behind the lock-screen, + // the indicator must be updated (therefore allow updates in the PAUSED state) + if( forceUpdate ) + { + mThreadController->RequestUpdateOnce(); + } + break; + } + default: + { + // Do nothing + break; + } } } -void Adaptor::RequestProcessEventsOnIdle() +void Adaptor::RequestProcessEventsOnIdle( bool forceProcess ) { // Only request a notification if the Adaptor is actually running // and we haven't installed the idle notification - if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState ) ) + if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) ) { - mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ) ); + mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess ); } } void Adaptor::OnWindowShown() { + DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowShown: mState [%d]\n", mState ); + if ( PAUSED_WHILE_HIDDEN == mState ) { // Adaptor can now be resumed @@ -693,7 +759,9 @@ void Adaptor::OnWindowShown() void Adaptor::OnWindowHidden() { - if ( STOPPED != mState ) + DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowHidden: mState [%d]\n", mState ); + + if ( RUNNING == mState ) { Pause(); @@ -706,7 +774,15 @@ void Adaptor::OnWindowHidden() void Adaptor::OnDamaged( const DamageArea& area ) { // This is needed for the case where Dali window is partially obscured - RequestUpdate(); + RequestUpdate( false ); +} + +void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize, int orientation ) +{ + // let the core know the surface size and orientation has changed + mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight(), orientation ); + + mResizedSignal.Emit( mAdaptor ); } void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize ) @@ -723,7 +799,6 @@ void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize ) // to start processing messages for new camera setup etc as soon as possible ProcessCoreEvents(); - // this method blocks until the render thread has completed the resizing. mThreadController->ResizeSurface(); } @@ -736,6 +811,8 @@ void Adaptor::NotifySceneCreated() // process after surface is created (registering to remote surface provider if required) SurfaceInitialized(); + + mState = RUNNING; } void Adaptor::NotifyLanguageChanged() @@ -750,12 +827,9 @@ void Adaptor::RenderOnce() void Adaptor::RequestUpdateOnce() { - if( PAUSED_WHILE_HIDDEN != mState ) + if( mThreadController ) { - if( mThreadController ) - { - mThreadController->RequestUpdateOnce(); - } + mThreadController->RequestUpdateOnce(); } } @@ -839,8 +913,8 @@ void Adaptor::SetRootLayoutDirection( std::string locale ) { Dali::Stage stage = Dali::Stage::GetCurrent(); - stage.GetRootLayer().SetProperty( DevelActor::Property::LAYOUT_DIRECTION, - static_cast< DevelActor::LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) ); + stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION, + static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) ); } } // namespace Adaptor