Merge "Performance Improvements: Remove unnecessary SwapBuffer calls" into devel...
[platform/core/uifw/dali-adaptor.git] / adaptors / base / render-helper.cpp
index 35d377f..b4ee999 100644 (file)
@@ -43,7 +43,14 @@ RenderHelper::RenderHelper( AdaptorInternalServices& adaptorInterfaces )
   // set the initial values before render thread starts
   mSurface = adaptorInterfaces.GetRenderSurfaceInterface();
 
-  mDisplayConnection = Dali::DisplayConnection::New();
+  if( mSurface )
+  {
+    mDisplayConnection = Dali::DisplayConnection::New( mSurface->GetSurfaceType() );
+  }
+  else
+  {
+    mDisplayConnection = Dali::DisplayConnection::New();
+  }
 }
 
 RenderHelper::~RenderHelper()
@@ -104,6 +111,8 @@ void RenderHelper::InitializeEgl()
 
 void RenderHelper::ReplaceSurface( RenderSurface* newSurface )
 {
+  mSurface->DestroyEglSurface(*mEGL);
+
   // This is designed for replacing pixmap surfaces, but should work for window as well
   // we need to delete the egl surface and renderable (pixmap / window)
   // Then create a new pixmap/window and new egl surface