X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fborder%2Fborder-visual.cpp;h=b715cca4f5a2ec330d9794ee6f3ebb4f82f42c0c;hp=e0e58306b2d4ac05b78a71682b708b2dda8199c4;hb=6ebbbf8ac1bc813b1f34950e4f76d6f55b304495;hpb=b8da2e53925b9abb9fa362560069e8ca4aa62f81 diff --git a/dali-toolkit/internal/visuals/border/border-visual.cpp b/dali-toolkit/internal/visuals/border/border-visual.cpp index e0e5830..b715cca 100644 --- a/dali-toolkit/internal/visuals/border/border-visual.cpp +++ b/dali-toolkit/internal/visuals/border/border-visual.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. @@ -39,6 +39,8 @@ namespace Internal { namespace { +const int CUSTOM_PROPERTY_COUNT(2); // color,size + const char* const POSITION_ATTRIBUTE_NAME("aPosition"); const char* const DRIFT_ATTRIBUTE_NAME("aDrift"); const char* const INDEX_NAME("indices"); @@ -127,12 +129,18 @@ void BorderVisual::DoSetProperty(Dali::Property::Index index, void BorderVisual::DoSetOnScene(Actor& actor) { - mBorderColorIndex = mImpl->mRenderer.RegisterProperty(Toolkit::BorderVisual::Property::COLOR, COLOR_NAME, mBorderColor); + if(mBorderColorIndex == Property::INVALID_INDEX) + { + mBorderColorIndex = mImpl->mRenderer.RegisterUniqueProperty(Toolkit::BorderVisual::Property::COLOR, COLOR_NAME, mBorderColor); + } if(mBorderColor.a < 1.f || mAntiAliasing) { mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); } - mBorderSizeIndex = mImpl->mRenderer.RegisterProperty(Toolkit::BorderVisual::Property::SIZE, SIZE_NAME, mBorderSize); + if(mBorderSizeIndex == Property::INVALID_INDEX) + { + mBorderSizeIndex = mImpl->mRenderer.RegisterUniqueProperty(Toolkit::BorderVisual::Property::SIZE, SIZE_NAME, mBorderSize); + } actor.AddRenderer(mImpl->mRenderer); @@ -158,7 +166,7 @@ void BorderVisual::OnSetTransform() { if(mImpl->mRenderer) { - mImpl->mTransform.RegisterUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT); + mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT); } } @@ -172,10 +180,11 @@ void BorderVisual::OnInitialize() } Shader shader = GetBorderShader(); - mImpl->mRenderer = Renderer::New(geometry, shader); + mImpl->mRenderer = VisualRenderer::New(geometry, shader); + mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT); //Register transform properties - mImpl->mTransform.RegisterUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT); + mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT); } Shader BorderVisual::GetBorderShader()