[4.0] Supports screen rotation.
[platform/core/uifw/dali-adaptor.git] / adaptors / common / adaptor-impl.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 0c7c4e4..67e759f
@@ -93,8 +93,6 @@ Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLo
 
   Window& windowImpl = Dali::GetImplementation(window);
   Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
-
-  Internal::Adaptor::Adaptor::GetImplementation( *adaptor ).SetWindow( window );
   windowImpl.SetAdaptor(*adaptor);
   return adaptor;
 }
@@ -140,7 +138,10 @@ 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();
 
@@ -150,7 +151,9 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
                                   *eglSyncImpl,
                                   *mGestureManager,
                                   dataRetentionPolicy ,
-                                  0u != mEnvironmentOptions->GetRenderToFboInterval() );
+                                  ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
+                                  depthBufferAvailable,
+                                  stencilBufferAvailable );
 
   const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
   if( 0u < timeInterval )
@@ -197,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 )
@@ -293,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 )
   {
@@ -311,7 +348,7 @@ void Adaptor::Pause()
     mThreadController->Pause();
     mState = PAUSED;
 
-    // Process remained events and rendering in the update thread
+    // Ensure any messages queued during pause callbacks are processed by doing another update.
     RequestUpdateOnce();
   }
 }
@@ -319,6 +356,8 @@ void Adaptor::Pause()
 // 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 )
   {
@@ -452,7 +491,7 @@ bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
   bool idleAdded(false);
 
   // Only add an idle if the Adaptor is actually running
-  if( RUNNING == mState || forceAdd )
+  if( RUNNING == mState || READY == mState || forceAdd )
   {
     idleAdded = mCallbackManager->AddIdleCallback( callback );
   }
@@ -696,7 +735,7 @@ 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 || forceProcess ) )
+  if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
   {
     mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
   }
@@ -704,6 +743,8 @@ void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
 
 void Adaptor::OnWindowShown()
 {
+  DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowShown: mState [%d]\n", mState );
+
   if ( PAUSED_WHILE_HIDDEN == mState )
   {
     // Adaptor can now be resumed
@@ -718,6 +759,8 @@ void Adaptor::OnWindowShown()
 
 void Adaptor::OnWindowHidden()
 {
+  DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowHidden: mState [%d]\n", mState );
+
   if ( RUNNING == mState )
   {
     Pause();
@@ -734,6 +777,14 @@ void Adaptor::OnDamaged( const DamageArea& area )
   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 )
 {
   // let the core know the surface size has changed
@@ -748,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();
 }
 
@@ -829,7 +879,6 @@ Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surfac
   mTriggerEventFactory(),
   mObjectProfiler( NULL ),
   mSocketFactory(),
-  mWindow(),
   mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
   mUseRemoteSurface( false )
 {
@@ -868,16 +917,6 @@ void Adaptor::SetRootLayoutDirection( std::string locale )
                                     static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
 }
 
-void Adaptor::SetWindow( Dali::Window window )
-{
-  mWindow = window;
-}
-
-Dali::Window Adaptor::GetWindow()
-{
-  return mWindow;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal