Fix the screen rotation issue 64/286264/1
authorWonsik Jung <sidein@samsung.com>
Tue, 3 Jan 2023 03:11:42 +0000 (12:11 +0900)
committerWonsik Jung <sidein@samsung.com>
Tue, 3 Jan 2023 03:11:42 +0000 (12:11 +0900)
Fix the screen rotation issue in FHub Device.
When glViewport/glScissor is set, the screen rotation should be considered.

Change-Id: I34b3c07f4efd678806d05c9b651ad44a05269909

dali/internal/window-system/common/window-render-surface.cpp

index 2e23548..bfc4462 100644 (file)
@@ -580,7 +580,12 @@ bool WindowRenderSurface::PreRender(bool resizingSurface, const std::vector<Rect
     Rect<int> surfaceRect = scene.GetCurrentSurfaceRect();
     if(clippingRect == surfaceRect)
     {
-      mDamagedRects.assign(1, RecalculateRect[std::min(scene.GetCurrentSurfaceOrientation() / 90, 3)](surfaceRect, surfaceRect));
+      int32_t totalAngle = scene.GetCurrentSurfaceOrientation() + scene.GetCurrentScreenOrientation();
+      if(totalAngle >= 360)
+      {
+        totalAngle -= 360;
+      }
+      mDamagedRects.assign(1, RecalculateRect[std::min(totalAngle / 90, 3)](surfaceRect, surfaceRect));
     }
   }
 
@@ -805,7 +810,12 @@ void WindowRenderSurface::SetBufferDamagedRects(const std::vector<Rect<int>>& da
     if(scene)
     {
       surfaceRect = scene.GetCurrentSurfaceRect();
-      orientation = std::min(scene.GetCurrentSurfaceOrientation() / 90, 3);
+      int32_t totalAngle = scene.GetCurrentSurfaceOrientation() + scene.GetCurrentScreenOrientation();
+      if(totalAngle >= 360)
+      {
+        totalAngle -= 360;
+      }
+      orientation = std::min(totalAngle / 90, 3);
     }
 
     Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();