[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / dali / internal / common / core-impl.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 1a09947..863c7e5
@@ -23,6 +23,7 @@
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/events/event.h>
 #include <dali/integration-api/gl-sync-abstraction.h>
+#include <dali/integration-api/gl-context-helper-abstraction.h>
 #include <dali/integration-api/platform-abstraction.h>
 #include <dali/integration-api/processor-interface.h>
 #include <dali/integration-api/render-controller.h>
@@ -75,6 +76,7 @@ using Integration::RenderController;
 using Integration::PlatformAbstraction;
 using Integration::GlSyncAbstraction;
 using Integration::GlAbstraction;
+using Integration::GlContextHelperAbstraction;
 using Integration::Event;
 using Integration::UpdateStatus;
 using Integration::RenderStatus;
@@ -83,10 +85,12 @@ Core::Core( RenderController& renderController,
             PlatformAbstraction& platform,
             GlAbstraction& glAbstraction,
             GlSyncAbstraction& glSyncAbstraction,
+            GlContextHelperAbstraction& glContextHelperAbstraction,
             ResourcePolicy::DataRetention dataRetentionPolicy,
             Integration::RenderToFrameBuffer renderToFboEnabled,
             Integration::DepthBufferAvailable depthBufferAvailable,
-            Integration::StencilBufferAvailable stencilBufferAvailable )
+            Integration::StencilBufferAvailable stencilBufferAvailable,
+            Integration::PartialUpdateAvailable partialUpdateAvailable )
 : mRenderController( renderController ),
   mPlatform(platform),
   mProcessingEvent(false),
@@ -106,7 +110,7 @@ Core::Core( RenderController& renderController,
 
   mRenderTaskProcessor = new SceneGraph::RenderTaskProcessor();
 
-  mRenderManager = RenderManager::New( glAbstraction, glSyncAbstraction, depthBufferAvailable, stencilBufferAvailable );
+  mRenderManager = RenderManager::New( glAbstraction, glSyncAbstraction, glContextHelperAbstraction, depthBufferAvailable, stencilBufferAvailable, partialUpdateAvailable );
 
   RenderQueue& renderQueue = mRenderManager->GetRenderQueue();
 
@@ -191,13 +195,14 @@ void Core::ContextDestroyed()
   mRenderManager->ContextDestroyed();
 }
 
-void Core::SurfaceResized( Integration::RenderSurface* surface )
+void Core::SurfaceDeleted( Integration::RenderSurface* surface )
 {
-  for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+  for( auto scene : mScenes )
   {
-    if( (*iter)->GetSurface() == surface )
+    if( scene->GetSurface() == surface )
     {
-      (*iter)->SetSurface( *surface );
+      scene->SurfaceDeleted();
+      break;
     }
   }
 }
@@ -268,18 +273,22 @@ void Core::ProcessEvents()
   // Signal that any messages received will be flushed soon
   mUpdateManager->EventProcessingStarted();
 
+  // Scene could be added or removed while processing the events
+  // Copy the Scene container locally to avoid possibly invalid iterator
+  SceneContainer scenes = mScenes;
+
   // process events in all scenes
-  for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+  for( auto scene : scenes )
   {
-    (*iter)->ProcessEvents();
+    scene->ProcessEvents();
   }
 
   mNotificationManager->ProcessMessages();
 
   // Emit signal here to inform listeners that event processing has finished.
-  for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+  for( auto scene : scenes )
   {
-    (*iter)->EmitEventProcessingFinishedSignal();
+    scene->EmitEventProcessingFinishedSignal();
   }
 
   // Run any registered processors
@@ -289,9 +298,9 @@ void Core::ProcessEvents()
   mRelayoutController->Relayout();
 
   // Rebuild depth tree after event processing has finished
-  for( auto iter = mScenes.begin(); iter != mScenes.end(); ++iter )
+  for( auto scene : scenes )
   {
-    (*iter)->RebuildDepthTree();
+    scene->RebuildDepthTree();
   }
 
   // Flush any queued messages for the update-thread