X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fwindow-render-surface.cpp;h=c95d5082e5dafb13b2827cabdcd4f184c9c0e566;hb=8786ea8fbb26a9cb555a613518cf108017467c69;hp=9158f95b3a657aefeba1fd54a8575d6c843ad07e;hpb=e6c7c2471a83279af55133bc66f5977ec3530203;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/common/window-render-surface.cpp b/dali/internal/window-system/common/window-render-surface.cpp index 9158f95..c95d508 100644 --- a/dali/internal/window-system/common/window-render-surface.cpp +++ b/dali/internal/window-system/common/window-render-surface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -24,7 +24,7 @@ // INTERNAL INCLUDES #include -#include +#include #include #include #include @@ -85,11 +85,6 @@ WindowRenderSurface::~WindowRenderSurface() { delete mRotationTrigger; } - - if ( mEGLSurface ) - { - DestroySurface(); - } } void WindowRenderSurface::Initialize( Any surface ) @@ -115,7 +110,6 @@ void WindowRenderSurface::Initialize( Any surface ) if( mScreenRotationAngle != 0 ) { mScreenRotationFinished = false; - mResizeFinished = false; } } @@ -146,10 +140,15 @@ void WindowRenderSurface::SetTransparency( bool transparent ) void WindowRenderSurface::RequestRotation( int angle, int width, int height ) { + if( !mRotationSupported ) + { + DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: Rotation is not supported!\n" ); + return; + } + if( !mRotationTrigger ) { - TriggerEventFactoryInterface& triggerFactory = Internal::Adaptor::Adaptor::GetImplementation( Adaptor::Get() ).GetTriggerEventFactoryInterface(); - mRotationTrigger = triggerFactory.CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); + mRotationTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ); } mPositionSize.width = width; @@ -198,16 +197,12 @@ void WindowRenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpi dpiVertical = mDpiVertical; } -int WindowRenderSurface::GetOrientation() const -{ - return mWindowBase->GetOrientation(); -} - void WindowRenderSurface::InitializeGraphics() { - mGraphics = &mAdaptor->GetGraphicsInterface(); + DALI_ASSERT_ALWAYS( mGraphics && "Graphics interface is not created" ); + auto eglGraphics = static_cast(mGraphics); mEGL = &eglGraphics->GetEglInterface(); @@ -259,13 +254,21 @@ void WindowRenderSurface::DestroySurface() DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter ); auto eglGraphics = static_cast(mGraphics); + if( eglGraphics ) + { + DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() ); - DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() ); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); - Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); - eglImpl.DestroySurface( mEGLSurface ); + eglImpl.DestroySurface( mEGLSurface ); + mEGLSurface = nullptr; - mWindowBase->DestroyEglWindow(); + // Destroy context also + eglImpl.DestroyContext( mEGLContext ); + mEGLContext = nullptr; + + mWindowBase->DestroyEglWindow(); + } } bool WindowRenderSurface::ReplaceGraphicsSurface() @@ -355,11 +358,11 @@ bool WindowRenderSurface::PreRender( bool resizingSurface ) if( resizingSurface ) { - int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360; - // Window rotate or screen rotate if( !mRotationFinished || !mScreenRotationFinished ) { + int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360; + mWindowBase->SetEglWindowRotation( totalAngle ); mWindowBase->SetEglWindowBufferTransform( totalAngle ); @@ -376,23 +379,9 @@ bool WindowRenderSurface::PreRender( bool resizingSurface ) } // Resize case - if ( !mResizeFinished ) + if( !mResizeFinished ) { - Dali::PositionSize positionSize; - positionSize.x = mPositionSize.x; - positionSize.y = mPositionSize.y; - if( totalAngle == 0 || totalAngle == 180 ) - { - positionSize.width = mPositionSize.width; - positionSize.height = mPositionSize.height; - } - else - { - positionSize.width = mPositionSize.height; - positionSize.height = mPositionSize.width; - } - - mWindowBase->ResizeEglWindow( positionSize ); + mWindowBase->ResizeEglWindow( mPositionSize ); mResizeFinished = true; DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set resize\n" ); @@ -474,9 +463,9 @@ void WindowRenderSurface::ReleaseLock() // Nothing to do. } -Integration::RenderSurface::Type WindowRenderSurface::GetSurfaceType() +Dali::RenderSurfaceInterface::Type WindowRenderSurface::GetSurfaceType() { - return RenderSurface::WINDOW_RENDER_SURFACE; + return Dali::RenderSurfaceInterface::WINDOW_RENDER_SURFACE; } void WindowRenderSurface::MakeContextCurrent() @@ -505,7 +494,6 @@ void WindowRenderSurface::OutputTransformed() { mScreenRotationAngle = screenRotationAngle; mScreenRotationFinished = false; - mResizeFinished = false; mOutputTransformedSignal.Emit();