(Partial update) Fix clipping area issue during window rotation 68/266768/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 18 Nov 2021 10:07:53 +0000 (19:07 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 19 Nov 2021 06:31:41 +0000 (15:31 +0900)
When window rotation events come from ecore, the result will be stored
at mPositionSize, and send event message to render thread.

But when the event is not comes to render thread,
the window's size value (mPositionSize) and
the scene's size value (scene.GetCurrentSurfaceRect()) mismatched
So the clippingRect will calculate wrong value.

This patch make clipping area always use current scene surface

Change-Id: Id70fd2819b84314db5ef441512a7e042da1b1c81
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/window-system/common/window-render-surface.cpp

index 8e3c997..6c714a8 100644 (file)
@@ -555,16 +555,19 @@ bool WindowRenderSurface::PreRender(bool resizingSurface, const std::vector<Rect
 
   SetBufferDamagedRects(mDamagedRects, clippingRect);
 
-  Rect<int> surfaceRect(0, 0, mPositionSize.width, mPositionSize.height);
-  if(clippingRect == surfaceRect)
-  {
-    mDamagedRects.assign(1, surfaceRect);
-  }
-  else if(mDamagedRects.empty() && !clippingRect.IsEmpty())
+  if(scene)
   {
-    // We will render clippingRect area but mDamagedRects is empty.
-    // So make mDamagedRects same with clippingRect to swap buffers.
-    mDamagedRects.assign(1, clippingRect);
+    Rect<int> surfaceRect = scene.GetCurrentSurfaceRect();
+    if(clippingRect == surfaceRect)
+    {
+      mDamagedRects.assign(1, surfaceRect);
+    }
+    else if(mDamagedRects.empty() && !clippingRect.IsEmpty())
+    {
+      // We will render clippingRect area but mDamagedRects is empty.
+      // So make mDamagedRects same with clippingRect to swap buffers.
+      mDamagedRects.assign(1, clippingRect);
+    }
   }
 
   // This is now done when the render pass for the render surface begins
@@ -786,8 +789,15 @@ void WindowRenderSurface::SetBufferDamagedRects(const std::vector<Rect<int>>& da
   auto eglGraphics = static_cast<EglGraphics*>(mGraphics);
   if(eglGraphics)
   {
+    // If scene is not exist, just use stored mPositionSize.
     Rect<int> surfaceRect(0, 0, mPositionSize.width, mPositionSize.height);
 
+    Dali::Integration::Scene scene = mScene.GetHandle();
+    if(scene)
+    {
+      surfaceRect = scene.GetCurrentSurfaceRect();
+    }
+
     Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
     if(!eglImpl.IsPartialUpdateRequired() || mFullSwapNextFrame)
     {
@@ -828,8 +838,7 @@ void WindowRenderSurface::SetBufferDamagedRects(const std::vector<Rect<int>>& da
 
     if(!clippingRect.IsEmpty())
     {
-      std::vector<Rect<int>>   damagedRegion;
-      Dali::Integration::Scene scene = mScene.GetHandle();
+      std::vector<Rect<int>> damagedRegion;
       if(scene)
       {
         damagedRegion.push_back(RecalculateRect[std::min(scene.GetCurrentSurfaceOrientation() / 90, 3)](clippingRect, scene.GetCurrentSurfaceRect()));