X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-algorithms.cpp;h=406f21655e6c98aeaf4682fc85e238647953e08f;hb=8f612650d20752ab6aba022a9dbefdb883968e8f;hp=744ae86e7cfdfb66ac3f935853a2c557c3d98521;hpb=1274a4effde4edddb64bad0a25c5cc14a7bd1eaa;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/common/render-algorithms.cpp b/dali/internal/render/common/render-algorithms.cpp old mode 100644 new mode 100755 index 744ae86..406f216 --- a/dali/internal/render/common/render-algorithms.cpp +++ b/dali/internal/render/common/render-algorithms.cpp @@ -231,7 +231,7 @@ inline void SetupDepthBuffer( const RenderItem& item, Context& context, bool dep * @param[in] item The current RenderItem about to be rendered * @param[in] context The context */ -inline void RenderAlgorithms::SetupScissorClipping( const RenderItem& item, Context& context ) +inline void RenderAlgorithms::SetupScissorClipping( const RenderItem& item, Context& context, int orientation ) { // Get the number of child scissors in the stack (do not include layer or root box). size_t childStackDepth = mScissorStack.size() - 1u; @@ -292,7 +292,30 @@ inline void RenderAlgorithms::SetupScissorClipping( const RenderItem& item, Cont if( scissorEnabled ) { ClippingBox useScissorBox( mScissorStack.back() ); - context.Scissor( useScissorBox.x, useScissorBox.y, useScissorBox.width, useScissorBox.height ); + GLint x = useScissorBox.x; + GLint y = useScissorBox.y; + if( orientation == 90 ) + { + x = mViewportRectangle.height - (useScissorBox.y + useScissorBox.height); + y = useScissorBox.x; + context.Scissor( x, y, useScissorBox.height, useScissorBox.width ); + } + else if( orientation == 180 ) + { + x = mViewportRectangle.width - (useScissorBox.x + useScissorBox.width); + y = mViewportRectangle.height - (useScissorBox.y + useScissorBox.height); + context.Scissor( x, y, useScissorBox.width, useScissorBox.height ); + } + else if( orientation == 270 ) + { + x = useScissorBox.y; + y = mViewportRectangle.width - (useScissorBox.x + useScissorBox.width); + context.Scissor( x, y, useScissorBox.height, useScissorBox.width ); + } + else + { + context.Scissor( x, y, useScissorBox.width, useScissorBox.height ); + } } } } @@ -302,7 +325,8 @@ inline void RenderAlgorithms::SetupClipping( const RenderItem& item, bool& usedStencilBuffer, uint32_t& lastClippingDepth, uint32_t& lastClippingId, - Integration::StencilBufferAvailable stencilBufferAvailable ) + Integration::StencilBufferAvailable stencilBufferAvailable, + int orientation ) { RenderMode::Type renderMode = RenderMode::AUTO; const Renderer *renderer = item.mRenderer; @@ -324,7 +348,7 @@ inline void RenderAlgorithms::SetupClipping( const RenderItem& item, // As both scissor and stencil clips can be nested, we may be simultaneously traversing up the scissor tree, requiring a scissor to be un-done. Whilst simultaneously adding a new stencil clip. // We process both based on our current and old clipping depths for each mode. // Both methods with return rapidly if there is nothing to be done for that type of clipping. - SetupScissorClipping( item, context ); + SetupScissorClipping( item, context, orientation ); if( stencilBufferAvailable == Integration::StencilBufferAvailable::TRUE ) { @@ -392,8 +416,8 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, Integration::StencilBufferAvailable stencilBufferAvailable, Vector& boundTextures, const RenderInstruction& instruction, - const Rect& rootClippingRect - ) + const Rect& rootClippingRect, + int orientation ) { DALI_PRINT_RENDER_LIST( renderList ); @@ -410,6 +434,13 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, mViewportRectangle = context.GetViewport(); mHasLayerScissor = false; + if( orientation == 90 || orientation == 270 ) + { + int temp = mViewportRectangle.width; + mViewportRectangle.width = mViewportRectangle.height; + mViewportRectangle.height = temp; + } + // Setup Scissor testing (for both viewport and per-node scissor) mScissorStack.clear(); @@ -418,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. @@ -431,7 +463,32 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, { context.SetScissorTest( true ); const ClippingBox& layerScissorBox = renderList.GetClippingBox(); - context.Scissor( layerScissorBox.x, layerScissorBox.y, layerScissorBox.width, layerScissorBox.height ); + GLint x = layerScissorBox.x; + GLint y = layerScissorBox.y; + + if( orientation == 90 ) + { + x = mViewportRectangle.height - (layerScissorBox.y + layerScissorBox.height); + y = layerScissorBox.x; + context.Scissor( x, y, layerScissorBox.height, layerScissorBox.width ); + } + else if( orientation == 180 ) + { + x = mViewportRectangle.width - (layerScissorBox.x + layerScissorBox.width); + y = mViewportRectangle.height - (layerScissorBox.y + layerScissorBox.height); + context.Scissor( x, y, layerScissorBox.width, layerScissorBox.height ); + } + else if( orientation == 270 ) + { + x = layerScissorBox.y; + y = mViewportRectangle.width - (layerScissorBox.x + layerScissorBox.width); + context.Scissor( x, y, layerScissorBox.height, layerScissorBox.width ); + } + else + { + context.Scissor( x, y, layerScissorBox.width, layerScissorBox.height ); + } + mScissorStack.push_back( layerScissorBox ); mHasLayerScissor = true; } @@ -441,11 +498,27 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, { 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. // The Renderer API will be used if specified. If AUTO, the Actors automatic clipping feature will be used. - SetupClipping( item, context, usedStencilBuffer, lastClippingDepth, lastClippingId, stencilBufferAvailable ); + SetupClipping( item, context, usedStencilBuffer, lastClippingDepth, lastClippingId, stencilBufferAvailable, orientation ); if( DALI_LIKELY( item.mRenderer ) ) { @@ -454,9 +527,9 @@ 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); } // Depending on whether the renderer has draw commands attached or not the rendering process will @@ -464,12 +537,15 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, // 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. - auto const MAX_QUEUE = item.mRenderer->GetDrawCommands().empty() ? 1 : DevelRenderer::RENDER_QUEUE_MAX; - for( auto queue = 0u; queue < MAX_QUEUE; ++queue ) + if( !skip ) { - // Render the item. - item.mRenderer->Render(context, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, - viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque, boundTextures, instruction, queue); + 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); + } } } } @@ -487,7 +563,8 @@ void RenderAlgorithms::ProcessRenderInstruction( const RenderInstruction& instru Integration::DepthBufferAvailable depthBufferAvailable, Integration::StencilBufferAvailable stencilBufferAvailable, Vector& boundTextures, - const Rect& rootClippingRect ) + const Rect& rootClippingRect, + int orientation ) { DALI_PRINT_RENDER_INSTRUCTION( instruction, bufferIndex ); @@ -518,7 +595,8 @@ void RenderAlgorithms::ProcessRenderInstruction( const RenderInstruction& instru stencilBufferAvailable, boundTextures, instruction, //added for reflection effect - rootClippingRect ); + rootClippingRect, + orientation ); } } }