[Tizen] Apply screen rotation to create window accepted/tizen/6.0/unified/20201111.064920 accepted/tizen/unified/20201110.230611 submit/tizen/20201110.094917 submit/tizen_6.0/20201110.110443 submit/tizen_6.0/20201110.230218 submit/tizen_6.0/20201110.230946
authorWonsik Jung <sidein@samsung.com>
Tue, 10 Nov 2020 06:40:03 +0000 (15:40 +0900)
committerWonsik Jung <sidein@samsung.com>
Tue, 10 Nov 2020 06:40:08 +0000 (15:40 +0900)
This reverts commit 7818fc608d74c23232872567f0076045cde4973a.

dali/integration-api/adaptor-framework/scene-holder-impl.cpp
dali/internal/window-system/common/window-render-surface.cpp
dali/internal/window-system/common/window-render-surface.h

index e2027ea..ea8a58a 100644 (file)
@@ -243,7 +243,8 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor)
 
   // Create the scene
   PositionSize surfacePositionSize = mSurface->GetPositionSize();
 
   // Create the scene
   PositionSize surfacePositionSize = mSurface->GetPositionSize();
-  mScene                           = Dali::Integration::Scene::New(Size(static_cast<float>(surfacePositionSize.width), static_cast<float>(surfacePositionSize.height)));
+  int orientation = mSurface->GetOrientation();
+  mScene = Dali::Integration::Scene::New( Size(static_cast<float>( surfacePositionSize.width ), static_cast<float>( surfacePositionSize.height )), orientation );
 
   Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
   mAdaptor                                = &adaptorImpl;
 
   Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
   mAdaptor                                = &adaptorImpl;
index 8a066b0..b608a27 100644 (file)
@@ -108,7 +108,8 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize, Any s
   mRotationSupported( false ),
   mRotationFinished( true ),
   mScreenRotationFinished( true ),
   mRotationSupported( false ),
   mRotationFinished( true ),
   mScreenRotationFinished( true ),
-  mResizeFinished( true )
+  mResizeFinished( true ),
+  mDefaultScreenRotationAvailable( false )
 {
   DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
   Initialize( surface );
 {
   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 );
 
   // 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()
 }
 
 Any WindowRenderSurface::GetNativeWindow()
@@ -249,8 +260,20 @@ void WindowRenderSurface::CreateSurface()
 {
   DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
 {
   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
   // Create the EGL window
-  EGLNativeWindowType window = mWindowBase->CreateEglWindow( mPositionSize.width, mPositionSize.height );
+  EGLNativeWindowType window = mWindowBase->CreateEglWindow( width, height );
 
   auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
 
 
   auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
 
@@ -435,7 +458,7 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vector<Rec
 
   MakeContextCurrent();
 
 
   MakeContextCurrent();
 
-  if( resizingSurface )
+  if( resizingSurface || mDefaultScreenRotationAvailable )
   {
     int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360;
 
   {
     int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360;
 
@@ -448,7 +471,7 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vector<Rec
       // Reset only screen rotation flag
       mScreenRotationFinished = true;
 
       // Reset only screen rotation flag
       mScreenRotationFinished = true;
 
-      DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set rotation [%d] [%d]\n", mRotationAngle, mScreenRotationAngle );
+      DALI_LOG_RELEASE_INFO( "WindowRenderSurface::PreRender: Set rotation [%d] [%d]\n", mRotationAngle, mScreenRotationAngle );
     }
 
     // Only window rotate
     }
 
     // Only window rotate
@@ -476,10 +499,11 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vector<Rec
       mWindowBase->ResizeEglWindow( positionSize );
       mResizeFinished = true;
 
       mWindowBase->ResizeEglWindow( positionSize );
       mResizeFinished = true;
 
-      DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set resize\n" );
+      DALI_LOG_RELEASE_INFO( "WindowRenderSurface::PreRender: Set resize\n" );
     }
 
     SetFullSwapNextFrame();
     }
 
     SetFullSwapNextFrame();
+    mDefaultScreenRotationAvailable = false;
   }
 
   SetBufferDamagedRects( damagedRects, clippingRect );
   }
 
   SetBufferDamagedRects( damagedRects, clippingRect );
index c00395f..373e131 100644 (file)
@@ -316,6 +316,7 @@ private: // Data
   bool                            mRotationFinished;
   bool                            mScreenRotationFinished;
   bool                            mResizeFinished;
   bool                            mRotationFinished;
   bool                            mScreenRotationFinished;
   bool                            mResizeFinished;
+  bool                            mDefaultScreenRotationAvailable;
 
 }; // class WindowRenderSurface
 
 
 }; // class WindowRenderSurface