X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fshader-effects%2Fsoft-button-effect.cpp;h=f516973b4570607ccbd80007674da0abcebbc5a1;hp=9789576a8cf46f7d36b3a6b161cbcf93d3617a77;hb=cd7d41bc8e0a0816da28401207091344fbbe0b2c;hpb=8fef10ea440a32a1536b485dc7a035f9defa537c 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 9789576..f516973 100644 --- a/dali-toolkit/public-api/shader-effects/soft-button-effect.cpp +++ b/dali-toolkit/public-api/shader-effects/soft-button-effect.cpp @@ -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(); +} //////////////////////////////////////////////////// // @@ -373,8 +366,9 @@ SoftButtonEffect SoftButtonEffect::New(Type type) // precalc 1.0 / uInsideCircleSizeScale on CPU to save shader insns, using constraint to tie to the normal property 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( recipInsideCircleSizeScalePropertyIndex, LocalSource(insideCircleSizeScalePropertyIndex), ReciprocalConstraint()); - handle.ApplyConstraint(constraint); + Constraint constraint = Constraint::New( handle, recipInsideCircleSizeScalePropertyIndex, InverseConstraint ); + constraint.AddSource( LocalSource(insideCircleSizeScalePropertyIndex) ); + constraint.Apply(); } return handle;