(Partial Update) Fix renderer opacity issue 47/278547/1
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 22 Jul 2022 01:43:19 +0000 (10:43 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Fri, 22 Jul 2022 01:43:24 +0000 (10:43 +0900)
It was not detected when the renderer opacity is changed from the translucent value to another translucent value

Change-Id: If8448e03c0b106e5820c854e8878039ee93d9dc6

automated-tests/src/dali/utc-Dali-Actor.cpp
dali/internal/update/manager/render-instruction-processor.cpp

index 32ff0fb..e233914 100644 (file)
@@ -9343,6 +9343,55 @@ int utcDaliActorPartialUpdateChangeTransparency(void)
   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);
+
+  // Make the actor translucent
+  renderer[DevelRenderer::Property::OPACITY] = 0.5f;
+
+  application.SendNotification();
+
+  // The damaged rect should not be empty
+  damagedRects.clear();
+  application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+  application.RenderWithPartialUpdate(damagedRects, clippingRect);
+  DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+  DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], 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);
+
+  // Change Renderer opacity - also translucent
+  renderer[DevelRenderer::Property::OPACITY] = 0.2f;
+
+  application.SendNotification();
+
+  // The damaged rect should not be empty
+  damagedRects.clear();
+  application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
+  application.RenderWithPartialUpdate(damagedRects, clippingRect);
+  DALI_TEST_EQUALS(damagedRects.size(), 1, TEST_LOCATION);
+  DALI_TEST_EQUALS<Rect<int>>(clippingRect, damagedRects[0], 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);
+
   // Make the actor culled
   actor[Actor::Property::SIZE] = Vector3(0.0f, 0.0f, 0.0f);
 
@@ -10499,4 +10548,4 @@ int UtcDaliActorAllowOnlyOwnTouchPropertyN(void)
     tet_result(TET_FAIL);
   }
   END_TEST;
-}
\ No newline at end of file
+}
index 744d674..67b47a5 100644 (file)
@@ -268,6 +268,7 @@ inline void AddRendererToRenderList(BufferIndex         updateBufferIndex,
 
       if(DALI_LIKELY(renderable.mRenderer))
       {
+        partialRenderingCacheInfo.color.a *= renderable.mRenderer->GetOpacity(updateBufferIndex);
         partialRenderingCacheInfo.textureSet = renderable.mRenderer->GetTextureSet();
       }