Revert "[Tizen] Add codes for Dali Windows Backend"
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / adaptor-impl.cpp
index 33dce23..d046790 100755 (executable)
@@ -37,8 +37,8 @@
 #include <dali/internal/system/common/performance-interface-factory.h>
 #include <dali/internal/adaptor/common/lifecycle-observer.h>
 
-#include <dali/internal/graphics/gles20/egl-graphics-factory.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h> // Temporary until Core is abstracted
+#include <dali/internal/graphics/gles/egl-graphics-factory.h>
+#include <dali/internal/graphics/gles/egl-graphics.h> // Temporary until Core is abstracted
 
 #include <dali/devel-api/text-abstraction/font-client.h>
 
@@ -47,9 +47,9 @@
 #include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
 #include <dali/internal/input/common/gesture-manager.h>
 #include <dali/internal/window-system/common/event-handler.h>
-#include <dali/internal/graphics/gles20/gl-proxy-implementation.h>
-#include <dali/internal/graphics/gles20/gl-implementation.h>
-#include <dali/internal/graphics/gles20/egl-sync-implementation.h>
+#include <dali/internal/graphics/gles/gl-proxy-implementation.h>
+#include <dali/internal/graphics/gles/gl-implementation.h>
+#include <dali/internal/graphics/gles/egl-sync-implementation.h>
 #include <dali/internal/graphics/common/egl-image-extensions.h>
 #include <dali/internal/clipboard/common/clipboard-impl.h>
 #include <dali/internal/graphics/common/vsync-monitor.h>
@@ -160,6 +160,9 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
   mCallbackManager = CallbackManager::New();
 
   WindowPane defaultWindow = mWindowFrame.front();
+
+  DALI_ASSERT_DEBUG( defaultWindow.surface && "Surface not initialized" );
+
   PositionSize size = defaultWindow.surface->GetPositionSize();
 
   mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
@@ -192,14 +195,7 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
 
   mVSyncMonitor = new VSyncMonitor;
 
-  if( defaultWindow.surface )
-  {
-    mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow.surface->GetSurfaceType() );
-  }
-  else
-  {
-    mDisplayConnection = Dali::DisplayConnection::New( *mGraphics );
-  }
+  mDisplayConnection = Dali::DisplayConnection::New( *mGraphics, defaultWindow.surface->GetSurfaceType() );
 
   mThreadController = new ThreadController( *this, *mEnvironmentOptions );
 
@@ -504,9 +500,7 @@ void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& newSurface )
   newDefaultWindow.nativeWindow = nativeWindow;
   newDefaultWindow.surface = &newSurface;
 
-  // Must delete the old Window first before replacing it with the new one
   WindowPane oldDefaultWindow = mWindowFrame.front();
-  oldDefaultWindow.surface->DestroySurface();
 
   // Update WindowFrame
   std::vector<WindowPane>::iterator iter = mWindowFrame.begin();
@@ -518,6 +512,10 @@ void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& newSurface )
 
   // This method blocks until the render thread has completed the replace.
   mThreadController->ReplaceSurface( newDefaultWindow.surface );
+
+  // Must delete the old Window only after the render thread has completed the replace
+  oldDefaultWindow.surface->DestroySurface();
+  oldDefaultWindow.surface = nullptr;
 }
 
 RenderSurface& Adaptor::GetSurface() const
@@ -972,7 +970,9 @@ Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surfac
   mCore( nullptr ),
   mThreadController( nullptr ),
   mVSyncMonitor( nullptr ),
+  mGraphics( nullptr ),
   mDisplayConnection( nullptr ),
+  mWindowFrame(),
   mPlatformAbstraction( nullptr ),
   mEventHandler( nullptr ),
   mCallbackManager( nullptr ),
@@ -1007,31 +1007,6 @@ Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surfac
   gThreadLocalAdaptor = this;
 }
 
-// Stereoscopy
-
-void Adaptor::SetViewMode( ViewMode viewMode )
-{
-  WindowPane defaultWindow = mWindowFrame.front();
-  defaultWindow.surface->SetViewMode( viewMode );
-
-  mCore->SetViewMode( viewMode );
-}
-
-ViewMode Adaptor::GetViewMode() const
-{
-  return mCore->GetViewMode();
-}
-
-void Adaptor::SetStereoBase( float stereoBase )
-{
-  mCore->SetStereoBase( stereoBase );
-}
-
-float Adaptor::GetStereoBase() const
-{
-  return mCore->GetStereoBase();
-}
-
 void Adaptor::SetRootLayoutDirection( std::string locale )
 {
   Dali::Stage stage = Dali::Stage::GetCurrent();