(Partial update) Reset the updated flag after calculating the update area 02/266602/1
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 16 Nov 2021 06:21:05 +0000 (15:21 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 16 Nov 2021 06:21:05 +0000 (15:21 +0900)
We had an issue that the updated flag of non-renderable actor was not reset.
It should also be reset after calculating the update area.
So reset the updated flag of all nodes.

Change-Id: I8b4d540996565ba2d0ef9e528114dad5e3de2475

automated-tests/src/dali/utc-Dali-Actor.cpp
dali/internal/render/common/render-manager.cpp

index 60c0cfd..b9f8dba 100644 (file)
@@ -9097,6 +9097,65 @@ int utcDaliActorPartialUpdate3DNode(void)
   END_TEST;
 }
 
+int utcDaliActorPartialUpdateNotRenderableActor(void)
+{
+  TestApplication application(
+    TestApplication::DEFAULT_SURFACE_WIDTH,
+    TestApplication::DEFAULT_SURFACE_HEIGHT,
+    TestApplication::DEFAULT_HORIZONTAL_DPI,
+    TestApplication::DEFAULT_VERTICAL_DPI,
+    true,
+    true);
+
+  tet_infoline("Check the damaged rect with not renderable parent actor");
+
+  const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
+
+  Actor parent                          = Actor::New();
+  parent[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+  parent[Actor::Property::POSITION]     = Vector3(16.0f, 16.0f, 0.0f);
+  parent[Actor::Property::SIZE]         = Vector3(16.0f, 16.0f, 0.0f);
+  parent.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+  application.GetScene().Add(parent);
+
+  Actor child                          = CreateRenderableActor();
+  child[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT;
+  child[Actor::Property::SIZE]         = Vector3(16.0f, 16.0f, 0.0f);
+  child.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+  parent.Add(child);
+
+  application.SendNotification();
+
+  std::vector<Rect<int>> damagedRects;
+
+  // 1. Actor added, damaged rect is added size of actor
+  application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+  DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+
+  // Aligned by 16
+  Rect<int> clippingRect = Rect<int>(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates
+  DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], TEST_LOCATION);
+
+  application.RenderWithPartialUpdate(damagedRects, clippingRect);
+  DALI_TEST_EQUALS(clippingRect.x, glScissorParams.x, TEST_LOCATION);
+  DALI_TEST_EQUALS(clippingRect.y, glScissorParams.y, TEST_LOCATION);
+  DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
+  DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
+
+  damagedRects.clear();
+  application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+  application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+  damagedRects.clear();
+  application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+  application.RenderWithPartialUpdate(damagedRects, clippingRect);
+
+  // Ensure the damaged rect is empty
+  DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
+
+  END_TEST;
+}
+
 int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void)
 {
   TestApplication application;
index 5079c33..8db070b 100644 (file)
@@ -28,6 +28,7 @@
 #include <dali/internal/event/common/scene-impl.h>
 
 #include <dali/internal/update/common/scene-graph-scene.h>
+#include <dali/internal/update/nodes/scene-graph-layer.h>
 #include <dali/internal/update/render-tasks/scene-graph-camera.h>
 
 #include <dali/internal/render/common/render-algorithms.h>
@@ -614,7 +615,6 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector<Rect<int>>&
                 (item.mNode->Updated() || (item.mRenderer && item.mRenderer->Updated(mImpl->renderBufferIndex, item.mNode)))))
             {
               item.mIsUpdated = false;
-              item.mNode->SetUpdatedTree(false);
 
               rect = RenderItem::CalculateViewportSpaceAABB(item.mModelViewMatrix, item.mUpdateSize, viewportRect.width, viewportRect.height);
               if(rect.IsValid() && rect.Intersect(viewportRect) && !rect.IsEmpty())
@@ -677,6 +677,9 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector<Rect<int>>&
             }
           }
         }
+
+        // Reset updated flag from the root
+        renderList->GetSourceLayer()->SetUpdatedTree(false);
       }
     }
   }