From 9b0f8e53996dedb9b712db1cc6502a205ff3d733 Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Wed, 9 Sep 2020 18:39:15 +0900 Subject: [PATCH] [Tizen] Apply screen rotation to create window Apply screen rotation to create window. Current solution is to use output transform event. It has one problem which the not rotated scene is shown when output transform event is received too late. To fix the problem, window(scene) should be create with screen rotation angle. Change-Id: If59d2d94f5a5b22d291354539804bd50a7b1ef42 --- .../adaptor-framework/scene-holder-impl.cpp | 3 +- .../window-system/common/window-render-surface.cpp | 32 +++++++++++++++++++--- .../window-system/common/window-render-surface.h | 1 + 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index 66da5db..09f8a2b 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -262,7 +262,8 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor) // Create the scene PositionSize surfacePositionSize = mSurface->GetPositionSize(); - mScene = Dali::Integration::Scene::New( Size(static_cast( surfacePositionSize.width ), static_cast( surfacePositionSize.height )) ); + int orientation = mSurface->GetOrientation(); + mScene = Dali::Integration::Scene::New( Size(static_cast( surfacePositionSize.width ), static_cast( surfacePositionSize.height )), orientation ); Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation( adaptor ); mAdaptor = &adaptorImpl; diff --git a/dali/internal/window-system/common/window-render-surface.cpp b/dali/internal/window-system/common/window-render-surface.cpp index 2ec42bf..9c65eb7 100644 --- a/dali/internal/window-system/common/window-render-surface.cpp +++ b/dali/internal/window-system/common/window-render-surface.cpp @@ -75,6 +75,7 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize, Any s mRotationFinished( true ), mScreenRotationFinished( true ), mResizeFinished( true ), + mDefaultScreenRotationAvailable( false ), mDpiHorizontal( 0 ), mDpiVertical( 0 ) { @@ -107,6 +108,16 @@ void WindowRenderSurface::Initialize( Any surface ) // Connect signals mWindowBase->OutputTransformedSignal().Connect( this, &WindowRenderSurface::OutputTransformed ); + + // Check screen rotation + mScreenRotationAngle = mWindowBase->GetScreenRotationAngle(); + if( mScreenRotationAngle != 0 ) + { + mScreenRotationFinished = false; + mResizeFinished = false; + mDefaultScreenRotationAvailable = true; + DALI_LOG_RELEASE_INFO("WindowRenderSurface::Initialize, screen rotation is enabled, screen rotation angle:[%d]\n", mScreenRotationAngle ); + } } Any WindowRenderSurface::GetNativeWindow() @@ -217,8 +228,20 @@ void WindowRenderSurface::CreateSurface() { DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter ); + int width, height; + if( mScreenRotationAngle == 0 || mScreenRotationAngle == 180 ) + { + width = mPositionSize.width; + height = mPositionSize.height; + } + else + { + width = mPositionSize.height; + height = mPositionSize.width; + } + // Create the EGL window - EGLNativeWindowType window = mWindowBase->CreateEglWindow( mPositionSize.width, mPositionSize.height ); + EGLNativeWindowType window = mWindowBase->CreateEglWindow( width, height ); auto eglGraphics = static_cast(mGraphics); @@ -405,7 +428,7 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vector(mGraphics); - if( resizingSurface ) + if( resizingSurface || mDefaultScreenRotationAvailable ) { int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360; @@ -418,7 +441,7 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vectorResizeEglWindow( positionSize ); mResizeFinished = true; - DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set resize\n" ); + DALI_LOG_RELEASE_INFO( "WindowRenderSurface::PreRender: Set resize\n" ); } if (eglGraphics) @@ -454,6 +477,7 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vectorGetEglImplementation(); eglImpl.SetFullSwapNextFrame(); } + mDefaultScreenRotationAvailable = false; } if (eglGraphics) diff --git a/dali/internal/window-system/common/window-render-surface.h b/dali/internal/window-system/common/window-render-surface.h index b1ef6d9..3a715862 100644 --- a/dali/internal/window-system/common/window-render-surface.h +++ b/dali/internal/window-system/common/window-render-surface.h @@ -299,6 +299,7 @@ private: // Data bool mRotationFinished; bool mScreenRotationFinished; bool mResizeFinished; + bool mDefaultScreenRotationAvailable; uint32_t mDpiHorizontal; uint32_t mDpiVertical; -- 2.7.4