[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-manager.cpp
index 986e430..c539eb1 100755 (executable)
@@ -503,7 +503,7 @@ ProgramCache* RenderManager::GetProgramCache()
   return &(mImpl->programController);
 }
 
-void RenderManager::Render( Integration::RenderStatus& status, bool forceClear )
+void RenderManager::Render( Integration::RenderStatus& status, bool forceClear, bool uploadOnly )
 {
   DALI_PRINT_RENDER_START( mImpl->renderBufferIndex );
 
@@ -530,8 +530,11 @@ void RenderManager::Render( Integration::RenderStatus& status, bool forceClear )
   {
     DALI_LOG_INFO( gLogFilter, Debug::General, "Render: Processing\n" );
 
-    // Mark that we will require a post-render step to be performed (includes swap-buffers).
-    status.SetNeedsPostRender( true );
+    if ( !uploadOnly )
+    {
+      // Mark that we will require a post-render step to be performed (includes swap-buffers).
+      status.SetNeedsPostRender( true );
+    }
 
     // Switch to the shared context
     if ( mImpl->currentContext != &mImpl->context )
@@ -583,23 +586,26 @@ void RenderManager::Render( Integration::RenderStatus& status, bool forceClear )
       }
     }
 
-    for( uint32_t i = 0; i < count; ++i )
+    if ( !uploadOnly )
     {
-      RenderInstruction& instruction = mImpl->instructions.At( mImpl->renderBufferIndex, i );
+      for( uint32_t i = 0; i < count; ++i )
+      {
+        RenderInstruction& instruction = mImpl->instructions.At( mImpl->renderBufferIndex, i );
 
-      DoRender( instruction );
-    }
+        DoRender( instruction );
+      }
 
-    if ( mImpl->currentContext->IsSurfacelessContextSupported() )
-    {
-      mImpl->glContextHelperAbstraction.MakeSurfacelessContextCurrent();
-    }
+      if ( mImpl->currentContext->IsSurfacelessContextSupported() )
+      {
+        mImpl->glContextHelperAbstraction.MakeSurfacelessContextCurrent();
+      }
 
-    GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
-    mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
-    for ( auto&& context : mImpl->surfaceContextContainer )
-    {
-      context->InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
+      GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
+      mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
+      for ( auto&& context : mImpl->surfaceContextContainer )
+      {
+        context->InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
+      }
     }
 
     //Notify RenderGeometries that rendering has finished
@@ -705,8 +711,8 @@ void RenderManager::DoRender( RenderInstruction& instruction )
   Rect<int32_t> viewportRect;
   Vector4   clearColor;
   bool isPartialUpdate = false;
-  Rect<int32_t> damagedRect;
-  Rect<int32_t> mergedRect;
+  Dali::DamagedRect damagedRect;
+  Dali::DamagedRect mergedRect;
   Dali::ClippingBox scissorBox;
   Dali::ClippingBox intersectRect;
 
@@ -794,7 +800,6 @@ void RenderManager::DoRender( RenderInstruction& instruction )
   if( surfaceFrameBuffer &&
       partialUpdateAvailable == Integration::PartialUpdateAvailable::TRUE )
   {
-    const RenderListContainer::SizeType renderListCount = instruction.RenderListCount();
     // Iterate through each render list.
     if( surfaceFrameBuffer->IsPartialUpdateEnabled() )
     {
@@ -806,7 +811,7 @@ void RenderManager::DoRender( RenderInstruction& instruction )
       damagedRect = surfaceRect;
     }
 
-    mergedRect = surfaceFrameBuffer->SetDamagedRect( damagedRect );
+    surfaceFrameBuffer->SetDamagedRect( damagedRect, mergedRect );
 
     if( mergedRect.IsEmpty() )
     {