From: huiyu.eun Date: Mon, 9 Apr 2018 04:56:40 +0000 (+0900) Subject: Merge branch 'devel/master' into tizen X-Git-Tag: accepted/tizen/unified/20180412.073726~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=b9455f1f8798591d4a67c7ac116c67c65c2efe62;hp=98768de7da663004a317e97f5c1fcafd1bd10d52 Merge branch 'devel/master' into tizen Change-Id: I42ce5175be98d52dfd2dd13a40b379019b6edd23 --- diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt index e75f2d2..6fdf651 100644 --- a/automated-tests/src/dali/CMakeLists.txt +++ b/automated-tests/src/dali/CMakeLists.txt @@ -59,6 +59,7 @@ SET(TC_SOURCES utc-Dali-PinchGestureDetector.cpp utc-Dali-Pixel.cpp utc-Dali-PixelData.cpp + utc-Dali-Processors.cpp utc-Dali-PropertyArray.cpp utc-Dali-PropertyBuffer.cpp utc-Dali-PropertyMap.cpp diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp index 0e640e7..8bb7176 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp @@ -79,6 +79,11 @@ void TestApplication::Initialize() Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); Dali::Integration::Log::InstallLogFunction(logFunction); + Dali::Integration::Trace::LogContextFunction logContextFunction(&TestApplication::LogContext); + Dali::Integration::Trace::InstallLogContextFunction( logContextFunction ); + + Dali::Integration::Trace::LogContext( true, "Test" ); + mCore->SceneCreated(); } @@ -88,6 +93,18 @@ TestApplication::~TestApplication() delete mCore; } +void TestApplication::LogContext( bool start, const char* tag ) +{ + if( start ) + { + fprintf(stderr, "INFO: Trace Start: %s", tag); + } + else + { + fprintf(stderr, "INFO: Trace End: %s", tag); + } +} + void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) { switch(level) diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.h b/automated-tests/src/dali/dali-test-suite-utils/test-application.h index 5c94252..747b488 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.h @@ -26,6 +26,7 @@ #include "test-render-controller.h" #include #include +#include namespace Dali { @@ -66,6 +67,7 @@ public: void Initialize(); virtual ~TestApplication(); static void LogMessage( Dali::Integration::Log::DebugPriority level, std::string& message ); + static void LogContext( bool start, const char* tag ); Dali::Integration::Core& GetCore(); TestPlatformAbstraction& GetPlatform(); TestRenderController& GetRenderController(); diff --git a/automated-tests/src/dali/utc-Dali-Handle.cpp b/automated-tests/src/dali/utc-Dali-Handle.cpp index 19e04f6..71b431f 100644 --- a/automated-tests/src/dali/utc-Dali-Handle.cpp +++ b/automated-tests/src/dali/utc-Dali-Handle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -22,6 +22,8 @@ #include #include #include "dali-test-suite-utils/dali-test-suite-utils.h" +#include "dali-test-suite-utils/test-custom-actor.h" + #include using namespace Dali; @@ -1036,3 +1038,229 @@ int UtcDaliHandleGetCurrentProperty(void) END_TEST; } + +int UtcDaliHandleDoesCustomPropertyExistP1(void) +{ + TestApplication application; // Needs type registry + + tet_infoline( "Test if a registered custom property exists on object" ); + + Actor actor = Actor::New(); + auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f); + + DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, propertyIndex ), true, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliHandleDoesCustomPropertyExistN1(void) +{ + TestApplication application; // Needs type registry + + tet_infoline( "Test if a registered custom property does not exist on object" ); + + Actor actor = Actor::New(); + auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f); + + DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, propertyIndex+1 ), false, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliHandleDoesCustomPropertyExistN2(void) +{ + TestApplication application; // Needs type registry + + tet_infoline( "Test that a default property does not show as a custom property on object" ); + + Actor actor = Actor::New(); + DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, Actor::Property::POSITION ), false, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliHandleDoesCustomPropertyExistN3(void) +{ + TestApplication application; // Needs type registry + + tet_infoline( "Test that a child property does not exist on actor after parenting to container" ); + TypeRegistry typeRegistry = TypeRegistry::Get(); + + auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) ); + + const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + const char* CHILD_PROPERTY_NAME( "childProperty" ); + + ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER ); + + auto container = Test::TestCustomActor::New(); + Stage::GetCurrent().Add( container ); + auto child = Actor::New(); + container.Add( child ); // Resolve child properties (if any) + + DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), false, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliHandleDoesCustomPropertyExistP2(void) +{ + TestApplication application; // Needs type registry + + tet_infoline( "Test that a child property exists after being set" ); + TypeRegistry typeRegistry = TypeRegistry::Get(); + + auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) ); + + const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + const char* CHILD_PROPERTY_NAME( "childProperty" ); + + ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER ); + + auto container = Test::TestCustomActor::New(); + Stage::GetCurrent().Add( container ); + auto child = Actor::New(); + container.Add( child ); // Resolve child properties (if any) + child.SetProperty( CHILD_PROPERTY, 2 ); + + DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetProperty( CHILD_PROPERTY ), 2, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliHandleDoesCustomPropertyExistP3(void) +{ + TestApplication application; // Needs type registry + + tet_infoline( "Test that a child property is re-indexed after registration, and that it exists" ); + TypeRegistry typeRegistry = TypeRegistry::Get(); + + auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) ); + + const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + const char* CHILD_PROPERTY_NAME( "childProperty" ); + + ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER ); + + auto container = Test::TestCustomActor::New(); + Stage::GetCurrent().Add( container ); + auto child = Actor::New(); + child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) ); + container.Add( child ); // Resolve child properties (if any) + + DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetProperty( CHILD_PROPERTY ), 3, TEST_LOCATION ); + END_TEST; +} + +namespace +{ + +struct PropertySetSignalCheck +{ + PropertySetSignalCheck(bool& signalReceived, Property::Value& value) + : mSignalReceived(signalReceived), + mValue(value) + { + } + + void operator()(Handle& handle, Property::Index index, Property::Value value) + { + mSignalReceived = true; + mValue = value; + } + + void Reset() + { + mSignalReceived = false; + } + + void CheckSignalReceived() + { + if (!mSignalReceived) + { + tet_printf("Expected Property Set signal was not received\n"); + tet_result(TET_FAIL); + } + else + { + tet_result(TET_PASS); + } + } + + bool& mSignalReceived; // owned by individual tests + Property::Value& mValue; +}; + +} // anon namespace + +int UtcDaliHandlePropertySetSignal01(void) +{ + TestApplication app; + + bool signalReceived(false); + Property::Value value; + PropertySetSignalCheck propertySetCheck(signalReceived, value); + + tet_infoline( "Test that setting a default property triggers a signal" ); + + auto actor = Actor::New(); + DevelHandle::PropertySetSignal(actor).Connect(&app, propertySetCheck); + + actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS ); + propertySetCheck.CheckSignalReceived(); + + END_TEST; +} + + +int UtcDaliHandlePropertySetSignal02(void) +{ + TestApplication app; + + bool signalReceived(false); + Property::Value value; + PropertySetSignalCheck propertySetCheck(signalReceived, value); + + tet_infoline( "Test that setting a custom property triggers a signal" ); + + auto actor = Actor::New(); + DevelHandle::PropertySetSignal(actor).Connect(&app, propertySetCheck); + + auto propertyIndex = actor.RegisterProperty("propName", 3.0f); + actor.SetProperty( propertyIndex, 5.0f ); + propertySetCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 5.0f ), 0.001f, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliHandlePropertySetSignal03(void) +{ + TestApplication app; + TypeRegistry typeRegistry = TypeRegistry::Get(); + + bool signalReceived(false); + Property::Value value; + PropertySetSignalCheck propertySetCheck(signalReceived, value); + + tet_infoline( "Test that setting a child property triggers a signal" ); + + auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) ); + + const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + const char* CHILD_PROPERTY_NAME( "childProperty" ); + + ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER ); + + auto container = Test::TestCustomActor::New(); + Stage::GetCurrent().Add( container ); + auto child = Actor::New(); + child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) ); + DevelHandle::PropertySetSignal(child).Connect(&app, propertySetCheck); + container.Add( child ); // Resolve child properties (if any) + + DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetProperty( CHILD_PROPERTY ), 3, TEST_LOCATION ); + + child.SetProperty( CHILD_PROPERTY, 29 ); + propertySetCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 29 ), TEST_LOCATION ); + END_TEST; +} diff --git a/automated-tests/src/dali/utc-Dali-Processors.cpp b/automated-tests/src/dali/utc-Dali-Processors.cpp new file mode 100644 index 0000000..0d45357 --- /dev/null +++ b/automated-tests/src/dali/utc-Dali-Processors.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include + +using namespace Dali; + + +class TestProcessor : public Integration::Processor +{ +public: + TestProcessor() + : processRun(false) + { + } + + virtual void Process() + { + processRun = true; + } + + bool processRun; +}; + + +int UtcDaliCoreProcessorP(void) +{ + TestApplication application; + + TestProcessor testProcessor; + Integration::Core& core = application.GetCore(); + core.RegisterProcessor( testProcessor ); + + tet_infoline("Test that the processor has not been executed yet:"); + DALI_TEST_CHECK( testProcessor.processRun == false ); + + application.SendNotification(); + + tet_infoline("Test that the processor has been executed:"); + DALI_TEST_CHECK( testProcessor.processRun ); + + // Clear down for next part of test + testProcessor.processRun = false; + + core.UnregisterProcessor( testProcessor ); + application.SendNotification(); + tet_infoline("Test that the processor has not been executed again:"); + DALI_TEST_CHECK( testProcessor.processRun == false ); + + END_TEST; +} diff --git a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp index feabd0e..fb2bb5b 100644 --- a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp +++ b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -2778,3 +2778,139 @@ int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponents END_TEST; } + + +int UtcDaliTypeInfoRegisterChildProperties01(void) +{ + TestApplication application; + TypeRegistry typeRegistry = TypeRegistry::Get(); + + tet_infoline( "Register child properties on a type via name" ); + + auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) ); + auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); + DALI_TEST_CHECK( customActorTypeInfo ); + DALI_TEST_CHECK( myCustomTypeInfo ); + + const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); + const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); + + ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER ); + ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER ); + ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS ); + + auto customActor = MyTestCustomActor::New(); + Stage::GetCurrent().Add( customActor ); + auto child = Actor::New(); + customActor.Add( child ); + + child.SetProperty( WIDTH_SPECIFICATION, 33 ); + + auto value = child.GetProperty( WIDTH_SPECIFICATION ); + DALI_TEST_EQUALS( value, Property::Value(33), TEST_LOCATION ); + + child.SetProperty( HEIGHT_SPECIFICATION, 44 ); + value = child.GetProperty( HEIGHT_SPECIFICATION ); + DALI_TEST_EQUALS( value, Property::Value(44), TEST_LOCATION ); + + child.SetProperty( MARGIN_SPECIFICATION, Extents(10, 10, 10, 10) ); + value = child.GetProperty( MARGIN_SPECIFICATION ); + DALI_TEST_EQUALS( value, Property::Value(Extents(10,10,10,10)), TEST_LOCATION ); + + END_TEST; +} + + +int UtcDaliTypeInfoRegisterChildProperties02(void) +{ + TestApplication application; + TypeRegistry typeRegistry = TypeRegistry::Get(); + + tet_infoline( "Register child properties on a type via name" ); + + auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) ); + auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); + DALI_TEST_CHECK( customActorTypeInfo ); + DALI_TEST_CHECK( myCustomTypeInfo ); + + const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); + const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); + + ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER ); + ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER ); + ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS ); + + + auto index = customActorTypeInfo.GetChildPropertyIndex( "widthSpecification" ); + DALI_TEST_EQUALS( index, WIDTH_SPECIFICATION, TEST_LOCATION ); + + index = customActorTypeInfo.GetChildPropertyIndex( "heightSpecification" ); + DALI_TEST_EQUALS( index, HEIGHT_SPECIFICATION, TEST_LOCATION ); + + index = customActorTypeInfo.GetChildPropertyIndex( "marginSpecification" ); + DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION ); + + index = myCustomTypeInfo.GetChildPropertyIndex( "marginSpecification" ); + DALI_TEST_EQUALS( index, MARGIN_SPECIFICATION, TEST_LOCATION ); + + + auto name = customActorTypeInfo.GetChildPropertyName( WIDTH_SPECIFICATION ); + DALI_TEST_EQUALS( name, "widthSpecification", TEST_LOCATION ); + + name = customActorTypeInfo.GetChildPropertyName( HEIGHT_SPECIFICATION ); + DALI_TEST_EQUALS( name, "heightSpecification", TEST_LOCATION ); + + name = myCustomTypeInfo.GetChildPropertyName( MARGIN_SPECIFICATION ); + DALI_TEST_EQUALS( name, "marginSpecification", TEST_LOCATION ); + + + auto type = customActorTypeInfo.GetChildPropertyType( WIDTH_SPECIFICATION ); + DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION ); + + type = customActorTypeInfo.GetChildPropertyType( HEIGHT_SPECIFICATION ); + DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION ); + + type = myCustomTypeInfo.GetChildPropertyType( MARGIN_SPECIFICATION ); + DALI_TEST_EQUALS( type, Property::EXTENTS, TEST_LOCATION ); + + + END_TEST; +} + + +int UtcDaliTypeInfoRegisterChildProperties03(void) +{ + TestApplication application; + TypeRegistry typeRegistry = TypeRegistry::Get(); + + tet_infoline( "Check registered child properties can be retrieved" ); + + auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) ); + auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) ); + DALI_TEST_CHECK( customActorTypeInfo ); + DALI_TEST_CHECK( myCustomTypeInfo ); + + const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX ); + const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); + const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100); + + ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER ); + ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER ); + ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS ); + + Property::IndexContainer indices; + myCustomTypeInfo.GetChildPropertyIndices( indices ); + + auto result = std::find( indices.Begin(), indices.End(), WIDTH_SPECIFICATION ); + DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION ); + + result = std::find( indices.Begin(), indices.End(), HEIGHT_SPECIFICATION ); + DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION ); + + result = std::find( indices.Begin(), indices.End(), MARGIN_SPECIFICATION ); + DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION ); + + END_TEST; +} diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index b67b716..deedf44 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Samsung Electronics Co., Ltd. +# Copyright (c) 2018 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. @@ -88,6 +88,10 @@ if test "x$enable_debug" = "xyes"; then DALI_CFLAGS="$DALI_CFLAGS -DDEBUG_ENABLED" fi +if test "x$enable_trace" = "xyes"; then + DALI_CFLAGS="$DALI_CFLAGS -DTRACE_ENABLED" +fi + if test "x$enable_debug" = "xno" -a "x$enable_exportall" = "xno"; then DALI_CFLAGS="$DALI_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS" fi @@ -143,6 +147,7 @@ Configuration ------------- Prefix: $prefix Debug Build: $enable_debug + Trace Build: $enable_trace Data Dir (Read/Write): $dataReadWriteDir Data Dir (Read Only): $dataReadOnlyDir Backtrace: $enable_backtrace diff --git a/dali/devel-api/object/handle-devel.cpp b/dali/devel-api/object/handle-devel.cpp index 3097836..f5e8951 100644 --- a/dali/devel-api/object/handle-devel.cpp +++ b/dali/devel-api/object/handle-devel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -49,6 +49,16 @@ void SetTypeInfo( Handle& handle, const TypeInfo& typeInfo ) GetImplementation( handle ).SetTypeInfo( &GetImplementation( typeInfo ) ); } +bool DoesCustomPropertyExist( Handle& handle, Property::Index index ) +{ + return GetImplementation( handle ).DoesCustomPropertyExist( index ); +} + +PropertySetSignalType& PropertySetSignal( Handle handle ) +{ + return GetImplementation( handle ).PropertySetSignal(); +} + } // namespace DevelHandle } // namespace Dali diff --git a/dali/devel-api/object/handle-devel.h b/dali/devel-api/object/handle-devel.h index cd06a82..caae1b8 100644 --- a/dali/devel-api/object/handle-devel.h +++ b/dali/devel-api/object/handle-devel.h @@ -2,7 +2,7 @@ #define DALI_HANDLE_DEVEL_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -108,6 +108,30 @@ DALI_IMPORT_API Property::Index RegisterProperty( Handle handle, Property::Index */ DALI_IMPORT_API void SetTypeInfo( Handle& handle, const TypeInfo& typeInfo ); + +/** + * @brief Determine if the custom property index exists on this object without throwing a Dali::Exception. + * + * @note This does not check default properties. + * @param[in] handle The handle to check + * @param[in] index The index of the property to test for + */ +DALI_IMPORT_API bool DoesCustomPropertyExist( Handle& handle, Property::Index index ); + +/** + * @brief PropertySetSignal function prototype for signal handler. Called when a property is set on this object. + */ +using PropertySetSignalType = Signal< void( Handle& handle, Property::Index index, Property::Value value ) >; + +/** + * @brief Get a signal when a property is set on this object through the API (i.e. not when animating) + * + * @param[in] handle The handle of the object to listen to. + * @return The signal to attach a connection to. + */ +DALI_IMPORT_API PropertySetSignalType& PropertySetSignal( Handle handle ); + + } // namespace DevelHandle } // namespace Dali diff --git a/dali/integration-api/core.cpp b/dali/integration-api/core.cpp index be0e213..8d34ae3 100644 --- a/dali/integration-api/core.cpp +++ b/dali/integration-api/core.cpp @@ -149,6 +149,16 @@ float Core::GetStereoBase() const return mImpl->GetStereoBase(); } +void Core::RegisterProcessor( Processor& processor ) +{ + mImpl->RegisterProcessor( processor ); +} + +void Core::UnregisterProcessor( Processor& processor ) +{ + mImpl->UnregisterProcessor( processor ); +} + Core::Core() : mImpl( NULL ) { diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index 002621c..5d05e85 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_CORE_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -168,6 +168,23 @@ private: }; /** + * Interface to enable classes to be processed after the event loop. Classes are processed + * in the order they are registered. + */ +class DALI_IMPORT_API Processor +{ +public: + /** + * @brief Run the processor + */ + virtual void Process() = 0; + +protected: + virtual ~Processor() { } +}; + + +/** * Integration::Core is used for integration with the native windowing system. * The following integration tasks must be completed: * @@ -398,6 +415,20 @@ public: */ float GetStereoBase() const; + /** + * @brief Register a processor + * + * Note, Core does not take ownership of this processor. + * @param[in] processor The process to register + */ + void RegisterProcessor( Processor& processor ); + + /** + * @brief Unregister a processor + * @param[in] processor The process to unregister + */ + void UnregisterProcessor( Processor& processor ); + private: /** diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 3337f92..1931b6c 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -4,6 +4,7 @@ platform_abstraction_src_files = \ $(platform_abstraction_src_dir)/bitmap.cpp \ $(platform_abstraction_src_dir)/core.cpp \ $(platform_abstraction_src_dir)/debug.cpp \ + $(platform_abstraction_src_dir)/trace.cpp \ $(platform_abstraction_src_dir)/profiling.cpp \ $(platform_abstraction_src_dir)/input-options.cpp \ $(platform_abstraction_src_dir)/system-overlay.cpp \ @@ -27,6 +28,7 @@ platform_abstraction_header_files = \ $(platform_abstraction_src_dir)/core-enumerations.h \ $(platform_abstraction_src_dir)/context-notifier.h \ $(platform_abstraction_src_dir)/debug.h \ + $(platform_abstraction_src_dir)/trace.h \ $(platform_abstraction_src_dir)/profiling.h \ $(platform_abstraction_src_dir)/input-options.h \ $(platform_abstraction_src_dir)/bitmap.h \ diff --git a/dali/integration-api/trace.cpp b/dali/integration-api/trace.cpp new file mode 100644 index 0000000..b11777a --- /dev/null +++ b/dali/integration-api/trace.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Integration +{ + +namespace Trace +{ + +thread_local LogContextFunction gThreadLocalLogContextFunction = nullptr; + +void InstallLogContextFunction( const LogContextFunction& logContextFunction ) +{ + gThreadLocalLogContextFunction = logContextFunction; +} + +void LogContext( bool start, const char* tag ) +{ + if ( !gThreadLocalLogContextFunction ) + { + return; + } + gThreadLocalLogContextFunction( start, tag ); +} + +#ifdef TRACE_ENABLED + +typedef std::list FilterList; +typedef std::list::iterator FilterIter; + +namespace +{ + static FilterList* GetActiveFilters() + { + static FilterList* activeFilters = new FilterList; + return activeFilters; + } +} + +Filter* Filter::New( bool trace, const char * environmentVariableName ) +{ + char * environmentVariableValue = getenv( environmentVariableName ); + if ( environmentVariableValue ) + { + char envTraceString( 0 ); + sscanf( environmentVariableValue, "%c", &envTraceString ); + + // Just use 'f' and 't' as it's faster than doing full string comparisons + if ( envTraceString == 't' ) + { + trace = true; + } + else if ( envTraceString == 'f' ) + { + trace = false; + } + } + + Filter* filter = new Filter( trace ); + GetActiveFilters()->push_back( filter ); + return filter; +} + +/** + * Enable trace on all filters. + */ +void Filter::EnableGlobalTrace() +{ + for( FilterIter iter = GetActiveFilters()->begin(); iter != GetActiveFilters()->end(); iter++ ) + { + (*iter)->EnableTrace(); + } +} + +/** + * Disable trace on all filters. + */ +void Filter::DisableGlobalTrace() +{ + for( FilterIter iter = GetActiveFilters()->begin(); iter != GetActiveFilters()->end(); iter++ ) + { + (*iter)->DisableTrace(); + } +} + +/** + * Begin Trace + */ +void Filter::BeginTrace( const char* tagName ) +{ + Dali::Integration::Trace::LogContext( true, tagName ); +} + +/** + * End Trace + */ +void Filter::EndTrace( const char* tagName ) +{ + Dali::Integration::Trace::LogContext( false, tagName ); +} + +/** + * Tracer Constructor + */ +Tracer::Tracer( Filter* filter, const char* tag ) +: mTag( tag ), + mFilter( filter ) +{ + if( mFilter && mFilter->IsTraceEnabled() ) + { + mFilter->BeginTrace( mTag ); + } +} + +/** + * Tracer Destructor + */ +Tracer::~Tracer() +{ + if( mFilter && mFilter->IsTraceEnabled() ) + { + mFilter->EndTrace( mTag ); + } +} + +#endif //TRACE_ENABLED + +} // Trace + +} // Integration + +} // Dali diff --git a/dali/integration-api/trace.h b/dali/integration-api/trace.h new file mode 100644 index 0000000..804effb --- /dev/null +++ b/dali/integration-api/trace.h @@ -0,0 +1,225 @@ +#ifndef DALI_INTEGRATION_TRACE_H +#define DALI_INTEGRATION_TRACE_H + +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Integration +{ + +namespace Trace +{ + +/** + * Used by tracing macros to log a context message + * @param start a bool to indicate start (true) or end (false) of the tracing / logging + * @param tag a unique event tag name + */ +DALI_IMPORT_API void LogContext( bool start, const char* tag ); + +/** + * typedef for the LogContextFunction function. + */ +typedef void ( *LogContextFunction )( bool start, const char* tag ); + +/** + * A LogContextFunction function has to be installed for every thread that wants to use tracing. + * This should be done by the adaptor. + * The LogContextFunction function can be different for each thread. + * @param LogContextFunction the Log Context function to install + */ +DALI_IMPORT_API void InstallLogContextFunction( const LogContextFunction& logContextFunction ); + +/******************************************************************************** + * Filter * + ********************************************************************************/ + +#ifdef TRACE_ENABLED + +/** + * The Filter object is used by the DALI_TRACE_BEGIN macro and others to determine if the tracing + * should take place, and routes the tracing via the platform abstraction's LogMessage. + * + * It provides the ability to turn tracing on or off. + * + */ +class DALI_IMPORT_API Filter +{ +public: + + /** + * Test if trace is enabled for this filter. + * @return true if trace is enabled; + */ + inline bool IsTraceEnabled() { return mTraceEnabled; } + + /** + * Enable tracing on this filter. + */ + inline void EnableTrace() { mTraceEnabled = true; } + + /** + * Disable tracing on this filter. + */ + inline void DisableTrace() { mTraceEnabled = false; } + + /** + * Create a new filter whose trace can be modified through the use of an environment variable. + * + * @param[in] trace The default trace level. If true, function tracing is on. + * @param[in] environmentVariableName The environment variable name used in order to change the trace. + * + * @info To modify trace at runtime, you should define your filter as shown below: + * + * @code + * Trace::Filter* filter = Trace::Filter::New( false, "TRACE_ENV" ); + * @endcode + * + * And to use it when running an executable: + * @code + * TRACE_ENV=1 dali-demo // Trace ON + * TRACE_ENV=0 dali-demo // Trace OFF + * @endcode + */ + static Filter* New( bool trace, const char * environmentVariableName ); + + /** + * Begin trace. + * @param[in] tagName - a unique event tag name. + */ + void BeginTrace( const char* tagName ); + + /** + * End trace. + * @param[in] tagName - a unique event tag name. + */ + void EndTrace( const char* tagName ); + + /** + * Enable trace on all filters. + */ + static void EnableGlobalTrace(); + + /** + * Disable trace on all filters. + */ + static void DisableGlobalTrace(); + +private: + + /** + * Constructor. + * @param[in] trace - whether this filter allows tracing. + */ + Filter( bool trace ) : mTraceEnabled( trace ) {} + +private: + bool mTraceEnabled; +}; + +/******************************************************************************** + * Trace Macros * + ********************************************************************************/ + +/* + * These macros allow the instrumentation of methods. + */ + +/** + * The Tracer object is used by the DALI_TRACE_SCOPE and DALI_TRACE_FUNCTION macros + * and uses filter object which in tun routes the tracing via the platform abstraction's LogMessage. + * + */ +class DALI_IMPORT_API Tracer final +{ +public: + Tracer( Filter* filter, const char* tag ); + ~Tracer(); + +public: + const char* mTag; + Filter* mFilter; +}; + +/** + * For initialization of trace filter, please use DALI_INIT_TRACE_FILTER macro i.e. DALI_INIT_TRACE_FILTER( gFilter, "TRACE_COMBINED", true ); + * To start tracing, please use DALI_TRACE_BEGIN macro i.e. DALI_TRACE_BEGIN( gFilter, "RENDERING" ); + * To end tracing, please use DALI_TRACE_END macro i.e. DALI_TRACE_END( gFilter, "RENDERING" ); + * For scoped tracing, please use DALI_TRACE_SCOPE macro i.e. DALI_TRACE_SCOPE( gFilter, "RENDERING" ); + * For function tracing, please use DALI_TRACE_FUNCTION macro i.e. DALI_TRACE_FUNCTION( gFilter ); + */ + +/** + * Initialization of trace filter + * @ref Filter::New + */ +#define DALI_INIT_TRACE_FILTER( name, environmentVariableName, enable ) \ +namespace \ +{ \ + Dali::Integration::Trace::Filter* name = Dali::Integration::Trace::Filter::New( enable, #environmentVariableName ); \ +} + +/** + * Start of tracing + */ +#define DALI_TRACE_BEGIN( filter, tag ) \ + if( filter && filter->IsTraceEnabled() ) { filter->BeginTrace( tag ); } + +/** + * End of tracing + */ +#define DALI_TRACE_END( filter, tag ) \ + if( filter && filter->IsTraceEnabled() ) { filter->EndTrace( tag ); } + +/** + * Used for function tracing. It logs tracing of the fuction from start to end. + */ +#define DALI_TRACE_FUNCTION( filter ) \ + Dali::Integration::Trace::Tracer logTraceFunction( filter, __PRETTY_FUNCTION__ ); + +/** + * Used for scope tracing. It logs tracing around a scope. + */ +#define DALI_TRACE_SCOPE( filter, tag ) \ + Dali::Integration::Trace::Tracer logTracerScope( filter, tag ); + +#else // TRACE_ENABLED + +#define DALI_INIT_TRACE_FILTER( name, tag, enable ) +#define DALI_TRACE_BEGIN( filter, tag ) +#define DALI_TRACE_END( filter, tag ) +#define DALI_TRACE_FUNCTION( filter ) +#define DALI_TRACE_SCOPE( filter, tag ) + +#endif + +} // Trace + +} // Integration + +} // Dali + +#endif // DALI_INTEGRATION_TRACE_H diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 79e3e42..74549ac 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -274,6 +274,9 @@ void Core::ProcessEvents() // Run the size negotiation after event processing finished signal mRelayoutController->Relayout(); + // Run any registered processors + RunProcessors(); + // Rebuild depth tree after event processing has finished mStage->RebuildDepthTree(); @@ -322,6 +325,34 @@ void Core::SetStereoBase( float stereoBase ) mStage->SetStereoBase( stereoBase ); } +void Core::RegisterProcessor( Integration::Processor& processor ) +{ + mProcessors.PushBack(&processor); +} + +void Core::UnregisterProcessor( Integration::Processor& processor ) +{ + auto iter = std::find( mProcessors.Begin(), mProcessors.End(), &processor ); + if( iter != mProcessors.End() ) + { + mProcessors.Erase( iter ); + } +} + +void Core::RunProcessors() +{ + // Copy processor pointers to prevent changes to vector affecting loop iterator. + Dali::Vector processors( mProcessors ); + + for( auto processor : processors ) + { + if( processor ) + { + processor->Process(); + } + } +} + float Core::GetStereoBase() const { return mStage->GetStereoBase(); diff --git a/dali/internal/common/core-impl.h b/dali/internal/common/core-impl.h index 2e063e8..d4d19e2 100644 --- a/dali/internal/common/core-impl.h +++ b/dali/internal/common/core-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_CORE_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -19,6 +19,7 @@ */ // INTERNAL INCLUDES +#include #include #include #include @@ -33,6 +34,7 @@ namespace Dali namespace Integration { +class Processor; class RenderController; class PlatformAbstraction; class GestureManager; @@ -187,7 +189,24 @@ public: */ float GetStereoBase() const; -private: // for use by ThreadLocalStorage + + /** + * @copydoc Dali::Integration::Core::RegisterProcessor + */ + void RegisterProcessor( Dali::Integration::Processor& processor ); + + /** + * @copydoc Dali::Integration::Core::UnregisterProcessor + */ + void UnregisterProcessor( Dali::Integration::Processor& processor ); + +private: + /** + * Run each registered processor + */ + void RunProcessors(); + + // for use by ThreadLocalStorage /** * Returns the current stage. @@ -269,6 +288,7 @@ private: OwnerPointer mNotificationManager; ///< Notification manager OwnerPointer mGestureEventProcessor; ///< The gesture event processor OwnerPointer mEventProcessor; ///< The event processor + Dali::Vector mProcessors; ///< Registered processors (not owned) friend class ThreadLocalStorage; diff --git a/dali/internal/event/common/object-impl.cpp b/dali/internal/event/common/object-impl.cpp index 2396fd1..1663e61 100644 --- a/dali/internal/event/common/object-impl.cpp +++ b/dali/internal/event/common/object-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -23,6 +23,7 @@ // INTERNAL INCLUDES #include +#include #include #include #include @@ -423,6 +424,11 @@ Property::Type Object::GetPropertyType( Property::Index index ) const return Property::NONE; } +DevelHandle::PropertySetSignalType& Object::PropertySetSignal() +{ + return mPropertySetSignal; +} + void Object::SetProperty( Property::Index index, const Property::Value& propertyValue ) { DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds" ); @@ -523,7 +529,9 @@ void Object::SetProperty( Property::Index index, const Property::Value& property // TODO: We should not call this for read-only properties, SetDefaultProperty() && TypeInfo::SetProperty() should return a bool, which would be true if the property is set if ( propertySet ) { - OnPropertySet(index, propertyValue); + OnPropertySet( index, propertyValue ); + Dali::Handle handle( this ); + mPropertySetSignal.Emit( handle, index, propertyValue ); } } @@ -671,6 +679,12 @@ void Object::GetPropertyIndices( Property::IndexContainer& indices ) const } } +bool Object::DoesCustomPropertyExist( Property::Index index ) +{ + auto metadata = FindCustomProperty( index ); + return metadata != nullptr; +} + Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Property::Index key, Property::Index index, const Property::Value& propertyValue) const { // Create a new property diff --git a/dali/internal/event/common/object-impl.h b/dali/internal/event/common/object-impl.h index 89fc73f..7658482 100644 --- a/dali/internal/event/common/object-impl.h +++ b/dali/internal/event/common/object-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_OBJECT_H__ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,6 @@ namespace Internal { class ConstraintBase; class EventThreadServices; -class Handle; class PropertyCondition; class PropertyInputImpl; class Stage; @@ -224,6 +224,19 @@ public: virtual Property::Index RegisterProperty( const std::string& name, Property::Index key, const Property::Value& propertyValue, Property::AccessMode accessMode ); /** + * @brief returns true if the custom property exists on this object. + * + * @note The property may be defined for a type within the type registry, but it isn't explicity + * defined in every consequent instantiation. It can be automatically added, e.g. parenting an actor + * automatically registers it's parent container's child properties. + * + * @param[in] handle The handle of the object to test + * @param[in] index The property index to look for. + * @return true if the property exists on the object, false otherwise. + */ + bool DoesCustomPropertyExist( Property::Index index ); + + /** * @copydoc Dali::Handle::AddPropertyNotification() */ virtual Dali::PropertyNotification AddPropertyNotification( Property::Index index, @@ -331,6 +344,11 @@ public: */ virtual int GetPropertyComponentIndex( Property::Index index ) const; + /** + * @copydoc Dali::Handle::PropertySetSignal() + */ + DevelHandle::PropertySetSignalType& PropertySetSignal(); + protected: /** @@ -597,6 +615,7 @@ private: typedef PropertyNotificationContainer::iterator PropertyNotificationContainerIter; typedef PropertyNotificationContainer::const_iterator PropertyNotificationContainerConstIter; PropertyNotificationContainer* mPropertyNotifications; ///< Container of owned property notifications. + DevelHandle::PropertySetSignalType mPropertySetSignal; }; } // namespace Internal diff --git a/dali/internal/event/common/type-info-impl.cpp b/dali/internal/event/common/type-info-impl.cpp index e3f8d79..2b41f54 100644 --- a/dali/internal/event/common/type-info-impl.cpp +++ b/dali/internal/event/common/type-info-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -317,14 +317,34 @@ void TypeInfo::GetPropertyIndices( Property::IndexContainer& indices ) const baseImpl.GetPropertyIndices( indices ); } - if ( ! mRegisteredProperties.empty() ) + AppendProperties( indices, mRegisteredProperties ); +} + +void TypeInfo::GetChildPropertyIndices( Property::IndexContainer& indices ) const +{ + Dali::TypeInfo base = TypeRegistry::Get()->GetTypeInfo( mBaseTypeName ); + if ( base ) + { + const TypeInfo& baseImpl( GetImplementation( base ) ); + baseImpl.GetChildPropertyIndices( indices ); + } + + AppendProperties( indices, mRegisteredChildProperties ); +} + +/** + * Append the indices in RegisteredProperties to the given index container. + */ +void TypeInfo::AppendProperties( Dali::Property::IndexContainer& indices, + const TypeInfo::RegisteredPropertyContainer& registeredProperties ) const +{ + if ( ! registeredProperties.empty() ) { - indices.Reserve( indices.Size() + mRegisteredProperties.size() ); + indices.Reserve( indices.Size() + registeredProperties.size() ); - const RegisteredPropertyContainer::const_iterator endIter = mRegisteredProperties.end(); - for ( RegisteredPropertyContainer::const_iterator iter = mRegisteredProperties.begin(); iter != endIter; ++iter ) + for( auto&& elem : registeredProperties ) { - indices.PushBack( iter->first ); + indices.PushBack( elem.first ); } } } diff --git a/dali/internal/event/common/type-info-impl.h b/dali/internal/event/common/type-info-impl.h index 325f4f6..3587ede 100644 --- a/dali/internal/event/common/type-info-impl.h +++ b/dali/internal/event/common/type-info-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_TYPE_INFO_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -268,6 +268,12 @@ public: Property::Type GetChildPropertyType( Property::Index index ) const; /** + * Retrive the child indices into the given container. + * @param[in,out] indices The container to put the child indices into + */ + void GetChildPropertyIndices( Property::IndexContainer& indices ) const; + + /** * Retrieve the default value of the property at the given index. * @param[in] index The property index. * @return The default property value at that index. @@ -378,6 +384,17 @@ private: typedef std::vector< RegisteredPropertyPair > RegisteredPropertyContainer; typedef std::vector< PropertyDefaultValuePair > PropertyDefaultValueContainer; + + /** + * Append properties from registeredProperties onto indices. + * @param[in,out] indices The vector to append indices onto + * @param[in] registeredProperties The container to retrive indices from + */ + void AppendProperties( Dali::Property::IndexContainer& indices, + const TypeInfo::RegisteredPropertyContainer& registeredProperties ) const; + +private: + std::string mTypeName; std::string mBaseTypeName; bool mCSharpType:1; ///< Whether this type info is for a CSharp control (instead of C++) diff --git a/dali/internal/event/common/type-registry-impl.cpp b/dali/internal/event/common/type-registry-impl.cpp index 977cb87..66b9fcb 100644 --- a/dali/internal/event/common/type-registry-impl.cpp +++ b/dali/internal/event/common/type-registry-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -276,12 +276,12 @@ bool TypeRegistry::RegisterAnimatablePropertyComponent( TypeRegistration& typeRe return false; } -bool TypeRegistry::RegisterChildProperty( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, Property::Type type ) +bool TypeRegistry::RegisterChildProperty( const std::string& registeredType, const std::string& name, Property::Index index, Property::Type type ) { for( auto&& iter : mRegistryLut ) { auto&& impl = GetImplementation( iter ); - if( impl.GetName() == typeRegistration.RegisteredName() ) + if( impl.GetName() == registeredType ) { impl.AddChildProperty( name, index, type ); return true; @@ -291,6 +291,11 @@ bool TypeRegistry::RegisterChildProperty( TypeRegistration& typeRegistration, co return false; } +bool TypeRegistry::RegisterChildProperty( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, Property::Type type ) +{ + return RegisterChildProperty( typeRegistration.RegisteredName(), name, index, type ); +} + bool TypeRegistry::DoActionTo( BaseObject * const object, const std::string& actionName, const Property::Map& properties ) { bool done = false; diff --git a/dali/internal/event/common/type-registry-impl.h b/dali/internal/event/common/type-registry-impl.h index 47364f3..e097c76 100644 --- a/dali/internal/event/common/type-registry-impl.h +++ b/dali/internal/event/common/type-registry-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_TYPE_REGISTRY_H__ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -172,6 +172,16 @@ public: /** * Register a event-thread only property with a type and a default value + * @param [in] registeredType Name of a registered type on which to register the child property. + * @param [in] name Property name + * @param [in] index Property index + * @param [in] type Property type + * @return true if registered + */ + bool RegisterChildProperty( const std::string& registeredType, const std::string& name, Property::Index index, Property::Type type ); + + /** + * Register a event-thread only property with a type and a default value * @param [in] registered TypeRegistration object used to register the type * @param [in] name Property name * @param [in] index Property index diff --git a/dali/internal/update/rendering/scene-graph-renderer.cpp b/dali/internal/update/rendering/scene-graph-renderer.cpp index 6c93f9c..0d0f7fb 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.cpp +++ b/dali/internal/update/rendering/scene-graph-renderer.cpp @@ -373,6 +373,7 @@ void Renderer::SetShader( Shader* shader ) mShader = shader; mShader->AddConnectionObserver( *this ); mRegenerateUniformMap = REGENERATE_UNIFORM_MAP; + mResendFlag |= RESEND_GEOMETRY; if( mRenderDataProvider ) { diff --git a/dali/public-api/actors/sampling.h b/dali/public-api/actors/sampling.h old mode 100644 new mode 100755 index 65851a8..e28516a --- a/dali/public-api/actors/sampling.h +++ b/dali/public-api/actors/sampling.h @@ -100,13 +100,16 @@ enum Type namespace WrapMode { - +/** + * @brief Enumeration for Wrap mode. + * @SINCE_1_0.0 + */ enum Type { DEFAULT = 0, ///< Clamp to edge @SINCE_1_0.0 - CLAMP_TO_EDGE, - REPEAT, - MIRRORED_REPEAT + CLAMP_TO_EDGE, ///< Clamp to edge @SINCE_1_0.0 + REPEAT, ///< Repeat @SINCE_1_0.0 + MIRRORED_REPEAT ///< Mirrored repeat @SINCE_1_0.0 }; } //namespace WrapMode diff --git a/dali/public-api/common/dali-vector.h b/dali/public-api/common/dali-vector.h old mode 100644 new mode 100755 index 8d16df1..8422677 --- a/dali/public-api/common/dali-vector.h +++ b/dali/public-api/common/dali-vector.h @@ -416,9 +416,13 @@ public: // API typedef const T* ConstIterator; ///< Const iterator @SINCE_1_0.0 typedef T ItemType; ///< Item type @SINCE_1_0.0 + /** + * @brief Enumeration for BaseType. + * @SINCE_1_0.0 + */ enum { - BaseType = IsTrivialType + BaseType = IsTrivialType ///< @SINCE_1_0.0 }; /** diff --git a/dali/public-api/dali-core-version.cpp b/dali/public-api/dali-core-version.cpp index 162971e..db85503 100644 --- a/dali/public-api/dali-core-version.cpp +++ b/dali/public-api/dali-core-version.cpp @@ -28,7 +28,7 @@ namespace Dali const unsigned int CORE_MAJOR_VERSION = 1; const unsigned int CORE_MINOR_VERSION = 3; -const unsigned int CORE_MICRO_VERSION = 17; +const unsigned int CORE_MICRO_VERSION = 19; const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/dali/public-api/object/handle.h b/dali/public-api/object/handle.h index 063f0cc..f139f97 100644 --- a/dali/public-api/object/handle.h +++ b/dali/public-api/object/handle.h @@ -2,7 +2,7 @@ #define __DALI_HANDLE_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -391,7 +391,6 @@ public: * @pre The Object has been initialized. */ void RemoveConstraints( unsigned int tag ); - }; /** diff --git a/dali/public-api/object/type-info.cpp b/dali/public-api/object/type-info.cpp index 03d96dc..92f1b67 100644 --- a/dali/public-api/object/type-info.cpp +++ b/dali/public-api/object/type-info.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -101,10 +101,30 @@ const std::string& TypeInfo::GetPropertyName( Property::Index index ) const return GetImplementation(*this).GetPropertyName( index ); } +Property::Index TypeInfo::GetChildPropertyIndex( const std::string& name ) const +{ + return GetImplementation(*this).GetChildPropertyIndex( name ); +} + +const std::string& TypeInfo::GetChildPropertyName( Property::Index index ) const +{ + return GetImplementation(*this).GetChildPropertyName( index ); +} + +Property::Type TypeInfo::GetChildPropertyType( Property::Index index ) const +{ + return GetImplementation(*this).GetChildPropertyType( index ); +} + +void TypeInfo::GetChildPropertyIndices( Property::IndexContainer& indices ) const +{ + indices.Clear(); // We do not want to clear the container if called internally, so only clear here + GetImplementation(*this).GetChildPropertyIndices( indices ); +} + TypeInfo::TypeInfo(Internal::TypeInfo* internal) : BaseHandle(internal) { } } // namespace Dali - diff --git a/dali/public-api/object/type-info.h b/dali/public-api/object/type-info.h index 77de7f0..290c2b9 100644 --- a/dali/public-api/object/type-info.h +++ b/dali/public-api/object/type-info.h @@ -2,7 +2,7 @@ #define __DALI_TYPE_INFO_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -205,6 +205,15 @@ public: void GetPropertyIndices( Property::IndexContainer& indices ) const; /** + * @brief Retrieves all the child property indices for this type. + * + * @SINCE_1_3.20 + * @param[out] indices Container of property indices + * @note The container will be cleared + */ + void GetChildPropertyIndices( Property::IndexContainer& indices ) const; + + /** * @brief Given a property index, retrieve the property name associated with it. * * @SINCE_1_0.0 @@ -215,6 +224,36 @@ public: */ const std::string& GetPropertyName( Property::Index index ) const; + + /** + * @brief Given a child property name, retrieve the property index associated with it, + * + * @SINCE_1_3.20 + * @param[in] name The name of the property at the given index, + * @return The property index or Property::INVALID_INDEX + */ + Property::Index GetChildPropertyIndex( const std::string& name ) const; + + /** + * @brief Given a child property index, retrieve the property name associated with it. + * + * @SINCE_1_3.20 + * @param[in] index The property index + * @return The name of the property at the given index, or empty string if it does not exist + */ + const std::string& GetChildPropertyName( Property::Index index ) const; + + /** + * @brief Given a child property index, retrieve the property name associated with it. + * + * @SINCE_1_3.20 + * @param[in] index The property index + * @return The name of the property at the given index, or empty string if it does not exist + */ + Property::Type GetChildPropertyType( Property::Index index ) const; + + + public: // Not intended for application developers /// @cond internal diff --git a/dali/public-api/object/type-registry.cpp b/dali/public-api/object/type-registry.cpp index f28bb39..ed1bb70 100644 --- a/dali/public-api/object/type-registry.cpp +++ b/dali/public-api/object/type-registry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -163,4 +163,12 @@ ChildPropertyRegistration::ChildPropertyRegistration( TypeRegistration& register Internal::TypeRegistry::Get()->RegisterChildProperty( registered, name, index, type ); } +ChildPropertyRegistration::ChildPropertyRegistration( const std::string& registered, const std::string& name, Property::Index index, Property::Type type ) +{ + DALI_ASSERT_ALWAYS( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) ); + + Internal::TypeRegistry::Get()->RegisterChildProperty( registered, name, index, type ); +} + + } // namespace Dali diff --git a/dali/public-api/object/type-registry.h b/dali/public-api/object/type-registry.h index a34b89d..3c7574b 100644 --- a/dali/public-api/object/type-registry.h +++ b/dali/public-api/object/type-registry.h @@ -2,7 +2,7 @@ #define __DALI_TYPE_REGISTRY_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -401,6 +401,19 @@ public: * @pre "registered" must be registered with the TypeRegistry. */ ChildPropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type ); + + /** + * @brief This constructor registers an event-thread only child property (i.e. a property + * that the parent supports in its children) with the registered type. + * + * @SINCE_1_3.20 + * @param[in] registered The name of the registered type + * @param[in] name The name of the property + * @param[in] index The property index. Must be a value between CHILD_PROPERTY_REGISTRATION_START_INDEX and CHILD_PROPERTY_REGISTRATION_MAX_INDEX inclusive + * @param[in] type The property value type + * @pre "registered" must be registered with the TypeRegistry. + */ + ChildPropertyRegistration( const std::string& registered, const std::string& name, Property::Index index, Property::Type type ); }; diff --git a/packaging/dali.spec b/packaging/dali.spec index 33ff7c5..9e3f1b2 100644 --- a/packaging/dali.spec +++ b/packaging/dali.spec @@ -1,6 +1,6 @@ Name: dali Summary: DALi 3D Engine -Version: 1.3.17 +Version: 1.3.19 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT @@ -149,6 +149,9 @@ LDFLAGS="${LDFLAGS:-%optflags}" ; export LDFLAGS; %if 0%{?enable_debug} --enable-debug \ %endif +%if 0%{?enable_trace} + --enable-trace \ +%endif --infodir=%{_infodir} \ --enable-rename-so=no @@ -185,6 +188,9 @@ make clean %if 0%{?enable_debug} --enable-debug \ %endif +%if 0%{?enable_trace} + --enable-trace \ +%endif --infodir=%{_infodir} \ --enable-rename-so=no