X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-base-data-impl.cpp;h=49a14def9a1d9f221bc8c06e3d63f3b5ed5e7b3c;hp=8106899457f3b39b4e47239cf0eb0db3f0803688;hb=5a936aac073676657d48db5c42e5d2ad3f5cac9f;hpb=3de07b3d83f48fa5b08f24af1f7f721a4923eec9 diff --git a/dali-toolkit/internal/visuals/visual-base-data-impl.cpp b/dali-toolkit/internal/visuals/visual-base-data-impl.cpp index 8106899..49a14de 100644 --- a/dali-toolkit/internal/visuals/visual-base-data-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-data-impl.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. @@ -73,6 +73,7 @@ Dali::Vector2 PointToVector2(Toolkit::Align::Type point, Toolkit::Direction::Typ 0.0f,1.0f, 0.5f,1.0f, 1.0f,1.0f}; + // clang-format on Vector2 result(&pointToVector2[point * 2]); @@ -125,11 +126,6 @@ Internal::Visual::Base::Impl::Impl(FittingMode fittingMode, Toolkit::Visual::Typ mCornerRadius(Vector4::ZERO), mCornerRadiusPolicy(1.0f), mDepthIndex(0.0f), - mMixColorIndex(Property::INVALID_INDEX), - mBorderlineWidthIndex(Property::INVALID_INDEX), - mBorderlineColorIndex(Property::INVALID_INDEX), - mBorderlineOffsetIndex(Property::INVALID_INDEX), - mCornerRadiusIndex(Property::INVALID_INDEX), mFittingMode(fittingMode), mFlags(0), mResourceStatus(Toolkit::Visual::ResourceStatus::PREPARING), @@ -252,9 +248,7 @@ Internal::Visual::Base::Impl::Transform::Transform() mExtraSize(0.0f, 0.0f), mOffsetSizeMode(0.0f, 0.0f, 0.0f, 0.0f), mOrigin(Toolkit::Align::TOP_BEGIN), - mAnchorPoint(Toolkit::Align::TOP_BEGIN), - mOffsetIndex(Property::INVALID_INDEX), - mSizeIndex(Property::INVALID_INDEX) + mAnchorPoint(Toolkit::Align::TOP_BEGIN) { } @@ -276,76 +270,29 @@ void Internal::Visual::Base::Impl::Transform::UpdatePropertyMap(const Property:: for(Property::Map::SizeType i(0); i < map.Count(); ++i) { KeyValuePair keyValue = map.GetKeyValue(i); - if(keyValue.first.type == Property::Key::INDEX) - { - switch(keyValue.first.indexKey) - { - case Toolkit::Visual::Transform::Property::OFFSET: - { - keyValue.second.Get(mOffset); - break; - } - case Toolkit::Visual::Transform::Property::SIZE: - { - keyValue.second.Get(mSize); - break; - } - case Toolkit::Visual::Transform::Property::ORIGIN: - { - Scripting::GetEnumerationProperty(keyValue.second, ALIGN_TABLE, ALIGN_TABLE_COUNT, mOrigin); - break; - } - case Toolkit::Visual::Transform::Property::ANCHOR_POINT: - { - Scripting::GetEnumerationProperty(keyValue.second, ALIGN_TABLE, ALIGN_TABLE_COUNT, mAnchorPoint); - break; - } - case Toolkit::Visual::Transform::Property::OFFSET_POLICY: - { - Vector2 policy; - if(GetPolicyFromValue(keyValue.second, policy)) - { - mOffsetSizeMode.x = policy.x; - mOffsetSizeMode.y = policy.y; - } - break; - } - case Toolkit::Visual::Transform::Property::SIZE_POLICY: - { - Vector2 policy; - if(GetPolicyFromValue(keyValue.second, policy)) - { - mOffsetSizeMode.z = policy.x; - mOffsetSizeMode.w = policy.y; - } - break; - } - case Toolkit::DevelVisual::Transform::Property::EXTRA_SIZE: - { - keyValue.second.Get(mExtraSize); - break; - } - } - } - else // Key type is STRING + switch(Visual::Base::GetIntKey(keyValue.first)) { - if(keyValue.first == "offset") + case Toolkit::Visual::Transform::Property::OFFSET: { keyValue.second.Get(mOffset); + break; } - else if(keyValue.first == "size") + case Toolkit::Visual::Transform::Property::SIZE: { keyValue.second.Get(mSize); + break; } - else if(keyValue.first == "origin") + case Toolkit::Visual::Transform::Property::ORIGIN: { Scripting::GetEnumerationProperty(keyValue.second, ALIGN_TABLE, ALIGN_TABLE_COUNT, mOrigin); + break; } - else if(keyValue.first == "anchorPoint") + case Toolkit::Visual::Transform::Property::ANCHOR_POINT: { Scripting::GetEnumerationProperty(keyValue.second, ALIGN_TABLE, ALIGN_TABLE_COUNT, mAnchorPoint); + break; } - else if(keyValue.first == "offsetPolicy") + case Toolkit::Visual::Transform::Property::OFFSET_POLICY: { Vector2 policy; if(GetPolicyFromValue(keyValue.second, policy)) @@ -353,8 +300,9 @@ void Internal::Visual::Base::Impl::Transform::UpdatePropertyMap(const Property:: mOffsetSizeMode.x = policy.x; mOffsetSizeMode.y = policy.y; } + break; } - else if(keyValue.first == "sizePolicy") + case Toolkit::Visual::Transform::Property::SIZE_POLICY: { Vector2 policy; if(GetPolicyFromValue(keyValue.second, policy)) @@ -362,10 +310,12 @@ void Internal::Visual::Base::Impl::Transform::UpdatePropertyMap(const Property:: mOffsetSizeMode.z = policy.x; mOffsetSizeMode.w = policy.y; } + break; } - else if(keyValue.first == "extraSize") + case Toolkit::DevelVisual::Transform::Property::EXTRA_SIZE: { keyValue.second.Get(mExtraSize); + break; } } } @@ -374,7 +324,8 @@ void Internal::Visual::Base::Impl::Transform::UpdatePropertyMap(const Property:: void Internal::Visual::Base::Impl::Transform::GetPropertyMap(Property::Map& map) const { map.Clear(); - map.Add(Toolkit::Visual::Transform::Property::OFFSET, mOffset) + map + .Add(Toolkit::Visual::Transform::Property::OFFSET, mOffset) .Add(Toolkit::Visual::Transform::Property::SIZE, mSize) .Add(Toolkit::Visual::Transform::Property::ORIGIN, mOrigin) .Add(Toolkit::Visual::Transform::Property::ANCHOR_POINT, mAnchorPoint) @@ -383,14 +334,16 @@ void Internal::Visual::Base::Impl::Transform::GetPropertyMap(Property::Map& map) .Add(Toolkit::DevelVisual::Transform::Property::EXTRA_SIZE, mExtraSize); } -void Internal::Visual::Base::Impl::Transform::RegisterUniforms(Dali::Renderer renderer, Toolkit::Direction::Type direction) +void Internal::Visual::Base::Impl::Transform::SetUniforms(Dali::VisualRenderer renderer, Toolkit::Direction::Type direction) { - mSizeIndex = renderer.RegisterProperty(SIZE, mSize); - mOffsetIndex = renderer.RegisterProperty(OFFSET, direction == Toolkit::Direction::LEFT_TO_RIGHT ? mOffset : mOffset * Vector2(-1.0f, 1.0f)); - renderer.RegisterProperty(OFFSET_SIZE_MODE, mOffsetSizeMode); - renderer.RegisterProperty(ORIGIN, PointToVector2(mOrigin, direction) - Vector2(0.5, 0.5)); - renderer.RegisterProperty(ANCHOR_POINT, Vector2(0.5, 0.5) - PointToVector2(mAnchorPoint, direction)); - renderer.RegisterProperty(EXTRA_SIZE, mExtraSize); + renderer.SetProperty(VisualRenderer::Property::TRANSFORM_SIZE, mSize); + renderer.SetProperty(VisualRenderer::Property::TRANSFORM_OFFSET, + direction == Toolkit::Direction::LEFT_TO_RIGHT ? mOffset : mOffset * Vector2(-1.0f, 1.0f)); + renderer.SetProperty(VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE, mOffsetSizeMode); + renderer.SetProperty(VisualRenderer::Property::TRANSFORM_ORIGIN, PointToVector2(mOrigin, direction) - Vector2(0.5, 0.5)); + renderer.SetProperty(VisualRenderer::Property::TRANSFORM_ANCHOR_POINT, + Vector2(0.5, 0.5) - PointToVector2(mAnchorPoint, direction)); + renderer.SetProperty(VisualRenderer::Property::EXTRA_SIZE, mExtraSize); } Vector2 Internal::Visual::Base::Impl::Transform::GetVisualSize(const Vector2& controlSize)