[4.0] DALi version 1.2.84
[platform/core/uifw/dali-adaptor.git] / adaptors / base / render-helper.cpp
index 9ef0ee9..1276078 100644 (file)
@@ -79,9 +79,6 @@ void RenderHelper::Stop()
   {
     // Tell surface we have stopped rendering
     mSurface->StopRender();
-
-    // The surface will be destroyed soon; this pointer will become invalid
-    mSurface = NULL;
   }
 }
 
@@ -140,6 +137,8 @@ void RenderHelper::ShutdownEgl()
   {
     // give a chance to destroy the OpenGL surface that created externally
     mSurface->DestroyEglSurface( *mEGL );
+
+    mSurface = NULL;
   }
 
   // delete the GL context / egl surface
@@ -156,15 +155,23 @@ bool RenderHelper::PreRender()
   return true;
 }
 
-void RenderHelper::PostRender()
+void RenderHelper::PostRender( bool renderToFbo )
 {
   // Inform the gl implementation that rendering has finished before informing the surface
   mGLES.PostRender();
 
-  if( mSurface )
+  if( renderToFbo )
+  {
+    mGLES.Flush();
+    mGLES.Finish();
+  }
+  else
   {
-    // Inform the surface that rendering this frame has finished.
-    mSurface->PostRender( *mEGL, mGLES, mDisplayConnection, mSurfaceReplaced, mSurfaceResized );
+    if( mSurface )
+    {
+      // Inform the surface that rendering this frame has finished.
+      mSurface->PostRender( *mEGL, mGLES, mDisplayConnection, mSurfaceReplaced, mSurfaceResized );
+    }
   }
   mSurfaceReplaced = false;
   mSurfaceResized = false;