[Tizen] (Partial update) Fix clipping area issue during window rotation 69/266769/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 18 Nov 2021 10:28:43 +0000 (19:28 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 18 Nov 2021 10:46:41 +0000 (19:46 +0900)
When window rotation events come from ecre, the result will be scored
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 clipping Rect will calculate wrong value.

This patch make clipping area always use current scene surface

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

index 8e3c997..d0de231 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,7 +789,13 @@ void WindowRenderSurface::SetBufferDamagedRects(const std::vector<Rect<int>>& da
   auto eglGraphics = static_cast<EglGraphics*>(mGraphics);
   if(eglGraphics)
   {
-    Rect<int> surfaceRect(0, 0, mPositionSize.width, mPositionSize.height);
+    Rect<int> surfaceRect;
+
+    Dali::Integration::Scene scene = mScene.GetHandle();
+    if(scene)
+    {
+      surfaceRect = scene.GetCurrentSurfaceRect();
+    }
 
     Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
     if(!eglImpl.IsPartialUpdateRequired() || mFullSwapNextFrame)
@@ -829,7 +838,6 @@ void WindowRenderSurface::SetBufferDamagedRects(const std::vector<Rect<int>>& da
     if(!clippingRect.IsEmpty())
     {
       std::vector<Rect<int>>   damagedRegion;
-      Dali::Integration::Scene scene = mScene.GetHandle();
       if(scene)
       {
         damagedRegion.push_back(RecalculateRect[std::min(scene.GetCurrentSurfaceOrientation() / 90, 3)](clippingRect, scene.GetCurrentSurfaceRect()));