X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-algorithms.cpp;h=610496d8294d09e142d520125fb6920ce72bceea;hb=b43741a90b40ca9dfbd33d6a9d390d3c09230e89;hp=ec47b655035ea22b26e1ff64c3d750a7ab95d55d;hpb=9004b94c9163f65f911660c02acbfe97c37ec37e;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 ec47b65..610496d --- a/dali/internal/render/common/render-algorithms.cpp +++ b/dali/internal/render/common/render-algorithms.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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 ) { @@ -389,7 +413,10 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, const Matrix& viewMatrix, const Matrix& projectionMatrix, Integration::DepthBufferAvailable depthBufferAvailable, - Integration::StencilBufferAvailable stencilBufferAvailable ) + Integration::StencilBufferAvailable stencilBufferAvailable, + Vector& boundTextures, + int orientation, + Dali::ClippingBox& scissorBox ) { DALI_PRINT_RENDER_LIST( renderList ); @@ -406,16 +433,54 @@ 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(); if( renderList.IsClipping() ) { 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; } + else if ( !scissorBox.IsEmpty() ) + { + context.SetScissorTest( true ); + context.Scissor( scissorBox.x, scissorBox.y, scissorBox.width, scissorBox.height ); + mScissorStack.push_back( scissorBox ); + } else { // We are not performing a layer clip. Add the viewport as the root scissor rectangle. @@ -424,14 +489,14 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, } // Loop through all RenderList in the RenderList, set up any prerequisites to render them, then perform the render. - for( size_t index( 0u ); index < count; ++index ) + for( uint32_t index = 0u; index < count; ++index ) { const RenderItem& item = renderList.GetItem( index ); 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 ) ) { @@ -447,7 +512,7 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, // Render the item. item.mRenderer->Render( context, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, - viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque ); + viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque, boundTextures ); } } } @@ -462,7 +527,10 @@ void RenderAlgorithms::ProcessRenderInstruction( const RenderInstruction& instru Context& context, BufferIndex bufferIndex, Integration::DepthBufferAvailable depthBufferAvailable, - Integration::StencilBufferAvailable stencilBufferAvailable ) + Integration::StencilBufferAvailable stencilBufferAvailable, + Vector& boundTextures, + int orientation, + Dali::ClippingBox& scissorBox ) { DALI_PRINT_RENDER_INSTRUCTION( instruction, bufferIndex ); @@ -490,7 +558,10 @@ void RenderAlgorithms::ProcessRenderInstruction( const RenderInstruction& instru *viewMatrix, *projectionMatrix, depthBufferAvailable, - stencilBufferAvailable ); + stencilBufferAvailable, + boundTextures, + orientation, + scissorBox ); } } }