From 8864d4473ca860d346abef04452b6fd8fbe39e2a Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Tue, 10 Nov 2020 15:40:03 +0900 Subject: [PATCH] [Tizen] Apply screen rotation to create window This reverts commit 7818fc608d74c23232872567f0076045cde4973a. --- .../adaptor-framework/scene-holder-impl.cpp | 3 +- .../window-system/common/window-render-surface.cpp | 34 ++++++++++++++++++---- .../window-system/common/window-render-surface.h | 1 + 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index e2027ea..ea8a58a 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -243,7 +243,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 8a066b0..b608a27 100644 --- a/dali/internal/window-system/common/window-render-surface.cpp +++ b/dali/internal/window-system/common/window-render-surface.cpp @@ -108,7 +108,8 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize, Any s mRotationSupported( false ), mRotationFinished( true ), mScreenRotationFinished( true ), - mResizeFinished( true ) + mResizeFinished( true ), + mDefaultScreenRotationAvailable( false ) { DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" ); Initialize( surface ); @@ -139,6 +140,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() @@ -249,8 +260,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); @@ -435,7 +458,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" ); } SetFullSwapNextFrame(); + mDefaultScreenRotationAvailable = false; } SetBufferDamagedRects( damagedRects, clippingRect ); diff --git a/dali/internal/window-system/common/window-render-surface.h b/dali/internal/window-system/common/window-render-surface.h index c00395f..373e1316 100644 --- a/dali/internal/window-system/common/window-render-surface.h +++ b/dali/internal/window-system/common/window-render-surface.h @@ -316,6 +316,7 @@ private: // Data bool mRotationFinished; bool mScreenRotationFinished; bool mResizeFinished; + bool mDefaultScreenRotationAvailable; }; // class WindowRenderSurface -- 2.7.4