Revert "Remove EGL surface in the update thread"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-render-surface.cpp
index 6d4ba4f..e1a344f 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.
@@ -204,9 +204,10 @@ void WindowRenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpi
 
 void WindowRenderSurface::InitializeGraphics()
 {
-
   mGraphics = &mAdaptor->GetGraphicsInterface();
 
+  DALI_ASSERT_ALWAYS( mGraphics && "Graphics interface is not created" );
+
   auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
   mEGL = &eglGraphics->GetEglInterface();
 
@@ -258,13 +259,15 @@ void WindowRenderSurface::DestroySurface()
   DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+  if( eglGraphics )
+  {
+    DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() );
 
-  DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() );
-
-  Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
-  eglImpl.DestroySurface( mEGLSurface );
+    Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+    eglImpl.DestroySurface( mEGLSurface );
 
-  mWindowBase->DestroyEglWindow();
+    mWindowBase->DestroyEglWindow();
+  }
 }
 
 bool WindowRenderSurface::ReplaceGraphicsSurface()
@@ -459,9 +462,9 @@ void WindowRenderSurface::ReleaseLock()
   // Nothing to do.
 }
 
-Integration::RenderSurface::Type WindowRenderSurface::GetSurfaceType()
+Dali::RenderSurfaceInterface::Type WindowRenderSurface::GetSurfaceType()
 {
-  return RenderSurface::WINDOW_RENDER_SURFACE;
+  return Dali::RenderSurfaceInterface::WINDOW_RENDER_SURFACE;
 }
 
 void WindowRenderSurface::MakeContextCurrent()