X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fshader-effects%2Fsoft-button-effect.cpp;h=fbf3da2ec1c4f318dfcf48c17061fcafb10b9a5b;hb=df89f9f230cadaac7be4007d1b1a7cf7dc893011;hp=0ea73e702fa70872e8f5b0d43bd9b0731ed3d81b;hpb=4b38b709efae6ba534f7d336b70dabb74c804e03;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/shader-effects/soft-button-effect.cpp b/dali-toolkit/public-api/shader-effects/soft-button-effect.cpp index 0ea73e7..fbf3da2 100644 --- a/dali-toolkit/public-api/shader-effects/soft-button-effect.cpp +++ b/dali-toolkit/public-api/shader-effects/soft-button-effect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 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. @@ -16,7 +16,6 @@ */ // EXTERNAL INCLUDES -#include #include #include @@ -58,20 +57,14 @@ const float SOFT_BUTTON_RECTANGLE_SIZE_SCALE_DEFAULT = 0.5f; } // namespace /** - * ReciprocalConstraint + * InverseConstraint * * f(current, property) = 1.0 / property */ -struct ReciprocalConstraint +void InverseConstraint( float& current, const PropertyInputContainer& inputs ) { - ReciprocalConstraint(){} - - float operator()(const float current, const PropertyInput& property) - { - return 1.0f / property.GetFloat(); - } -}; - + current = 1.0f / inputs[0]->GetFloat(); +} //////////////////////////////////////////////////// // @@ -371,10 +364,11 @@ SoftButtonEffect SoftButtonEffect::New(Type type) } // precalc 1.0 / uInsideCircleSizeScale on CPU to save shader insns, using constraint to tie to the normal property - Property::Index insideCircleSizeScalePropertyIndex = handle.GetPropertyIndex(SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME); - Property::Index recipInsideCircleSizeScalePropertyIndex = handle.GetPropertyIndex(SOFT_BUTTON_RECIP_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME); - Constraint constraint = Constraint::New( recipInsideCircleSizeScalePropertyIndex, LocalSource(insideCircleSizeScalePropertyIndex), ReciprocalConstraint()); - handle.ApplyConstraint(constraint); + Dali::Property::Index insideCircleSizeScalePropertyIndex = handle.GetPropertyIndex(SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME); + Dali::Property::Index recipInsideCircleSizeScalePropertyIndex = handle.GetPropertyIndex(SOFT_BUTTON_RECIP_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME); + Constraint constraint = Constraint::New( handle, recipInsideCircleSizeScalePropertyIndex, InverseConstraint ); + constraint.AddSource( LocalSource(insideCircleSizeScalePropertyIndex) ); + constraint.Apply(); } return handle; @@ -428,4 +422,3 @@ const std::string& SoftButtonEffect::GetRectangleSizeScalePropertyName() const } } -