From: Adeel Kazmi Date: Fri, 18 Feb 2022 11:13:24 +0000 (+0000) Subject: Merge "DALi Version 2.1.10" into devel/master X-Git-Tag: dali_2.1.11~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2aa85870a1d3a6a768f302117783f63c794251a;hp=da5d92d5e34617c90d9822d13e1c5c093510a323;p=platform%2Fcore%2Fuifw%2Fdali-core.git Merge "DALi Version 2.1.10" into devel/master --- diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 5a2f803..05b5732 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -9375,6 +9375,88 @@ int utcDaliActorPartialUpdateChangeParentOpacity(void) END_TEST; } +int utcDaliActorPartialAddRemoveRenderer(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 adding / removing renderer"); + + const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams()); + + Actor actor = CreateRenderableActor(); + actor[Actor::Property::ANCHOR_POINT] = AnchorPoint::TOP_LEFT; + actor[Actor::Property::POSITION] = Vector3(16.0f, 16.0f, 0.0f); + actor[Actor::Property::SIZE] = Vector3(16.0f, 16.0f, 0.0f); + actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(actor); + + 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); + + // Remove the Renderer + Renderer renderer = actor.GetRendererAt(0); + actor.RemoveRenderer(renderer); + + application.SendNotification(); + + // The damaged rect should be the actor area + 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); + + 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); + + // Add the Renderer again + actor.AddRenderer(renderer); + + application.SendNotification(); + + // The damaged rect should be the actor area + 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>(clippingRect, damagedRects[0], TEST_LOCATION); + + END_TEST; +} + int UtcDaliActorCaptureAllTouchAfterStartPropertyP(void) { TestApplication application; diff --git a/dali/internal/update/nodes/node.cpp b/dali/internal/update/nodes/node.cpp index 459473c..60f1c44 100644 --- a/dali/internal/update/nodes/node.cpp +++ b/dali/internal/update/nodes/node.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. @@ -281,6 +281,8 @@ void Node::AddRenderer(Renderer* renderer) } } + SetUpdated(true); + mRenderer.PushBack(renderer); } @@ -291,6 +293,7 @@ void Node::RemoveRenderer(const Renderer* renderer) { if(mRenderer[i] == renderer) { + SetUpdated(true); mRenderer.Erase(mRenderer.Begin() + i); return; }