[Tizen] Add screen and client rotation itself function
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-algorithms.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 27e8347..406f216
@@ -449,6 +449,7 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList,
   if (!rootClippingRect.IsEmpty())
   {
     context.SetScissorTest( true );
+    context.Scissor( rootClippingRect.x, rootClippingRect.y, rootClippingRect.width, rootClippingRect.height );
     mScissorStack.push_back( rootClippingRect );
   }
   // We are not performing a layer clip and no clipping rect set. Add the viewport as the root scissor rectangle.
@@ -496,6 +497,23 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList,
   for( uint32_t index = 0u; index < count; ++index )
   {
     const RenderItem& item = renderList.GetItem( index );
+
+    // Discard renderers outside the root clipping rect
+    bool skip = true;
+    if( !rootClippingRect.IsEmpty() )
+    {
+      auto rect = item.CalculateViewportSpaceAABB( item.mUpdateSize, mViewportRectangle.width, mViewportRectangle.height );
+
+      if(rect.Intersect( rootClippingRect ))
+      {
+        skip = false;
+      }
+    }
+    else
+    {
+      skip = false;
+    }
+
     DALI_PRINT_RENDER_ITEM( item );
 
     // Set up clipping based on both the Renderer and Actor APIs.
@@ -509,14 +527,26 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList,
       // draw-mode state, such as Overlays.
       // If the flags are set to "AUTO", the behavior then depends on the type of renderer. Overlay Renderers will always
       // disable depth testing and writing. Color Renderers will enable them if the Layer does.
-      if( depthBufferAvailable == Integration::DepthBufferAvailable::TRUE )
+      if (depthBufferAvailable == Integration::DepthBufferAvailable::TRUE)
       {
-        SetupDepthBuffer( item, context, autoDepthTestMode, firstDepthBufferUse );
+        SetupDepthBuffer(item, context, autoDepthTestMode, firstDepthBufferUse);
       }
 
-      // Render the item.
-      item.mRenderer->Render( context, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix,
-                              viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque, boundTextures, instruction ); // Added instruction for reflection effect
+      // Depending on whether the renderer has draw commands attached or not the rendering process will
+      // iterate through all the render queues. If there are no draw commands attached, only one
+      // iteration must be done and the default behaviour of the renderer will be executed.
+      // The queues allow to iterate over the same renderer multiple times changing the state of the renderer.
+      // It is similar to the multi-pass rendering.
+      if( !skip )
+      {
+        auto const MAX_QUEUE = item.mRenderer->GetDrawCommands().empty() ? 1 : DevelRenderer::RENDER_QUEUE_MAX;
+        for (auto queue = 0u; queue < MAX_QUEUE; ++queue)
+        {
+          // Render the item.
+          item.mRenderer->Render(context, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix,
+                                 viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque, boundTextures, instruction, queue);
+        }
+      }
     }
   }
 }