Revert "[Tizen] Partial rendering rotation does not work."
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-manager.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 5725d0f..3114f55
@@ -151,22 +151,27 @@ struct RenderManager::Impl
 
   Context* CreateSceneContext()
   {
-    sceneContextContainer.push_back( new Context( glAbstraction ) );
-    return sceneContextContainer[ sceneContextContainer.size() - 1 ];
+    Context* context = new Context( glAbstraction );
+    sceneContextContainer.PushBack( context );
+    return context;
   }
 
   void DestroySceneContext( Context* sceneContext )
   {
-    auto iter = std::find( sceneContextContainer.begin(), sceneContextContainer.end(), sceneContext );
-    if( iter != sceneContextContainer.end() )
+    auto iter = std::find( sceneContextContainer.Begin(), sceneContextContainer.End(), sceneContext );
+    if( iter != sceneContextContainer.End() )
     {
-      sceneContextContainer.erase( iter );
+      ( *iter )->GlContextDestroyed();
+      sceneContextContainer.Erase( iter );
     }
   }
 
   Context* ReplaceSceneContext( Context* oldSceneContext )
   {
     Context* newContext = new Context( glAbstraction );
+
+    oldSceneContext->GlContextDestroyed();
+
     std::replace( sceneContextContainer.begin(), sceneContextContainer.end(), oldSceneContext, newContext );
     return newContext;
   }
@@ -183,7 +188,7 @@ struct RenderManager::Impl
   // programs are owned by context at the moment.
   Context                                   context;                 ///< Holds the GL state of the share resource context
   Context*                                  currentContext;          ///< Holds the GL state of the current context for rendering
-  std::vector< Context* >                   sceneContextContainer;   ///< List of owned contexts holding the GL state per scene
+  OwnerContainer< Context* >                sceneContextContainer;   ///< List of owned contexts holding the GL state per scene
   Integration::GlAbstraction&               glAbstraction;           ///< GL abstraction
   Integration::GlSyncAbstraction&           glSyncAbstraction;       ///< GL sync abstraction
   Integration::GlContextHelperAbstraction&  glContextHelperAbstraction; ///< GL context helper abstraction
@@ -287,10 +292,10 @@ void RenderManager::ContextDestroyed()
     renderer->GlContextDestroyed();
   }
 
-  // inform scenes
-  for( auto&& scene : mImpl->sceneContainer )
+  // inform context
+  for( auto&& context : mImpl->sceneContextContainer )
   {
-    scene->GlContextDestroyed();
+    context->GlContextDestroyed();
   }
 }
 
@@ -618,12 +623,6 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector<Rect<int>>
     return;
   }
 
-  // @TODO We need to do partial rendering rotation.
-  if( mImpl->defaultSurfaceOrientation != 0 )
-  {
-    return;
-  }
-
   class DamagedRectsCleaner
   {
   public:
@@ -832,10 +831,7 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector<Rect<int>>
     i++;
   }
 
-  if( j != mImpl->itemsDirtyRects.begin() )
-  {
-    mImpl->itemsDirtyRects.resize(j - mImpl->itemsDirtyRects.begin());
-  }
+  mImpl->itemsDirtyRects.resize(j - mImpl->itemsDirtyRects.begin());
   damagedRectCleaner.SetCleanOnReturn(false);
 }
 
@@ -915,7 +911,8 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration:
       surfaceRect = Rect<int32_t>( 0, 0, static_cast<int32_t>( scene.GetSize().width ), static_cast<int32_t>( scene.GetSize().height ) );
     }
 
-    DALI_ASSERT_DEBUG( mImpl->currentContext->IsGlContextCreated() );
+    // Make sure that GL context must be created
+     mImpl->currentContext->GlContextCreated();
 
     // reset the program matrices for all programs once per frame
     // this ensures we will set view and projection matrix once per program per camera