From 6348e5bb26d2f42f92246ae849974ee430b57297 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 24 Jan 2022 16:56:47 +0900 Subject: [PATCH 1/1] (Partial Update) Use world color to check if the item is updated Change-Id: I2d1ca5df07cd1c0456f77c178d60e2bf463448ed --- automated-tests/src/dali/utc-Dali-Actor.cpp | 74 +++++++++++++++++++++- .../manager/render-instruction-processor.cpp | 4 +- 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 59b3611..5a2f803 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -9303,6 +9303,78 @@ int utcDaliActorPartialUpdateChangeTransparency(void) END_TEST; } +int utcDaliActorPartialUpdateChangeParentOpacity(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 changing parent's opacity"); + + 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); + + Texture texture = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u); + Actor child = CreateRenderableActor(texture); + 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> damagedRects; + + // 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 clippingRect = Rect(16, 768, 32, 32); // in screen coordinates, includes 3 last frames updates + DALI_TEST_EQUALS>(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); + + // Change the parent's opacity + parent[Actor::Property::OPACITY] = 0.5f; + + application.SendNotification(); + + // The damaged rect should be same + damagedRects.clear(); + application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects); + application.RenderWithPartialUpdate(damagedRects, clippingRect); + DALI_TEST_CHECK(damagedRects.size() > 0); + DALI_TEST_EQUALS>(clippingRect, damagedRects[0], TEST_LOCATION); + + END_TEST; +} + int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void) { TestApplication application; diff --git a/dali/internal/update/manager/render-instruction-processor.cpp b/dali/internal/update/manager/render-instruction-processor.cpp index a395436..ff4d120 100644 --- a/dali/internal/update/manager/render-instruction-processor.cpp +++ b/dali/internal/update/manager/render-instruction-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -239,7 +239,7 @@ inline void AddRendererToRenderList(BufferIndex updateBufferIndex, partialRenderingCacheInfo.node = node; partialRenderingCacheInfo.isOpaque = (opacityType == Renderer::OPAQUE); partialRenderingCacheInfo.renderer = renderable.mRenderer; - partialRenderingCacheInfo.color = node->GetColor(updateBufferIndex); + partialRenderingCacheInfo.color = node->GetWorldColor(updateBufferIndex); partialRenderingCacheInfo.depthIndex = node->GetDepthIndex(); if(DALI_LIKELY(renderable.mRenderer)) -- 2.7.4