[Tizen] Make possible to capture on the old driver devices.
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-manager.cpp
index f160f41..2e4ad8f 100755 (executable)
@@ -77,8 +77,7 @@ struct RenderManager::Impl
     programController( glAbstraction ),
     depthBufferAvailable( depthBufferAvailableParam ),
     stencilBufferAvailable( stencilBufferAvailableParam ),
-    partialUpdateAvailable( partialUpdateAvailableParam ),
-    defaultSurfaceOrientation( 0 )
+    partialUpdateAvailable( partialUpdateAvailableParam )
   {
      // Create thread pool with just one thread ( there may be a need to create more threads in the future ).
     threadPool = std::unique_ptr<Dali::ThreadPool>( new Dali::ThreadPool() );
@@ -175,7 +174,6 @@ struct RenderManager::Impl
   std::unique_ptr<Dali::ThreadPool>         threadPool;               ///< The thread pool
   Vector<GLuint>                            boundTextures;            ///< The textures bound for rendering
   Vector<GLuint>                            textureDependencyList;    ///< The dependency list of binded textures
-  int                                       defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to
 };
 
 RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction,
@@ -259,11 +257,6 @@ void RenderManager::SetDefaultSurfaceRect(const Rect<int32_t>& rect)
   mImpl->defaultSurfaceRect = rect;
 }
 
-void RenderManager::SetDefaultSurfaceOrientation( int orientation )
-{
-  mImpl->defaultSurfaceOrientation = orientation;
-}
-
 void RenderManager::AddRenderer( OwnerPointer< Render::Renderer >& renderer )
 {
   // Initialize the renderer as we are now in render thread
@@ -393,6 +386,11 @@ void RenderManager::AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer*
   frameBuffer->AttachDepthStencilTexture( mImpl->context, texture, mipmapLevel );
 }
 
+void RenderManager::CaptureRenderingResult(Render::FrameBuffer* frameBuffer)
+{
+  frameBuffer->CaptureRenderingResult();
+}
+
 void RenderManager::AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& vertexBuffer )
 {
   mImpl->vertexBufferContainer.PushBack( vertexBuffer.Release() );
@@ -573,8 +571,11 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector<Rect<int>>
     return;
   }
 
+  Internal::Scene& sceneInternal = GetImplementation(scene);
+  SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject();
+
   // @TODO We need to do partial rendering rotation.
-  if( mImpl->defaultSurfaceOrientation != 0 )
+  if( sceneObject && sceneObject->GetSurfaceOrientation() != 0 )
   {
     return;
   }
@@ -611,11 +612,6 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector<Rect<int>>
   // Clean collected dirty/damaged rects on exit if 3d layer or 3d node or other conditions.
   DamagedRectsCleaner damagedRectCleaner(damagedRects);
 
-
-
-  Internal::Scene& sceneInternal = GetImplementation(scene);
-  SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject();
-
   // Mark previous dirty rects in the sorted array. The array is already sorted by node and renderer, frame number.
   // so you don't need to sort: std::stable_sort(itemsDirtyRects.begin(), itemsDirtyRects.end());
   std::vector<DirtyRect>& itemsDirtyRects = sceneInternal.GetItemsDirtyRects();
@@ -835,7 +831,7 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration:
     Rect<int32_t> surfaceRect = mImpl->defaultSurfaceRect;
     Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable;
     Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable;
-    int surfaceOrientation = mImpl->defaultSurfaceOrientation;
+    int surfaceOrientation = sceneObject->GetSurfaceOrientation();
 
     if ( instruction.mFrameBuffer )
     {
@@ -1097,6 +1093,7 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration:
     if ( renderToFbo )
     {
       mImpl->currentContext->Flush();
+      instruction.mFrameBuffer->DrawRenderedBuffer(*mImpl->currentContext);
     }
   }