We use temp std::vector stack during NegotiateDimensions.
This patch make we use always same global static value as stack.
So we can avoid create / destroy it every frame.
(This patch is follow up 248736)
Change-Id: I1fa059693d0559b00afbad32dd646e103aba53f7
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+/**
+ * @brief Keep a static recursionstack vector to avoid creating temporary vectors every Relayout().
+ */
+static Dali::Internal::ActorSizer::ActorDimensionStack gRecursionStack{};
+
} // namespace
namespace Dali::Internal
} // namespace
namespace Dali::Internal
if(!recursionFound)
{
// Record the path that we have taken
if(!recursionFound)
{
// Record the path that we have taken
- recursionStack.push_back(ActorDimensionPair(&mOwner, dimension));
+ recursionStack.emplace_back(&mOwner, dimension);
// Dimension dependency check
for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
// Dimension dependency check
for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
void ActorSizer::NegotiateDimensions(const Vector2& allocatedSize)
{
// Negotiate all dimensions that require it
void ActorSizer::NegotiateDimensions(const Vector2& allocatedSize)
{
// Negotiate all dimensions that require it
- ActorDimensionStack recursionStack;
+ gRecursionStack.clear();
for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
const Dimension::Type dimension = static_cast<Dimension::Type>(1 << i);
// Negotiate
for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
const Dimension::Type dimension = static_cast<Dimension::Type>(1 << i);
// Negotiate
- NegotiateDimension(dimension, allocatedSize, recursionStack);
+ NegotiateDimension(dimension, allocatedSize, gRecursionStack);