X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-manager.cpp;h=431bd0ac4fbcb3f0b7b7aeda286728d3cfa1dfd4;hb=ac9e7e10baaadac207c0cb9221525fd49dbf5925;hp=a3e6db9bb3e9dda092604169bc96a9ef30e6ff3b;hpb=595e79c2bd7a25becdcfcce51b22e993083394cf;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index a3e6db9..431bd0a 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -91,7 +91,8 @@ struct RenderManager::Impl lastFrameWasRendered( false ), programController( glAbstraction ), depthBufferAvailable( depthBufferAvailableParam ), - stencilBufferAvailable( stencilBufferAvailableParam ) + stencilBufferAvailable( stencilBufferAvailableParam ), + defaultSurfaceOrientation( 0 ) { // Create thread pool with just one thread ( there may be a need to create more threads in the future ). threadPool = std::unique_ptr( new Dali::ThreadPool() ); @@ -174,6 +175,8 @@ struct RenderManager::Impl std::unique_ptr threadPool; ///< The thread pool Vector boundTextures; ///< The textures bound for rendering Vector 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,6 +262,11 @@ void RenderManager::SetDefaultSurfaceRect(const Rect& 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 @@ -605,6 +613,7 @@ void RenderManager::DoRender( RenderInstruction& instruction ) } Rect surfaceRect = mImpl->defaultSurfaceRect; + int surfaceOrientation = mImpl->defaultSurfaceOrientation; Vector4 backgroundColor = mImpl->backgroundColor; Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable; Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable; @@ -721,7 +730,7 @@ void RenderManager::DoRender( RenderInstruction& instruction ) // For glViewport the lower-left corner is (0,0) // For glViewport the lower-left corner is (0,0) const int32_t y = ( surfaceRect.height - instruction.mViewport.height ) - instruction.mViewport.y; - viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height ); + viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height ); } else { @@ -740,6 +749,7 @@ void RenderManager::DoRender( RenderInstruction& instruction ) { viewportRect.Set( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() ); } + surfaceOrientation = 0; } } else // No Offscreen frame buffer rendering @@ -751,7 +761,7 @@ void RenderManager::DoRender( RenderInstruction& instruction ) { // For glViewport the lower-left corner is (0,0) const int32_t y = ( instruction.mFrameBuffer->GetHeight() - instruction.mViewport.height ) - instruction.mViewport.y; - viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height ); + viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height ); } else { @@ -764,6 +774,13 @@ void RenderManager::DoRender( RenderInstruction& instruction ) } } + if ( surfaceOrientation == 90 || surfaceOrientation == 270 ) + { + int temp = viewportRect.width; + viewportRect.width = viewportRect.height; + viewportRect.height = temp; + } + mImpl->currentContext->Viewport(viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height); if ( instruction.mIsClearColorSet ) @@ -790,7 +807,8 @@ void RenderManager::DoRender( RenderInstruction& instruction ) mImpl->renderBufferIndex, depthBufferAvailable, stencilBufferAvailable, - mImpl->boundTextures ); + mImpl->boundTextures, + surfaceOrientation ); // Synchronise the FBO/Texture access when there are multiple contexts if ( mImpl->currentContext->IsSurfacelessContextSupported() )