[4.0] Supports screen rotation. 69/183769/9
authorJoogab Yun <joogab.yun@samsung.com>
Wed, 11 Jul 2018 01:11:52 +0000 (10:11 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Thu, 2 Aug 2018 01:03:57 +0000 (01:03 +0000)
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 [changed mode: 0644->0755]
adaptors/common/adaptor-impl.h [changed mode: 0644->0755]
adaptors/ecore/wayland/window-impl-ecore-wl.cpp [changed mode: 0644->0755]
adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp [changed mode: 0644->0755]
adaptors/ecore/wayland/window-render-surface.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 3c03707..67e759f
@@ -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
old mode 100644 (file)
new mode 100755 (executable)
index 31c577b..ae27285
@@ -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 );
old mode 100644 (file)
new mode 100755 (executable)
index 97ee23e..8437a6b
@@ -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 ) );
       }
     }
old mode 100644 (file)
new mode 100755 (executable)
index d8b9be5..95cfb08
@@ -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" );
old mode 100644 (file)
new mode 100755 (executable)
index 969141b..90eadeb
@@ -89,7 +89,7 @@ public: // API
   /**
    * Notify output is transformed.
    */
-  void OutputTransformed();
+  int OutputTransformed();
 
   /**
    * @brief Sets whether the surface is transparent or not.