From: Adeel Kazmi Date: Fri, 15 Jul 2016 15:05:48 +0000 (+0100) Subject: Added a Max Core Property Index so that a range can be defined in toolkit X-Git-Tag: dali_1.1.45~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=3a5b25aa7510b0c2fb60aaa616cde0bf0a17b70a Added a Max Core Property Index so that a range can be defined in toolkit Change-Id: I75c878357b86e509083783144cc84a7f18374e16 --- diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index f441277..5df7b5c 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -3179,7 +3179,8 @@ const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index ind property = animatable->GetSceneGraphProperty(); } - else if ( index >= DEFAULT_PROPERTY_MAX_COUNT ) + else if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties + ( index <= PROPERTY_CUSTOM_MAX_INDEX ) ) { CustomPropertyMetadata* custom = FindCustomProperty( index ); DALI_ASSERT_ALWAYS( custom && "Property index is invalid" ); @@ -3291,7 +3292,8 @@ const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index ind property = animatable->GetSceneGraphProperty(); } - else if ( index >= DEFAULT_PROPERTY_MAX_COUNT ) + else if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties + ( index <= PROPERTY_CUSTOM_MAX_INDEX ) ) { CustomPropertyMetadata* custom = FindCustomProperty( index ); DALI_ASSERT_ALWAYS( custom && "Property index is invalid" ); diff --git a/dali/internal/event/common/object-impl-helper.h b/dali/internal/event/common/object-impl-helper.h index 3d7b09e..30d58fc 100644 --- a/dali/internal/event/common/object-impl-helper.h +++ b/dali/internal/event/common/object-impl-helper.h @@ -175,7 +175,8 @@ struct ObjectImplHelper DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" ); property = animatable->GetSceneGraphProperty(); } - else if ( index >= DEFAULT_PROPERTY_MAX_COUNT ) + else if ( ( index > CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties + ( index <= PROPERTY_CUSTOM_MAX_INDEX ) ) { CustomPropertyMetadata* custom = (object->*findCustomPropertyMethod)( index ); DALI_ASSERT_ALWAYS( custom && "Property index is invalid" ); diff --git a/dali/internal/event/common/object-impl.cpp b/dali/internal/event/common/object-impl.cpp index af52dc1..a9af750 100644 --- a/dali/internal/event/common/object-impl.cpp +++ b/dali/internal/event/common/object-impl.cpp @@ -648,6 +648,8 @@ Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Prop const PropertyBase* property = newProperty.Get(); if(index >= PROPERTY_CUSTOM_START_INDEX) { + DALI_ASSERT_ALWAYS( index <= PROPERTY_CUSTOM_MAX_INDEX && "Too many custom properties have been registered" ); + mCustomProperties.PushBack( new CustomPropertyMetadata( name, propertyValue.GetType(), property ) ); } else @@ -1282,10 +1284,9 @@ Object::~Object() CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) const { CustomPropertyMetadata* property( NULL ); - int arrayIndex; if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) ) { - for ( arrayIndex = 0; arrayIndex < (int)mCustomProperties.Count(); arrayIndex++ ) + for ( std::size_t arrayIndex = 0; arrayIndex < mCustomProperties.Count(); arrayIndex++ ) { CustomPropertyMetadata* custom = static_cast( mCustomProperties[ arrayIndex ] ); if( custom->childPropertyIndex == index ) @@ -1296,7 +1297,7 @@ CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) cons } else { - arrayIndex = index - PROPERTY_CUSTOM_START_INDEX; + int arrayIndex = index - PROPERTY_CUSTOM_START_INDEX; if( arrayIndex >= 0 ) { if( arrayIndex < (int)mCustomProperties.Count() ) // we can only access the first 2 billion custom properties diff --git a/dali/internal/event/events/pan-gesture-detector-impl.cpp b/dali/internal/event/events/pan-gesture-detector-impl.cpp index 0531670..c819a82 100644 --- a/dali/internal/event/events/pan-gesture-detector-impl.cpp +++ b/dali/internal/event/events/pan-gesture-detector-impl.cpp @@ -538,7 +538,8 @@ const PropertyInputImpl* PanGestureDetector::GetSceneObjectInputProperty( Proper return property; } - if ( index >= DEFAULT_PROPERTY_MAX_COUNT ) + if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties + ( index <= PROPERTY_CUSTOM_MAX_INDEX ) ) { CustomPropertyMetadata* custom = FindCustomProperty( index ); DALI_ASSERT_ALWAYS( custom && "Property index is invalid" ); diff --git a/dali/internal/event/rendering/shader-impl.cpp b/dali/internal/event/rendering/shader-impl.cpp index 2eb7cf6..8ced511 100644 --- a/dali/internal/event/rendering/shader-impl.cpp +++ b/dali/internal/event/rendering/shader-impl.cpp @@ -265,11 +265,12 @@ const PropertyInputImpl* Shader::GetSceneObjectInputProperty( Property::Index in { PropertyMetadata* property = NULL; - if(index >= PROPERTY_CUSTOM_START_INDEX ) + if( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties + ( index <= PROPERTY_CUSTOM_MAX_INDEX ) ) { property = FindCustomProperty( index ); } - else + else if( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) ) { property = FindAnimatableProperty( index ); } diff --git a/dali/public-api/object/property-index-ranges.h b/dali/public-api/object/property-index-ranges.h index 548992c..da4ea01 100644 --- a/dali/public-api/object/property-index-ranges.h +++ b/dali/public-api/object/property-index-ranges.h @@ -63,6 +63,9 @@ enum PropertyRanges CHILD_PROPERTY_REGISTRATION_MAX_INDEX = 49999999, ///< The maximum index supported when registering a child property @SINCE_1_1.35 PROPERTY_CUSTOM_START_INDEX = 50000000, ///< The index at which custom properties start (SceneGraph and Event side properties per instance) @SINCE_1_0.0 + PROPERTY_CUSTOM_MAX_INDEX = 59999999, ///< The maximum index supported for custom properties @SINCE_1_1.45 + + CORE_PROPERTY_MAX_INDEX = PROPERTY_CUSTOM_MAX_INDEX, ///< The maximum index that Core properties can go up to @SINCE_1_1.45 }; /**