Revert "Remove EGL surface in the update thread"
[platform/core/uifw/dali-adaptor.git] / dali / integration-api / adaptor-framework / scene-holder-impl.cpp
index 1a213a2..2440b35 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -120,6 +120,7 @@ SceneHolder::SceneHolder()
   mId( mSceneHolderCounter++ ),
   mSurface( nullptr ),
   mAdaptor( nullptr ),
+  mIsBeingDeleted( false ),
   mAdaptorStarted( false ),
   mVisible( true )
 {
@@ -132,8 +133,6 @@ SceneHolder::~SceneHolder()
     mAdaptor->RemoveObserver( *mLifeCycleObserver.get() );
     mAdaptor->RemoveWindow( this );
 
-    mAdaptor->DeleteSurface( *mSurface.get() );
-
     mAdaptor = nullptr;
   }
 
@@ -188,7 +187,9 @@ void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface)
 {
   mSurface.reset( surface );
 
-  mScene.SetSurface( *mSurface.get() );
+  mScene.SurfaceReplaced();
+
+  SurfaceResized();
 
   unsigned int dpiHorizontal, dpiVertical;
   dpiHorizontal = dpiVertical = 0;
@@ -203,7 +204,8 @@ void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface)
 
 void SceneHolder::SurfaceResized()
 {
-  mScene.SurfaceResized();
+  PositionSize surfacePositionSize = mSurface->GetPositionSize();
+  mScene.SurfaceResized( static_cast<float>( surfacePositionSize.width ), static_cast<float>( surfacePositionSize.height ) );
 }
 
 Dali::RenderSurfaceInterface* SceneHolder::GetSurface() const
@@ -235,7 +237,8 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor)
   mAdaptorStarted = true;
 
   // Create the scene
-  mScene = Dali::Integration::Scene::New( *mSurface );
+  PositionSize surfacePositionSize = mSurface->GetPositionSize();
+  mScene = Dali::Integration::Scene::New( Size(static_cast<float>( surfacePositionSize.width ), static_cast<float>( surfacePositionSize.height )) );
 
   Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation( adaptor );
   mAdaptor = &adaptorImpl;