[dali_1.9.20] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / integration-api / adaptor-framework / scene-holder-impl.cpp
index 7162a1c..e296ea1 100644 (file)
@@ -31,6 +31,7 @@
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/adaptor/common/lifecycle-observer.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/input/common/key-impl.h>
 #include <dali/internal/input/common/physical-keyboard-impl.h>
 
@@ -47,7 +48,7 @@ namespace
 {
 
 #if defined(DEBUG_ENABLED)
-Integration::Log::Filter* gTouchEventLogFilter  = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_TOUCH");
+Debug::Filter* gSceneHolderLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_SCENE_HOLDER" );
 #endif
 
 // Copied from x server
@@ -200,6 +201,7 @@ void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface)
   mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
 
   mSurface->SetAdaptor( *mAdaptor );
+  mSurface->SetScene( mScene );
 
   OnSurfaceSet( surface );
 }
@@ -208,6 +210,13 @@ void SceneHolder::SurfaceResized()
 {
   PositionSize surfacePositionSize = mSurface->GetPositionSize();
   mScene.SurfaceResized( static_cast<float>( surfacePositionSize.width ), static_cast<float>( surfacePositionSize.height ) );
+
+  GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+  EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+  if (eglGraphics)
+  {
+    eglGraphics->SetFullSwapNextFrame();
+  }
 }
 
 Dali::RenderSurfaceInterface* SceneHolder::GetSurface() const
@@ -220,6 +229,13 @@ void SceneHolder::SetBackgroundColor( const Vector4& color )
   if( mScene )
   {
     mScene.SetBackgroundColor( color );
+
+    GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+    EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+    if (eglGraphics)
+    {
+      eglGraphics->SetFullSwapNextFrame();
+    }
   }
 }
 
@@ -257,6 +273,7 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor)
     mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
 
     mSurface->SetAdaptor( *mAdaptor );
+    mSurface->SetScene( mScene );
   }
 
   OnAdaptorSet( adaptor );
@@ -290,7 +307,7 @@ void SceneHolder::FeedTouchPoint( Dali::Integration::Point& point, int timeStamp
   Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
   if( type != Integration::TouchEventCombiner::DispatchNone )
   {
-    DALI_LOG_INFO( gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetScreenPosition().x, point.GetScreenPosition().y );
+    DALI_LOG_INFO( gSceneHolderLogFilter, Debug::Verbose, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetScreenPosition().x, point.GetScreenPosition().y );
 
     // Signals can be emitted while processing core events, and the scene holder could be deleted in the signal callback.
     // Keep the handle alive until the core events are processed.
@@ -342,6 +359,20 @@ void SceneHolder::FeedKeyEvent( Dali::Integration::KeyEvent& keyEvent )
   mAdaptor->ProcessCoreEvents();
 }
 
+void SceneHolder::AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId )
+{
+  mScene.AddFrameRenderedCallback( std::move( callback ), frameId );
+
+  DALI_LOG_INFO( gSceneHolderLogFilter, Debug::General, "SceneHolder::AddFrameRenderedCallback:: Added [%d]\n", frameId );
+}
+
+void SceneHolder::AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId )
+{
+  mScene.AddFramePresentedCallback( std::move( callback ), frameId );
+
+  DALI_LOG_INFO( gSceneHolderLogFilter, Debug::General, "SceneHolder::AddFramePresentedCallback:: Added [%d]\n", frameId );
+}
+
 Dali::Integration::SceneHolder SceneHolder::Get( Dali::Actor actor )
 {
   SceneHolder* sceneHolderImpl = nullptr;