X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fintegration-api%2Fadaptor-framework%2Fscene-holder-impl.cpp;h=e545376fe9f8969548ab63e0208ad3a3addd113d;hb=65b078a9ff82302a437788135fed9776ff856188;hp=7162a1c715d5b2317faf0c715e602307730ef13f;hpb=9fb478f2026d93895ec97f8211c41b3e5be58b7f;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index 7162a1c..e545376 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include #include #include #include @@ -31,6 +32,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include @@ -47,7 +49,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 @@ -120,6 +122,7 @@ SceneHolder::SceneHolder() mId( mSceneHolderCounter++ ), mSurface( nullptr ), mAdaptor( nullptr ), + mDpi(), mIsBeingDeleted( false ), mAdaptorStarted( false ), mVisible( true ) @@ -185,6 +188,11 @@ Dali::Integration::Scene SceneHolder::GetScene() return mScene; } +Uint16Pair SceneHolder::GetDpi() const +{ + return mDpi; +} + void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface) { mSurface.reset( surface ); @@ -193,13 +201,10 @@ void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface) SurfaceResized(); - unsigned int dpiHorizontal, dpiVertical; - dpiHorizontal = dpiVertical = 0; - - mSurface->GetDpi( dpiHorizontal, dpiVertical ); - mScene.SetDpi( Vector2( static_cast( dpiHorizontal ), static_cast( dpiVertical ) ) ); + InitializeDpi(); mSurface->SetAdaptor( *mAdaptor ); + mSurface->SetScene( mScene ); OnSurfaceSet( surface ); } @@ -208,6 +213,13 @@ void SceneHolder::SurfaceResized() { PositionSize surfacePositionSize = mSurface->GetPositionSize(); mScene.SurfaceResized( static_cast( surfacePositionSize.width ), static_cast( surfacePositionSize.height ) ); + + GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface(); + EglGraphics* eglGraphics = static_cast(&graphics); + if (eglGraphics) + { + eglGraphics->SetFullSwapNextFrame(); + } } Dali::RenderSurfaceInterface* SceneHolder::GetSurface() const @@ -220,6 +232,13 @@ void SceneHolder::SetBackgroundColor( const Vector4& color ) if( mScene ) { mScene.SetBackgroundColor( color ); + + GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface(); + EglGraphics* eglGraphics = static_cast(&graphics); + if (eglGraphics) + { + eglGraphics->SetFullSwapNextFrame(); + } } } @@ -236,6 +255,8 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor) return; } + DALI_ASSERT_DEBUG(mSurface && "Surface needs to be set before calling this method\n"); + mAdaptorStarted = true; // Create the scene @@ -248,16 +269,10 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor) // Create an observer for the adaptor lifecycle mAdaptor->AddObserver( *mLifeCycleObserver ); - if ( mSurface ) - { - unsigned int dpiHorizontal, dpiVertical; - dpiHorizontal = dpiVertical = 0; - - mSurface->GetDpi( dpiHorizontal, dpiVertical ); - mScene.SetDpi( Vector2( static_cast( dpiHorizontal ), static_cast( dpiVertical ) ) ); + InitializeDpi(); - mSurface->SetAdaptor( *mAdaptor ); - } + mSurface->SetAdaptor( *mAdaptor ); + mSurface->SetScene( mScene ); OnAdaptorSet( adaptor ); } @@ -290,7 +305,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 +357,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; @@ -372,6 +401,17 @@ void SceneHolder::Reset() mAdaptor->ProcessCoreEvents(); } +void SceneHolder::InitializeDpi() +{ + unsigned int dpiHorizontal, dpiVertical; + dpiHorizontal = dpiVertical = 0; + + mSurface->GetDpi( dpiHorizontal, dpiVertical ); + mScene.SetDpi( Vector2( static_cast( dpiHorizontal ), static_cast( dpiVertical ) ) ); + + mDpi.SetX( dpiHorizontal ); + mDpi.SetY( dpiVertical ); +} }// Adaptor