Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-render-surface.cpp
index 8a066b0..021843e 100644 (file)
@@ -139,6 +139,13 @@ void WindowRenderSurface::Initialize( Any surface )
 
   // Connect signals
   mWindowBase->OutputTransformedSignal().Connect( this, &WindowRenderSurface::OutputTransformed );
+
+  // Check screen rotation
+  mScreenRotationAngle = mWindowBase->GetScreenRotationAngle();
+  if( mScreenRotationAngle != 0 )
+  {
+    mScreenRotationFinished = false;
+  }
 }
 
 Any WindowRenderSurface::GetNativeWindow()
@@ -168,6 +175,12 @@ 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 )
   {
     mRotationTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
@@ -219,11 +232,6 @@ void WindowRenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpi
   dpiVertical = mDpiVertical;
 }
 
-int WindowRenderSurface::GetOrientation() const
-{
-  return mWindowBase->GetOrientation();
-}
-
 void WindowRenderSurface::InitializeGraphics()
 {
   mGraphics = &mAdaptor->GetGraphicsInterface();
@@ -249,8 +257,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<EglGraphics *>(mGraphics);
 
@@ -437,11 +457,11 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vector<Rec
 
   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 );
 
@@ -458,22 +478,9 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vector<Rec
     }
 
     // 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" );
@@ -582,15 +589,14 @@ void WindowRenderSurface::OutputTransformed()
   {
     mScreenRotationAngle = screenRotationAngle;
     mScreenRotationFinished = false;
-    mResizeFinished = false;
 
     mOutputTransformedSignal.Emit();
 
-    DALI_LOG_RELEASE_INFO( "WindowRenderSurface::OutputTransformed: window = %d screen = %d\n", mRotationAngle, mScreenRotationAngle );
+    DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OutputTransformed: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
   }
   else
   {
-    DALI_LOG_RELEASE_INFO( "WindowRenderSurface::OutputTransformed: Ignore output transform [%d]\n", mScreenRotationAngle );
+    DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OutputTransformed: Ignore output transform [%d]\n", mScreenRotationAngle );
   }
 }