From f5db0fa9148636cc65f53c322ddefc1b1a6a02d3 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Wed, 11 Jul 2018 10:11:52 +0900 Subject: [PATCH] [4.0] Supports screen rotation. If the screen rotates, we need to change egl size and the buffer needs to be rotated. So we need the orientation value in SurfaceResized. SurfaceResized() API overloaded. Change-Id: Idc8fb091fe7080d118d1b69a3bf229931f6c3b0e --- adaptors/common/adaptor-impl.cpp | 8 +++++++ adaptors/common/adaptor-impl.h | 5 ++++ adaptors/ecore/wayland/window-impl-ecore-wl.cpp | 8 +++---- .../wayland/window-render-surface-ecore-wl.cpp | 27 ++++++++++++---------- adaptors/ecore/wayland/window-render-surface.h | 2 +- 5 files changed, 33 insertions(+), 17 deletions(-) mode change 100644 => 100755 adaptors/common/adaptor-impl.cpp mode change 100644 => 100755 adaptors/common/adaptor-impl.h mode change 100644 => 100755 adaptors/ecore/wayland/window-impl-ecore-wl.cpp mode change 100644 => 100755 adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp mode change 100644 => 100755 adaptors/ecore/wayland/window-render-surface.h diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp old mode 100644 new mode 100755 index 3c03707..67e759f --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -777,6 +777,14 @@ void Adaptor::OnDamaged( const DamageArea& area ) RequestUpdate( false ); } +void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize, int orientation ) +{ + // let the core know the surface size and orientation has changed + mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight(), orientation ); + + mResizedSignal.Emit( mAdaptor ); +} + void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize ) { // let the core know the surface size has changed diff --git a/adaptors/common/adaptor-impl.h b/adaptors/common/adaptor-impl.h old mode 100644 new mode 100755 index 31c577b..ae27285 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -339,6 +339,11 @@ public: void GetAppId( std::string& appId ); /** + * Informs core the surface size and orientation has changed + */ + void SurfaceResizePrepare( SurfaceSize surfaceSize, int orientation ); + + /** * Informs core the surface size has changed */ void SurfaceResizePrepare( SurfaceSize surfaceSize ); diff --git a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp old mode 100644 new mode 100755 index 97ee23e..8437a6b --- a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp @@ -227,10 +227,10 @@ struct Window::EventHandler ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) ); if( wlSurface ) { - wlSurface->OutputTransformed(); + int orientation = wlSurface->OutputTransformed(); PositionSize positionSize = wlSurface->GetPositionSize(); - handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) ); + handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), orientation ); handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) ); } } @@ -251,10 +251,10 @@ struct Window::EventHandler ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) ); if( wlSurface ) { - wlSurface->OutputTransformed(); + int orientation = wlSurface->OutputTransformed(); PositionSize positionSize = wlSurface->GetPositionSize(); - handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) ); + handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ), orientation ); handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) ); } } diff --git a/adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp b/adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp old mode 100644 new mode 100755 index d8b9be5..95cfb08 --- a/adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp @@ -128,23 +128,19 @@ void WindowRenderSurface::RequestRotation( int angle, int width, int height ) DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle ); } -void WindowRenderSurface::OutputTransformed() +int WindowRenderSurface::OutputTransformed() { int transform; - if( ecore_wl_window_ignore_output_transform_get( mWlWindow ) ) - { - transform = 0; - } - else + if( !ecore_wl_window_ignore_output_transform_get( mWlWindow ) ) { transform = ecore_wl_output_transform_get( ecore_wl_window_output_find( mWlWindow ) ); + mScreenRotationAngle = transform * 90; + mScreenRotationFinished = false; + mResizeFinished = false; } - - mScreenRotationAngle = transform * 90; - mScreenRotationFinished = false; - DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OutputTransformed: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle ); + return (mRotationAngle + mScreenRotationAngle) % 360; } void WindowRenderSurface::SetTransparency( bool transparent ) @@ -279,13 +275,13 @@ bool WindowRenderSurface::PreRender( EglInterface& egl, Integration::GlAbstracti { if( resizingSurface ) { + int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360; #ifdef OVER_TIZEN_VERSION_4 // Window rotate or screen rotate if( !mRotationFinished || !mScreenRotationFinished ) { wl_egl_window_rotation rotation; wl_output_transform bufferTransform; - int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360; switch( totalAngle ) { @@ -372,7 +368,14 @@ bool WindowRenderSurface::PreRender( EglInterface& egl, Integration::GlAbstracti // Resize case if( !mResizeFinished ) { - wl_egl_window_resize( mEglWindow, mPositionSize.width, mPositionSize.height, mPositionSize.x, mPositionSize.y ); + if( totalAngle == 0 || totalAngle == 180 ) + { + wl_egl_window_resize( mEglWindow, mPositionSize.width, mPositionSize.height, mPositionSize.x, mPositionSize.y ); + } + else + { + wl_egl_window_resize( mEglWindow, mPositionSize.height, mPositionSize.width, mPositionSize.x, mPositionSize.y ); + } mResizeFinished = true; DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set resize\n" ); diff --git a/adaptors/ecore/wayland/window-render-surface.h b/adaptors/ecore/wayland/window-render-surface.h old mode 100644 new mode 100755 index 969141b..90eadeb --- a/adaptors/ecore/wayland/window-render-surface.h +++ b/adaptors/ecore/wayland/window-render-surface.h @@ -89,7 +89,7 @@ public: // API /** * Notify output is transformed. */ - void OutputTransformed(); + int OutputTransformed(); /** * @brief Sets whether the surface is transparent or not. -- 2.7.4