IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
-SpacesInConditionalStatement : true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true
CommentPragmas: '^ IWYU pragma:'
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
-MacroBlockBegin: ''
-MacroBlockEnd: ''
+MacroBlockBegin: '^DALI_ENUM_TO_STRING_TABLE_BEGIN'
+MacroBlockEnd: 'DALI_ENUM_TO_STRING_TABLE_END'
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
-PointerAlignment: Right
+PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
+SpacesInConditionalStatement : false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace DevelActor
{
-
-Rect<> CalculateScreenExtents( Actor actor )
+Rect<> CalculateScreenExtents(Actor actor)
{
- return GetImplementation( actor ).CalculateScreenExtents();
+ return GetImplementation(actor).CalculateScreenExtents();
}
-VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor )
+VisibilityChangedSignalType& VisibilityChangedSignal(Actor actor)
{
- return GetImplementation( actor ).VisibilityChangedSignal();
+ return GetImplementation(actor).VisibilityChangedSignal();
}
-ChildChangedSignalType& ChildAddedSignal( Actor actor )
+ChildChangedSignalType& ChildAddedSignal(Actor actor)
{
- return GetImplementation( actor ).ChildAddedSignal();
+ return GetImplementation(actor).ChildAddedSignal();
}
-ChildChangedSignalType& ChildRemovedSignal( Actor actor )
+ChildChangedSignalType& ChildRemovedSignal(Actor actor)
{
- return GetImplementation( actor ).ChildRemovedSignal();
+ return GetImplementation(actor).ChildRemovedSignal();
}
-ChildOrderChangedSignalType& ChildOrderChangedSignal( Actor actor )
+ChildOrderChangedSignalType& ChildOrderChangedSignal(Actor actor)
{
- return GetImplementation( actor ).ChildOrderChangedSignal();
+ return GetImplementation(actor).ChildOrderChangedSignal();
}
-
-
} // namespace DevelActor
} // namespace Dali
namespace Dali
{
-
namespace DevelActor
{
-
namespace Property
{
-
enum Type
{
- PARENT_ORIGIN = Dali::Actor::Property::PARENT_ORIGIN,
- PARENT_ORIGIN_X = Dali::Actor::Property::PARENT_ORIGIN_X,
- PARENT_ORIGIN_Y = Dali::Actor::Property::PARENT_ORIGIN_Y,
- PARENT_ORIGIN_Z = Dali::Actor::Property::PARENT_ORIGIN_Z,
- ANCHOR_POINT = Dali::Actor::Property::ANCHOR_POINT,
- ANCHOR_POINT_X = Dali::Actor::Property::ANCHOR_POINT_X,
- ANCHOR_POINT_Y = Dali::Actor::Property::ANCHOR_POINT_Y,
- ANCHOR_POINT_Z = Dali::Actor::Property::ANCHOR_POINT_Z,
- SIZE = Dali::Actor::Property::SIZE,
- SIZE_WIDTH = Dali::Actor::Property::SIZE_WIDTH,
- SIZE_HEIGHT = Dali::Actor::Property::SIZE_HEIGHT,
- SIZE_DEPTH = Dali::Actor::Property::SIZE_DEPTH,
- POSITION = Dali::Actor::Property::POSITION,
- POSITION_X = Dali::Actor::Property::POSITION_X,
- POSITION_Y = Dali::Actor::Property::POSITION_Y,
- POSITION_Z = Dali::Actor::Property::POSITION_Z,
- WORLD_POSITION = Dali::Actor::Property::WORLD_POSITION,
- WORLD_POSITION_X = Dali::Actor::Property::WORLD_POSITION_X,
- WORLD_POSITION_Y = Dali::Actor::Property::WORLD_POSITION_Y,
- WORLD_POSITION_Z = Dali::Actor::Property::WORLD_POSITION_Z,
- ORIENTATION = Dali::Actor::Property::ORIENTATION,
- WORLD_ORIENTATION = Dali::Actor::Property::WORLD_ORIENTATION,
- SCALE = Dali::Actor::Property::SCALE,
- SCALE_X = Dali::Actor::Property::SCALE_X,
- SCALE_Y = Dali::Actor::Property::SCALE_Y,
- SCALE_Z = Dali::Actor::Property::SCALE_Z,
- WORLD_SCALE = Dali::Actor::Property::WORLD_SCALE,
- VISIBLE = Dali::Actor::Property::VISIBLE,
- COLOR = Dali::Actor::Property::COLOR,
- COLOR_RED = Dali::Actor::Property::COLOR_RED,
- COLOR_GREEN = Dali::Actor::Property::COLOR_GREEN,
- COLOR_BLUE = Dali::Actor::Property::COLOR_BLUE,
- COLOR_ALPHA = Dali::Actor::Property::COLOR_ALPHA,
- WORLD_COLOR = Dali::Actor::Property::WORLD_COLOR,
- WORLD_MATRIX = Dali::Actor::Property::WORLD_MATRIX,
- NAME = Dali::Actor::Property::NAME,
- SENSITIVE = Dali::Actor::Property::SENSITIVE,
- LEAVE_REQUIRED = Dali::Actor::Property::LEAVE_REQUIRED,
- INHERIT_ORIENTATION = Dali::Actor::Property::INHERIT_ORIENTATION,
- INHERIT_SCALE = Dali::Actor::Property::INHERIT_SCALE,
- COLOR_MODE = Dali::Actor::Property::COLOR_MODE,
- DRAW_MODE = Dali::Actor::Property::DRAW_MODE,
- SIZE_MODE_FACTOR = Dali::Actor::Property::SIZE_MODE_FACTOR,
- WIDTH_RESIZE_POLICY = Dali::Actor::Property::WIDTH_RESIZE_POLICY,
- HEIGHT_RESIZE_POLICY = Dali::Actor::Property::HEIGHT_RESIZE_POLICY,
- SIZE_SCALE_POLICY = Dali::Actor::Property::SIZE_SCALE_POLICY,
- WIDTH_FOR_HEIGHT = Dali::Actor::Property::WIDTH_FOR_HEIGHT,
- HEIGHT_FOR_WIDTH = Dali::Actor::Property::HEIGHT_FOR_WIDTH,
- PADDING = Dali::Actor::Property::PADDING,
- MINIMUM_SIZE = Dali::Actor::Property::MINIMUM_SIZE,
- MAXIMUM_SIZE = Dali::Actor::Property::MAXIMUM_SIZE,
- INHERIT_POSITION = Dali::Actor::Property::INHERIT_POSITION,
- CLIPPING_MODE = Dali::Actor::Property::CLIPPING_MODE,
- LAYOUT_DIRECTION = Dali::Actor::Property::LAYOUT_DIRECTION,
- INHERIT_LAYOUT_DIRECTION = Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION,
- OPACITY = Dali::Actor::Property::OPACITY,
- SCREEN_POSITION = Dali::Actor::Property::SCREEN_POSITION,
- POSITION_USES_ANCHOR_POINT = Dali::Actor::Property::POSITION_USES_ANCHOR_POINT,
- CULLED = Dali::Actor::Property::CULLED,
- ID = Dali::Actor::Property::ID,
- HIERARCHY_DEPTH = Dali::Actor::Property::HIERARCHY_DEPTH,
- IS_ROOT = Dali::Actor::Property::IS_ROOT,
- IS_LAYER = Dali::Actor::Property::IS_LAYER,
- CONNECTED_TO_SCENE = Dali::Actor::Property::CONNECTED_TO_SCENE,
- KEYBOARD_FOCUSABLE = Dali::Actor::Property::KEYBOARD_FOCUSABLE,
+ PARENT_ORIGIN = Dali::Actor::Property::PARENT_ORIGIN,
+ PARENT_ORIGIN_X = Dali::Actor::Property::PARENT_ORIGIN_X,
+ PARENT_ORIGIN_Y = Dali::Actor::Property::PARENT_ORIGIN_Y,
+ PARENT_ORIGIN_Z = Dali::Actor::Property::PARENT_ORIGIN_Z,
+ ANCHOR_POINT = Dali::Actor::Property::ANCHOR_POINT,
+ ANCHOR_POINT_X = Dali::Actor::Property::ANCHOR_POINT_X,
+ ANCHOR_POINT_Y = Dali::Actor::Property::ANCHOR_POINT_Y,
+ ANCHOR_POINT_Z = Dali::Actor::Property::ANCHOR_POINT_Z,
+ SIZE = Dali::Actor::Property::SIZE,
+ SIZE_WIDTH = Dali::Actor::Property::SIZE_WIDTH,
+ SIZE_HEIGHT = Dali::Actor::Property::SIZE_HEIGHT,
+ SIZE_DEPTH = Dali::Actor::Property::SIZE_DEPTH,
+ POSITION = Dali::Actor::Property::POSITION,
+ POSITION_X = Dali::Actor::Property::POSITION_X,
+ POSITION_Y = Dali::Actor::Property::POSITION_Y,
+ POSITION_Z = Dali::Actor::Property::POSITION_Z,
+ WORLD_POSITION = Dali::Actor::Property::WORLD_POSITION,
+ WORLD_POSITION_X = Dali::Actor::Property::WORLD_POSITION_X,
+ WORLD_POSITION_Y = Dali::Actor::Property::WORLD_POSITION_Y,
+ WORLD_POSITION_Z = Dali::Actor::Property::WORLD_POSITION_Z,
+ ORIENTATION = Dali::Actor::Property::ORIENTATION,
+ WORLD_ORIENTATION = Dali::Actor::Property::WORLD_ORIENTATION,
+ SCALE = Dali::Actor::Property::SCALE,
+ SCALE_X = Dali::Actor::Property::SCALE_X,
+ SCALE_Y = Dali::Actor::Property::SCALE_Y,
+ SCALE_Z = Dali::Actor::Property::SCALE_Z,
+ WORLD_SCALE = Dali::Actor::Property::WORLD_SCALE,
+ VISIBLE = Dali::Actor::Property::VISIBLE,
+ COLOR = Dali::Actor::Property::COLOR,
+ COLOR_RED = Dali::Actor::Property::COLOR_RED,
+ COLOR_GREEN = Dali::Actor::Property::COLOR_GREEN,
+ COLOR_BLUE = Dali::Actor::Property::COLOR_BLUE,
+ COLOR_ALPHA = Dali::Actor::Property::COLOR_ALPHA,
+ WORLD_COLOR = Dali::Actor::Property::WORLD_COLOR,
+ WORLD_MATRIX = Dali::Actor::Property::WORLD_MATRIX,
+ NAME = Dali::Actor::Property::NAME,
+ SENSITIVE = Dali::Actor::Property::SENSITIVE,
+ LEAVE_REQUIRED = Dali::Actor::Property::LEAVE_REQUIRED,
+ INHERIT_ORIENTATION = Dali::Actor::Property::INHERIT_ORIENTATION,
+ INHERIT_SCALE = Dali::Actor::Property::INHERIT_SCALE,
+ COLOR_MODE = Dali::Actor::Property::COLOR_MODE,
+ DRAW_MODE = Dali::Actor::Property::DRAW_MODE,
+ SIZE_MODE_FACTOR = Dali::Actor::Property::SIZE_MODE_FACTOR,
+ WIDTH_RESIZE_POLICY = Dali::Actor::Property::WIDTH_RESIZE_POLICY,
+ HEIGHT_RESIZE_POLICY = Dali::Actor::Property::HEIGHT_RESIZE_POLICY,
+ SIZE_SCALE_POLICY = Dali::Actor::Property::SIZE_SCALE_POLICY,
+ WIDTH_FOR_HEIGHT = Dali::Actor::Property::WIDTH_FOR_HEIGHT,
+ HEIGHT_FOR_WIDTH = Dali::Actor::Property::HEIGHT_FOR_WIDTH,
+ PADDING = Dali::Actor::Property::PADDING,
+ MINIMUM_SIZE = Dali::Actor::Property::MINIMUM_SIZE,
+ MAXIMUM_SIZE = Dali::Actor::Property::MAXIMUM_SIZE,
+ INHERIT_POSITION = Dali::Actor::Property::INHERIT_POSITION,
+ CLIPPING_MODE = Dali::Actor::Property::CLIPPING_MODE,
+ LAYOUT_DIRECTION = Dali::Actor::Property::LAYOUT_DIRECTION,
+ INHERIT_LAYOUT_DIRECTION = Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION,
+ OPACITY = Dali::Actor::Property::OPACITY,
+ SCREEN_POSITION = Dali::Actor::Property::SCREEN_POSITION,
+ POSITION_USES_ANCHOR_POINT = Dali::Actor::Property::POSITION_USES_ANCHOR_POINT,
+ CULLED = Dali::Actor::Property::CULLED,
+ ID = Dali::Actor::Property::ID,
+ HIERARCHY_DEPTH = Dali::Actor::Property::HIERARCHY_DEPTH,
+ IS_ROOT = Dali::Actor::Property::IS_ROOT,
+ IS_LAYER = Dali::Actor::Property::IS_LAYER,
+ CONNECTED_TO_SCENE = Dali::Actor::Property::CONNECTED_TO_SCENE,
+ KEYBOARD_FOCUSABLE = Dali::Actor::Property::KEYBOARD_FOCUSABLE,
/**
* @brief Sets the sibling order of the actor so depth position can be defined within the same parent.
namespace VisibilityChange
{
-
enum Type
{
- SELF, ///< The visibility of the actor itself has changed.
- PARENT ///< The visibility of a parent has changed.
+ SELF, ///< The visibility of the actor itself has changed.
+ PARENT ///< The visibility of a parent has changed.
};
} // namespace VisibilityChange
-using VisibilityChangedSignalType = Signal<void( Actor, bool, VisibilityChange::Type )>; ///< Signal type of VisibilityChangedSignalType
+using VisibilityChangedSignalType = Signal<void(Actor, bool, VisibilityChange::Type)>; ///< Signal type of VisibilityChangedSignalType
/**
* @brief This signal is emitted when the visible property of this or a parent actor is changed.
* @pre The Actor has been initialized.
* @note This signal is NOT emitted if the actor becomes transparent (or the reverse), it's only linked with Actor::Property::VISIBLE.
*/
-DALI_CORE_API VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor );
+DALI_CORE_API VisibilityChangedSignalType& VisibilityChangedSignal(Actor actor);
/**
* Calculates screen position and size.
*
* @return pair of two values, position of top-left corner on screen and size respectively.
*/
-DALI_CORE_API Rect<> CalculateScreenExtents( Actor actor );
+DALI_CORE_API Rect<> CalculateScreenExtents(Actor actor);
-using ChildChangedSignalType = Signal<void( Actor )>; ///< Called when the actor has a child added or removed
+using ChildChangedSignalType = Signal<void(Actor)>; ///< Called when the actor has a child added or removed
/**
* @brief This signal is emitted when a child is added to this actor.
* @return The signal to connect to
* @pre The Actor has been initialized
*/
-DALI_CORE_API ChildChangedSignalType& ChildAddedSignal( Actor actor );
+DALI_CORE_API ChildChangedSignalType& ChildAddedSignal(Actor actor);
/**
* @brief This signal is emitted when a child is removed from this actor.
* @return The signal to connect to
* @pre The Actor has been initialized
*/
-DALI_CORE_API ChildChangedSignalType& ChildRemovedSignal( Actor actor );
+DALI_CORE_API ChildChangedSignalType& ChildRemovedSignal(Actor actor);
-using ChildOrderChangedSignalType = Signal<void( Actor )>; ///< Used when the actor's children have changed order
+using ChildOrderChangedSignalType = Signal<void(Actor)>; ///< Used when the actor's children have changed order
/**
* @brief This signal is emitted when an actor's children change their sibling order
* @return The signal to connect to
* @pre The Actor has been initialized
*/
-DALI_CORE_API ChildOrderChangedSignalType& ChildOrderChangedSignal( Actor actor );
-
-
+DALI_CORE_API ChildOrderChangedSignalType& ChildOrderChangedSignal(Actor actor);
} // namespace DevelActor
};
} // Namespace Property
-} // Namesapce DevelCameraActor
+} // namespace DevelCameraActor
} // Namespace Dali
#endif // DALI_CAMERA_ACTOR_DEVEL_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace DevelCustomActor
{
-
-const Dali::TypeInfo GetTypeInfo( CustomActor actor )
+const Dali::TypeInfo GetTypeInfo(CustomActor actor)
{
return actor.GetImplementation().GetOwner()->GetTypeInfo();
}
#define DALI_CUSTOM_ACTOR_DEVEL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace DevelCustomActor
{
-
/**
* Get the type info for the CustomActor.
* This is useful when the type information has been set via
* @param[in] actor The custom actor of which to get the type information
* @return the TypeInfo of this actor
*/
-DALI_CORE_API const Dali::TypeInfo GetTypeInfo( CustomActor actor );
+DALI_CORE_API const Dali::TypeInfo GetTypeInfo(CustomActor actor);
} // namespace DevelCustomActor
#define DALI_LAYER_DEVEL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace DevelLayer
{
-
- /**
+/**
* @brief ACTOR_DEPTH_MULTIPLIER is used by the rendering sorting algorithm to decide which actors to render first.
* @SINCE_1_0.0
*/
- enum ActorDepthMultiplier
- {
- ACTOR_DEPTH_MULTIPLIER = 1000000,
- };
+enum ActorDepthMultiplier
+{
+ ACTOR_DEPTH_MULTIPLIER = 1000000,
+};
- /**
+/**
* @brief SIBLING_ORDER_MULTIPLIER is used by the rendering sorting algorithm to decide which actors to render first.
* @SINCE_1_2.16
*/
- enum SiblingOrderMultiplier
- {
- SIBLING_ORDER_MULTIPLIER = 1000,
- };
+enum SiblingOrderMultiplier
+{
+ SIBLING_ORDER_MULTIPLIER = 1000,
+};
-}
+} // namespace DevelLayer
-}
+} // namespace Dali
-#endif //DALI_LAYER_DEVEL_H
+#endif //DALI_LAYER_DEVEL_H
*
*/
-#include <dali/integration-api/addon-manager.h>
#include <dali/devel-api/addons/addon-dispatch-table.h>
+#include <dali/integration-api/addon-manager.h>
#include <vector>
namespace Dali
{
namespace AddOns
{
-
/**
* @class AddOnBase
*
class AddOnBase
{
protected:
-
/**
* @brief Constructor
*/
}
public:
-
/**
* @brief Destructor
*/
* @brief Retrieves AddOn info
* @param[out] addonInfo AddOnInfo structure to fill by the function
*/
- virtual void GetAddOnInfo( Dali::AddOnInfo& addonInfo ) = 0;
+ virtual void GetAddOnInfo(Dali::AddOnInfo& addonInfo) = 0;
/**
* @brief Returns a dispatch table for global functions.
* @brief OnStart event.
* It's optional and should be implemented by the AddOn when it's required to handle the event.
*/
- virtual void OnStart() {}
+ virtual void OnStart()
+ {
+ }
/**
* @brief OnResume event.
* It's optional and should be implemented by the AddOn when it's required to handle the event.
*/
- virtual void OnResume() {}
+ virtual void OnResume()
+ {
+ }
/**
* @brief OnPause event.
* It's optional and should be implemented by the AddOn when it's required to handle the event.
*/
- virtual void OnPause() {}
+ virtual void OnPause()
+ {
+ }
/**
* @brief OnStop event.
* It's optional and should be implemented by the AddOn when it's required to handle the event.
*/
- virtual void OnStop() {}
+ virtual void OnStop()
+ {
+ }
/**
* @brief Getter of static singleton
}
private:
-
static AddOnBase* mSingleton;
};
* @param[out] info Reference to AddOnInfo structure
*/
template<class T>
-void GetAddOnInfo( Dali::AddOnInfo& info )
+void GetAddOnInfo(Dali::AddOnInfo& info)
{
auto* addon = Dali::AddOns::AddOnBase::Get();
- addon->GetAddOnInfo( info );
+ addon->GetAddOnInfo(info);
}
/**
* @return Valid pointer or nullptr if function not found.
*/
template<class T>
-void* GetGlobalProc( const char* funcname )
+void* GetGlobalProc(const char* funcname)
{
- if( !funcname )
+ if(!funcname)
{
return nullptr;
}
auto* addon = Dali::AddOns::AddOnBase::Get();
// AddOn must be initialised up to this point!
- if( !addon )
+ if(!addon)
{
return nullptr;
}
static Dali::AddOns::DispatchTable* globalDispatchTable = addon->GetGlobalDispatchTable();
- if( globalDispatchTable )
+ if(globalDispatchTable)
{
- return globalDispatchTable->Find( funcname );
+ return globalDispatchTable->Find(funcname);
}
return nullptr;
}
* @return Valid pointer or nullptr if function not found.
*/
template<class T>
-void* GetInstanceProc( const char* funcname )
+void* GetInstanceProc(const char* funcname)
{
- if( !funcname )
+ if(!funcname)
{
return nullptr;
}
auto* addon = Dali::AddOns::AddOnBase::Get();
// AddOn must be initialised up to this point!
- if( !addon )
+ if(!addon)
{
return nullptr;
}
static Dali::AddOns::DispatchTable* instanceDispatchTable = addon->GetInstanceDispatchTable();
- if( instanceDispatchTable )
+ if(instanceDispatchTable)
{
- return instanceDispatchTable->Find( funcname );
+ return instanceDispatchTable->Find(funcname);
}
return nullptr;
}
auto* addon = Dali::AddOns::CreateAddOn();
Dali::AddOnInfo info{};
- addon->GetAddOnInfo( info );
+ addon->GetAddOnInfo(info);
// Generate dispatch tables
addon->GetGlobalDispatchTable();
// Bind basic functions
Dali::AddOnDispatchTable table;
- table.name = info.name;
- table.GetAddOnInfo = GetAddOnInfo<void>;
- table.GetGlobalProc = GetGlobalProc<void>;
+ table.name = info.name;
+ table.GetAddOnInfo = GetAddOnInfo<void>;
+ table.GetGlobalProc = GetGlobalProc<void>;
table.GetInstanceProc = GetInstanceProc<void>;
- table.OnStart = OnStart<void>;
- table.OnStop = OnStop<void>;
- table.OnResume = OnResume<void>;
- table.OnPause = OnPause<void>;
+ table.OnStart = OnStart<void>;
+ table.OnStop = OnStop<void>;
+ table.OnResume = OnResume<void>;
+ table.OnPause = OnPause<void>;
// Register dispatch table
- Dali::Integration::AddOnManager::Get()->RegisterAddOnDispatchTable( &table );
+ Dali::Integration::AddOnManager::Get()->RegisterAddOnDispatchTable(&table);
}
} // namespace AddOns
* Note: The macro requires GCC/Clang compiler and currently only Linux-based environment
* is supported.
*/
-#define REGISTER_ADDON_CLASS( ADDON_CLASS_WITH_FULL_NAMESPACE ) \
-namespace Dali { namespace AddOns { \
-__attribute__((constructor)) void AddOnConstructor() { \
- AddOnConstructorInternal();\
-}\
-AddOnBase* AddOnBase::mSingleton = nullptr; \
-AddOnBase* CreateAddOn() \
-{\
- return new ADDON_CLASS_WITH_FULL_NAMESPACE();\
-}\
-}}
+#define REGISTER_ADDON_CLASS(ADDON_CLASS_WITH_FULL_NAMESPACE) \
+ namespace Dali \
+ { \
+ namespace AddOns \
+ { \
+ __attribute__((constructor)) void AddOnConstructor() \
+ { \
+ AddOnConstructorInternal(); \
+ } \
+ AddOnBase* AddOnBase::mSingleton = nullptr; \
+ AddOnBase* CreateAddOn() \
+ { \
+ return new ADDON_CLASS_WITH_FULL_NAMESPACE(); \
+ } \
+ } \
+ }
#endif // DALI_ADDON_BASE_H
*
*/
+#include <string>
+#include <algorithm>
+#include <dali/public-api/common/vector-wrapper.h>
+
namespace Dali
{
namespace AddOns
{
-
/**
* DispatchTable contains essential function pointers
* needed to register the AddOn with AddOnManager.
* @return Reference to self
*/
template<class T>
- Entry &operator=(T funcPtr)
+ Entry& operator=(T funcPtr)
{
- functionPtr = reinterpret_cast<void *>( funcPtr );
- if (index < 0)
+ functionPtr = reinterpret_cast<void*>(funcPtr);
+ if(index < 0)
{
index = int32_t(table->entries.size());
table->entries.emplace_back(*this);
}
else
{
- table->entries[index].functionPtr = reinterpret_cast<void *>( funcPtr );
+ table->entries[index].functionPtr = reinterpret_cast<void*>(funcPtr);
}
return *this;
}
- std::string functionName{}; ///< Name of function
- void* functionPtr{nullptr}; ///< Function pointer
- DispatchTable* table{nullptr}; ///< DispatchTable associated with entry
- int32_t index = -1; ///< Index within the dispatch table
+ std::string functionName{}; ///< Name of function
+ void* functionPtr{nullptr}; ///< Function pointer
+ DispatchTable* table{nullptr}; ///< DispatchTable associated with entry
+ int32_t index = -1; ///< Index within the dispatch table
};
/**
* @param[in] functionName name of function
* @return Returns Entry object
*/
- Entry operator[](const char *functionName)
+ Entry operator[](const char* functionName)
{
- auto iter = std::find_if(entries.begin(), entries.end(), [functionName](Entry &entry)
- {
- if (entry.functionName == functionName)
+ auto iter = std::find_if(entries.begin(), entries.end(), [functionName](Entry& entry) {
+ if(entry.functionName == functionName)
{
return true;
}
return false;
});
- if (iter == entries.end())
+
+ if(iter == entries.end())
{
Entry retval;
retval.table = this;
* @param[in] funcName Name of function
* @return valid pointer or nullptr if function not found
*/
- FunctionPointer Find(const char *funcName)
+ FunctionPointer Find(const char* funcName)
{
- if (entries.empty())
+ if(entries.empty())
{
return nullptr;
}
- auto iter = std::find_if(entries.begin(), entries.end(), [funcName, entries = &this->entries](Entry &entry)
- {
+ auto iter = std::find_if(entries.begin(), entries.end(), [funcName, entries = &this->entries](Entry& entry) {
return (entry.functionName == funcName);
});
- if (iter != entries.end())
+ if(iter != entries.end())
{
return iter->functionPtr;
}
return nullptr;
}
- std::vector <Entry> entries;
+ std::vector<Entry> entries;
};
} // namespace AddOns
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
-
AnimationData::AnimationData()
{
}
Clear();
}
-
-void AnimationData::Add( AnimationDataElement* animationDataElement )
+void AnimationData::Add(AnimationDataElement* animationDataElement)
{
- mAnimationDataList.PushBack( animationDataElement );
+ mAnimationDataList.PushBack(animationDataElement);
}
-
-Dali::Animation AnimationData::CreateAnimation( Dali::Actor targetActor, float duration )
+Dali::Animation AnimationData::CreateAnimation(Dali::Actor targetActor, float duration)
{
Dali::Animation animation;
- if( mAnimationDataList.Size() > 0 )
+ if(mAnimationDataList.Size() > 0)
{
- animation = Dali::Animation::New( duration );
+ animation = Dali::Animation::New(duration);
// Setup an Animation from AnimationData.
AnimationData::AnimationDataList::Iterator end = mAnimationDataList.End();
- for( AnimationData::AnimationDataList::Iterator iter = mAnimationDataList.Begin(); iter != end; ++iter )
+ for(AnimationData::AnimationDataList::Iterator iter = mAnimationDataList.Begin(); iter != end; ++iter)
{
// Override the actor in the animation.
- animation.AnimateTo( Property( targetActor, ( *iter )->property ), ( *iter )->value,
- ( *iter )->alphaFunction, TimePeriod( ( *iter )->timePeriodDelay, ( *iter )->timePeriodDuration ) );
+ animation.AnimateTo(Property(targetActor, (*iter)->property),
+ (*iter)->value,
+ (*iter)->alphaFunction,
+ TimePeriod((*iter)->timePeriodDelay, (*iter)->timePeriodDuration));
}
}
return animation;
}
-
void AnimationData::Clear()
{
AnimationData::AnimationDataList::Iterator end = mAnimationDataList.End();
- for( AnimationData::AnimationDataList::Iterator iter = mAnimationDataList.Begin(); iter != end; ++iter )
+ for(AnimationData::AnimationDataList::Iterator iter = mAnimationDataList.Begin(); iter != end; ++iter)
{
- delete ( *iter );
+ delete(*iter);
}
mAnimationDataList.Clear();
}
-
} // namespace Dali
#define DALI_ANIMATION_DATA_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
/**
* @brief This object stores description data that can be used to generate an Animation.
* This data can be produced from passing JSON.
class DALI_CORE_API AnimationData
{
public:
-
AnimationData();
~AnimationData();
*/
struct AnimationDataElement
{
- std::string actor;
- std::string property;
- Property::Value value;
+ std::string actor;
+ std::string property;
+ Property::Value value;
AlphaFunction::BuiltinFunction alphaFunction;
- float timePeriodDelay;
- float timePeriodDuration;
+ float timePeriodDelay;
+ float timePeriodDuration;
AnimationDataElement()
- : alphaFunction( AlphaFunction::DEFAULT ),
- timePeriodDelay( 0.0f ),
- timePeriodDuration( 1.0f )
+ : alphaFunction(AlphaFunction::DEFAULT),
+ timePeriodDelay(0.0f),
+ timePeriodDuration(1.0f)
{
}
};
-
/**
* @brief AnimationData holds the required data required to define an
* animation to be performed on an actor or actors.
* @param[in] animationDataElement A pre-populated struct to add
* @note This class takes ownership of animationDataElement
*/
- void Add( AnimationDataElement* animationDataElement );
-
+ void Add(AnimationDataElement* animationDataElement);
/**
* @brief Creates a Dali::Animation from this AnimationData object.
* @param[in] duration The duration of the animation to create.
* @return A ready-to-go Dali::Animation, or an invalid handle if there was no data.
*/
- Dali::Animation CreateAnimation( Dali::Actor targetActor, float duration );
-
+ Dali::Animation CreateAnimation(Dali::Actor targetActor, float duration);
/**
* @brief Empties this AnimationData object (and frees all memory).
void Clear();
private:
-
AnimationDataList mAnimationDataList; ///< A vector of individual property animations from which to generate a Dali::Animation.
-
};
-
} // namespace Dali
#endif // DALI_ANIMATION_DATA_H
-
// INTERNAL INCLUDES
#include <dali/devel-api/animation/animation-devel.h>
#include <dali/internal/event/animation/animation-impl.h>
-#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/animation/animation-playlist.h>
+#include <dali/internal/event/common/thread-local-storage.h>
namespace Dali
{
-
namespace DevelAnimation
{
-
-void SetProgressNotification( Animation animation, float progress )
+void SetProgressNotification(Animation animation, float progress)
{
- GetImplementation(animation).SetProgressNotification( progress );
+ GetImplementation(animation).SetProgressNotification(progress);
}
-float GetProgressNotification( Animation animation )
+float GetProgressNotification(Animation animation)
{
return GetImplementation(animation).GetProgressNotification();
}
-Animation::AnimationSignalType& ProgressReachedSignal( Animation animation )
+Animation::AnimationSignalType& ProgressReachedSignal(Animation animation)
{
- return GetImplementation( animation ).ProgressReachedSignal();
+ return GetImplementation(animation).ProgressReachedSignal();
}
uint32_t GetAnimationCount()
return tls.GetAnimationPlaylist().GetAnimationCount();
}
-Animation GetAnimationAt( uint32_t index )
+Animation GetAnimationAt(uint32_t index)
{
Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();
- return tls.GetAnimationPlaylist().GetAnimationAt( index );
+ return tls.GetAnimationPlaylist().GetAnimationAt(index);
}
} // namespace DevelAnimation
namespace Dali
{
-
namespace DevelAnimation
{
-
/**
* @brief Set progress percentage marker to trigger ProgressHasBeenReachedSignal
*
* @param[in] animation the animation object to perform this operation on
* @param[in] progress the progress percentage to trigger the signal at, e.g .3 for 30%.
*/
-DALI_CORE_API void SetProgressNotification( Animation animation, float progress );
+DALI_CORE_API void SetProgressNotification(Animation animation, float progress);
/**
* @brief Get progress percentage marker that has been set to trigger ProgressHasBeenReachedSignal
* @param[in] animation the animation object to perform this operation on
* @return the percentage to trigger at eg 0.3 for 30%
*/
-DALI_CORE_API float GetProgressNotification( Animation animation );
+DALI_CORE_API float GetProgressNotification(Animation animation);
/**
* @brief Connects to this signal to be notified when an Animation's animations have reached set progress.
*
* @return A signal object to connect with
*/
-DALI_CORE_API Animation::AnimationSignalType& ProgressReachedSignal( Animation animation );
+DALI_CORE_API Animation::AnimationSignalType& ProgressReachedSignal(Animation animation);
/**
* @brief Retrive the number of Animations.
* @param[in] index The index of the Animation to retrieve
* @return The animation for the given index or empty handle
*/
-DALI_CORE_API Animation GetAnimationAt( uint32_t index );
+DALI_CORE_API Animation GetAnimationAt(uint32_t index);
} // namespace DevelAnimation
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
PathConstrainer PathConstrainer::New()
{
Internal::PathConstrainer* internal = Internal::PathConstrainer::New();
return PathConstrainer(internal);
}
-PathConstrainer PathConstrainer::DownCast( BaseHandle handle )
+PathConstrainer PathConstrainer::DownCast(BaseHandle handle)
{
- return PathConstrainer( dynamic_cast<Dali::Internal::PathConstrainer*>(handle.GetObjectPtr()) );
+ return PathConstrainer(dynamic_cast<Dali::Internal::PathConstrainer*>(handle.GetObjectPtr()));
}
PathConstrainer::PathConstrainer()
}
PathConstrainer::PathConstrainer(const PathConstrainer& handle)
-:Handle(handle)
+: Handle(handle)
{
}
return *this;
}
-void PathConstrainer::Apply( Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap )
+void PathConstrainer::Apply(Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap)
{
- GetImplementation(*this).Apply( target, source, range, wrap );
+ GetImplementation(*this).Apply(target, source, range, wrap);
}
-void PathConstrainer::Remove( Dali::Handle& target )
+void PathConstrainer::Remove(Dali::Handle& target)
{
- GetImplementation(*this).Remove( target );
+ GetImplementation(*this).Remove(target);
}
-
-} // Dali
+} // namespace Dali
#define DALI_PATH_CONSTRAINER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
- class PathConstrainer;
+class PathConstrainer;
}
/**
* @brief
class DALI_CORE_API PathConstrainer : public Handle
{
public:
-
/**
* @brief An enumeration of properties belonging to the PathConstrainer class.
*/
{
enum
{
- FORWARD = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "forward" type Vector3
- POINTS, ///< name "points" type Array of Vector3
- CONTROL_POINTS ///< name "controlPoints" type Array of Vector3
+ FORWARD = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "forward" type Vector3
+ POINTS, ///< name "points" type Array of Vector3
+ CONTROL_POINTS ///< name "controlPoints" type Array of Vector3
};
};
* @param[in] handle to An object
* @return handle to a PathConstrainer object or an uninitialized handle
*/
- static PathConstrainer DownCast( BaseHandle handle );
+ static PathConstrainer DownCast(BaseHandle handle);
/**
* @brief Create an uninitialized PathConstrainer handle.
* @param[in] range The range of values in the source property which will be mapped to [0,1]
* @param[in] wrap Wrapping domain. Source property will be wrapped in the domain [wrap.x,wrap.y] before mapping to [0,1]
*/
- void Apply( Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap = Vector2(-FLT_MAX, FLT_MAX) );
+ void Apply(Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap = Vector2(-FLT_MAX, FLT_MAX));
/**
* @brief Removes the path constraint in the target object
*
* @param[in] target A handle to an object constrained by the PathConstrainer
*/
- void Remove( Dali::Handle& target );
+ void Remove(Dali::Handle& target);
public: // Not intended for application developers
/**
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace AddOn
{
-
Dali::Integration::AddOnManager* AddOnBinder::mAddOnManager = nullptr;
} // namespace AddOn
{
namespace AddOn
{
-
/**
* Class automates binding an AddOn interface.
*
class AddOnBinder
{
public:
-
/**
* @brief Constructor. Opens an AddOn and creates interface
* @param[in] addonName Name of AddOn
* @param[in] version Version of AddOn
*/
- explicit AddOnBinder( const char* addonName, uint32_t version = 0u )
+ explicit AddOnBinder(const char* addonName, uint32_t version = 0u)
{
mAddOnManager = Dali::Integration::AddOnManager::Get();
- if (mAddOnManager)
+ if(mAddOnManager)
{
mAddOnHandle = mAddOnManager->GetAddOn(addonName);
- if (mAddOnHandle)
+ if(mAddOnHandle)
{
mAddOnManager->GetAddOnInfo(addonName, mAddOnInfo);
}
* @return Returns a new pointer
*/
template<class T>
- T* ConvertFunction( const std::string& funcName )
+ T* ConvertFunction(const std::string& funcName)
{
if(mAddOnHandle)
{
* @param[in] name Name of the function
* @return Valid pointer or nullptr
*/
- void* GetGlobalProc( const char* name )
+ void* GetGlobalProc(const char* name)
{
- return mAddOnManager ? mAddOnManager->GetGlobalProc( mAddOnHandle, name ) : nullptr;
+ return mAddOnManager ? mAddOnManager->GetGlobalProc(mAddOnHandle, name) : nullptr;
}
/**
* @param[in] name Name of the function
* @return Valid pointer or nullptr
*/
- void* GetInstanceProc( const char* name )
+ void* GetInstanceProc(const char* name)
{
- return mAddOnManager ? mAddOnManager->GetInstanceProc( mAddOnHandle, name ) : nullptr;
+ return mAddOnManager ? mAddOnManager->GetInstanceProc(mAddOnHandle, name) : nullptr;
}
/**
}
protected:
-
static DALI_CORE_API Dali::Integration::AddOnManager* mAddOnManager; ///< Pointer to the AddOn manager
- Dali::AddOnLibrary mAddOnHandle { nullptr }; ///< Handle to the AddOn library
- Dali::AddOnInfo mAddOnInfo {}; ///< Stored AddOnInfo structure
+ Dali::AddOnLibrary mAddOnHandle{nullptr}; ///< Handle to the AddOn library
+ Dali::AddOnInfo mAddOnInfo{}; ///< Stored AddOnInfo structure
};
-
/**
* Macro binds function as a member function of the class, for example, the call:
*
*
* will create a std::function object named SomeAddOnFunction and bound to the AddOn library.
*/
-#define ADDON_BIND_FUNCTION( FUNCNAME, FUNCTYPE ) \
-std::function<FUNCTYPE> FUNCNAME{ConvertFunction<FUNCTYPE>( std::string(#FUNCNAME) )};
+#define ADDON_BIND_FUNCTION(FUNCNAME, FUNCTYPE) \
+ std::function<FUNCTYPE> FUNCNAME{ConvertFunction<FUNCTYPE>(std::string(#FUNCNAME))};
} // namespace AddOn
} // namespace Dali
#define DALI_BITWISE_ENUM_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
/**
* Type traits and methods to enable type safe bit field operators for an enum.
* usage:
* if( myFlag & FLAG2 )
* // do something
*/
-template< typename Enum >
+template<typename Enum>
struct EnableBitMaskOperators
{
static const bool ENABLE = false; // can't be constexpr as it's a data member
* @param rhs bitfield to or
* @return EnumType with both flags set
*/
-template < typename EnumType >
-inline typename std::enable_if< EnableBitMaskOperators< EnumType >::ENABLE, EnumType >::type operator|( EnumType lhs, EnumType rhs )
+template<typename EnumType>
+inline typename std::enable_if<EnableBitMaskOperators<EnumType>::ENABLE, EnumType>::type operator|(EnumType lhs, EnumType rhs)
{
using UnderlyingType = typename std::underlying_type<EnumType>::type;
- return static_cast<EnumType>( static_cast<UnderlyingType>( lhs ) | static_cast<UnderlyingType>(rhs ) );
+ return static_cast<EnumType>(static_cast<UnderlyingType>(lhs) | static_cast<UnderlyingType>(rhs));
}
/**
* @param rhs bitfield to or
* @return reference to lhs with both flags set
*/
-template < typename EnumType >
-inline typename std::enable_if< EnableBitMaskOperators< EnumType >::ENABLE, EnumType& >::type operator|=( EnumType& lhs, EnumType rhs )
+template<typename EnumType>
+inline typename std::enable_if<EnableBitMaskOperators<EnumType>::ENABLE, EnumType&>::type operator|=(EnumType& lhs, EnumType rhs)
{
using UnderlyingType = typename std::underlying_type<EnumType>::type;
- lhs = static_cast<EnumType>(static_cast<UnderlyingType>( lhs ) | static_cast<UnderlyingType>( rhs ) );
+ lhs = static_cast<EnumType>(static_cast<UnderlyingType>(lhs) | static_cast<UnderlyingType>(rhs));
return lhs;
}
* @param rhs bitfield to AND
* @return true if at least one flag is same in both
*/
-template < typename EnumType >
-inline typename std::enable_if< EnableBitMaskOperators< EnumType >::ENABLE, bool >::type operator&( EnumType lhs, EnumType rhs )
+template<typename EnumType>
+inline typename std::enable_if<EnableBitMaskOperators<EnumType>::ENABLE, bool>::type operator&(EnumType lhs, EnumType rhs)
{
using UnderlyingType = typename std::underlying_type<EnumType>::type;
- return static_cast<bool>( static_cast<UnderlyingType>( lhs ) & static_cast<UnderlyingType>(rhs ) );
+ return static_cast<bool>(static_cast<UnderlyingType>(lhs) & static_cast<UnderlyingType>(rhs));
}
} // namespace Dali
#define DALI_CIRCULAR_QUEUE_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
/**
* Class to provide a circular growable queue on top of Dali::Vector
* It is designed to occupy a fixed block of memory. It does not allow
* addition of elements past the start; i.e. it doesn't overwrite.
*/
-template <typename ElementType>
+template<typename ElementType>
class CircularQueue
{
public:
* Constructor
* @param[in] maximumSize The maximum number of elements that the queue can contain
*/
- CircularQueue( int maximumSize )
+ CircularQueue(int maximumSize)
: mMaximumSize(maximumSize),
mStartMarker(0),
mEndMarker(0),
ElementType& operator[](unsigned int index)
{
unsigned int actualIndex = (mStartMarker + index) % mMaximumSize;
- DALI_ASSERT_ALWAYS( actualIndex<mQueue.Count() && "Reading outside queue boundary");
+ DALI_ASSERT_ALWAYS(actualIndex < mQueue.Count() && "Reading outside queue boundary");
return mQueue[actualIndex];
}
const ElementType& operator[](unsigned int index) const
{
unsigned int actualIndex = (mStartMarker + index) % mMaximumSize;
- DALI_ASSERT_ALWAYS( actualIndex<mQueue.Count() && "Reading outside queue boundary");
+ DALI_ASSERT_ALWAYS(actualIndex < mQueue.Count() && "Reading outside queue boundary");
return mQueue[actualIndex];
}
* @warning This method asserts if the user attempts to push more elements
* than the maximum size specified in the constructor
*/
- void PushBack( const ElementType& element )
+ void PushBack(const ElementType& element)
{
- DALI_ASSERT_ALWAYS( !IsFull() && "Adding to full queue");
+ DALI_ASSERT_ALWAYS(!IsFull() && "Adding to full queue");
// Push back if we need to increase the vector count
- if( mQueue.Count() == 0 || ( mQueue.Count() < mMaximumSize && ! IsEmpty() ) )
+ if(mQueue.Count() == 0 || (mQueue.Count() < mMaximumSize && !IsEmpty()))
{
mQueue.PushBack(element);
- if( !IsEmpty() )
+ if(!IsEmpty())
{
++mEndMarker;
}
++mNumberOfElements;
}
- else if( IsEmpty() )
+ else if(IsEmpty())
{
// Don't advance the end marker or increase the vector count
mQueue[mEndMarker] = element;
++mNumberOfElements;
}
- else if( !IsFull() )
+ else if(!IsFull())
{
// vector is at max and there is space: advance end marker
++mEndMarker;
mEndMarker %= mMaximumSize;
- mQueue[ mEndMarker ] = element;
+ mQueue[mEndMarker] = element;
++mNumberOfElements;
}
}
*/
ElementType PopFront()
{
- DALI_ASSERT_ALWAYS( !IsEmpty() && "Reading from empty queue" );
+ DALI_ASSERT_ALWAYS(!IsEmpty() && "Reading from empty queue");
ElementType element;
- if( mNumberOfElements == 1 )
+ if(mNumberOfElements == 1)
{
- element = mQueue[mStartMarker];
+ element = mQueue[mStartMarker];
mNumberOfElements = 0;
}
- else if( mNumberOfElements > 1 )
+ else if(mNumberOfElements > 1)
{
element = mQueue[mStartMarker];
++mStartMarker;
ElementType& Front()
{
- DALI_ASSERT_ALWAYS( !IsEmpty() && "Reading from empty queue" );
+ DALI_ASSERT_ALWAYS(!IsEmpty() && "Reading from empty queue");
return mQueue[mStartMarker];
}
const ElementType& Front() const
{
- DALI_ASSERT_ALWAYS( !IsEmpty() && "Reading from empty queue" );
+ DALI_ASSERT_ALWAYS(!IsEmpty() && "Reading from empty queue");
return mQueue[mStartMarker];
}
ElementType& Back()
{
- DALI_ASSERT_ALWAYS( !IsEmpty() && "Reading from empty queue" );
+ DALI_ASSERT_ALWAYS(!IsEmpty() && "Reading from empty queue");
return mQueue[mEndMarker];
}
const ElementType& Back() const
{
- DALI_ASSERT_ALWAYS( !IsEmpty() && "Reading from empty queue" );
+ DALI_ASSERT_ALWAYS(!IsEmpty() && "Reading from empty queue");
return mQueue[mEndMarker];
}
*/
bool IsFull() const
{
- return ( mQueue.Count() == mMaximumSize &&
- mNumberOfElements > 0 &&
- (mEndMarker + 1) % mMaximumSize == mStartMarker );
+ return (mQueue.Count() == mMaximumSize &&
+ mNumberOfElements > 0 &&
+ (mEndMarker + 1) % mMaximumSize == mStartMarker);
}
/**
int mNumberOfElements; ///< Number of valid elements in the queue
};
-} // Dali
+} // namespace Dali
#endif // DALI_CIRCULAR_QUEUE_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace //unnamed namespace
{
-
/*
* djb2 (http://www.cse.yorku.ca/~oz/hash.html)
*/
-inline void HashString( const char* string, std::size_t& hash )
+inline void HashString(const char* string, std::size_t& hash)
{
- while( int c = *string++ )
+ while(int c = *string++)
{
hash = hash * 33 + c;
}
} // unnamed namespace
-std::size_t CalculateHash( const std::string& toHash)
+std::size_t CalculateHash(const std::string& toHash)
{
- std::size_t hash( INITIAL_HASH_VALUE );
+ std::size_t hash(INITIAL_HASH_VALUE);
- HashString( toHash.c_str(), hash );
+ HashString(toHash.c_str(), hash);
return hash;
}
-std::size_t CalculateHash( const std::string& string1, const std::string& string2 )
+std::size_t CalculateHash(const std::string& string1, const std::string& string2)
{
- std::size_t hash( INITIAL_HASH_VALUE );
+ std::size_t hash(INITIAL_HASH_VALUE);
- HashString( string1.c_str(), hash);
- HashString( string2.c_str(), hash );
+ HashString(string1.c_str(), hash);
+ HashString(string2.c_str(), hash);
return hash;
}
#define DALI_HASH
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
enum
{
INITIAL_HASH_VALUE = 5381
* @param toHash string to hash
* @return hash code
*/
-DALI_CORE_API std::size_t CalculateHash( const std::string& toHash );
+DALI_CORE_API std::size_t CalculateHash(const std::string& toHash);
/**
* @brief Create a hash code for 2 strings combined.
* @param string2 second string
* @return hash code
*/
-DALI_CORE_API std::size_t CalculateHash( const std::string& string1, const std::string& string2 );
+DALI_CORE_API std::size_t CalculateHash(const std::string& string1, const std::string& string2);
} // namespace Dali
#define DALI_MAP_WRAPPER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <map>
#undef _LIBCPP_INLINE_VISIBILITY
-#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
+#define _LIBCPP_INLINE_VISIBILITY __attribute__((__visibility__("hidden"), __always_inline__))
#undef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#include <bits/stl_tree.h>
#undef _GLIBCXX_VISIBILITY_ATTR
#undef _GLIBCXX_VISIBILITY
-#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ ("hidden")))
-#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ ("hidden")))
+#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__((__visibility__("hidden")))
+#define _GLIBCXX_VISIBILITY(V) __attribute__((__visibility__("hidden")))
#include <map>
#undef _GLIBCXX_VISIBILITY_ATTR
#undef _GLIBCXX_VISIBILITY
-#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY_ATTR`
-#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY`
+#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__((__visibility__(#V))) // restore `_GLIBCXX_VISIBILITY_ATTR`
+#define _GLIBCXX_VISIBILITY(V) __attribute__((__visibility__(#V))) // restore `_GLIBCXX_VISIBILITY`
#endif // #ifdef __clang__
namespace Dali
{
-
/**
* OwnerContainer is a vector which own heap-allocated objects.
* Unlike vector this will call delete on the stored pointers during destruction.
*
* @endcode
*/
-template< class T >
-class OwnerContainer : public Dali::Vector< T >
+template<class T>
+class OwnerContainer : public Dali::Vector<T>
{
public:
using SizeType = typename Dali::Vector<T>::SizeType;
* Create a pointer-container.
*/
OwnerContainer()
- { }
+ {
+ }
/**
* Non-virtual destructor; OwnerContainer<T> is not suitable as base class.
}
// Not copyable or movable
- OwnerContainer( const OwnerContainer& ) = delete; ///< Deleted copy constructor
- OwnerContainer( OwnerContainer&& ) = delete; ///< Deleted move constructor
- OwnerContainer& operator=( const OwnerContainer& ) = delete; ///< Deleted copy assignment operator
- OwnerContainer& operator=( OwnerContainer&& ) = delete; ///< Deleted move assignment operator
+ OwnerContainer(const OwnerContainer&) = delete; ///< Deleted copy constructor
+ OwnerContainer(OwnerContainer&&) = delete; ///< Deleted move constructor
+ OwnerContainer& operator=(const OwnerContainer&) = delete; ///< Deleted copy assignment operator
+ OwnerContainer& operator=(OwnerContainer&&) = delete; ///< Deleted move assignment operator
/**
* Test whether the container is empty.
* @param[in] position A dereferencable iterator to an element in mContainer.
* @return iterator pointing to next element
*/
- Iterator Erase( Iterator position )
+ Iterator Erase(Iterator position)
{
- Delete (*position);
- return Vector< T >::Erase( position );
+ Delete(*position);
+ return Vector<T>::Erase(position);
}
/**
* Erase an object from OwnerContainer
* @param object to remove
*/
- inline void EraseObject( T object )
+ inline void EraseObject(T object)
{
- DALI_ASSERT_DEBUG( object && "NULL object not allowed" );
+ DALI_ASSERT_DEBUG(object && "NULL object not allowed");
- Iterator iter = Vector< T >::Begin();
- const ConstIterator endIter = Vector< T >::End();
- for ( ; iter != endIter; ++iter )
+ Iterator iter = Vector<T>::Begin();
+ const ConstIterator endIter = Vector<T>::End();
+ for(; iter != endIter; ++iter)
{
- if ( *iter == object )
+ if(*iter == object)
{
- Erase( iter );
+ Erase(iter);
return;
}
}
* @post iterators are invalidated by this method.
* @return pointer to the released item
*/
- T Release( Iterator position )
+ T Release(Iterator position)
{
T pointer = *position;
- Vector< T >::Erase( position );
+ Vector<T>::Erase(position);
return pointer;
}
*/
void Clear()
{
- ConstIterator end = Vector< T >::End();
- for( Iterator iter = Vector< T >::Begin(); iter != end; ++iter )
+ ConstIterator end = Vector<T>::End();
+ for(Iterator iter = Vector<T>::Begin(); iter != end; ++iter)
{
- Delete (*iter);
+ Delete(*iter);
}
- Vector< T >::Clear();
+ Vector<T>::Clear();
}
/**
* Resizes the container to hold specific amount of elements
* @param size to resize to
*/
- void Resize( SizeType size )
+ void Resize(SizeType size)
{
- if( size < VectorBase::Count() )
+ if(size < VectorBase::Count())
{
// OwnerContainer owns these heap-allocated objects
- ConstIterator end = Vector< T >::End();
- for( Iterator iter = Vector< T >::Begin() + size; iter != end; ++iter )
+ ConstIterator end = Vector<T>::End();
+ for(Iterator iter = Vector<T>::Begin() + size; iter != end; ++iter)
{
- Delete (*iter);
+ Delete(*iter);
}
}
- Vector< T >::Resize( size );
+ Vector<T>::Resize(size);
}
/**
* without deleting them. It will keep the original items here as well.
* @param[in] source where to move elements from to this OwnerContainer
*/
- void MoveFrom( OwnerContainer& source )
+ void MoveFrom(OwnerContainer& source)
{
- typename Vector< T >::SizeType sourceCount = source.Count();
+ typename Vector<T>::SizeType sourceCount = source.Count();
// if source is empty, nothing to move
- if( sourceCount > 0u )
+ if(sourceCount > 0u)
{
// Optimisation for the case that this is empty
- if( IsEmpty() )
+ if(IsEmpty())
{
- VectorBase::Swap( source );
+ VectorBase::Swap(source);
}
else
{
// make space for new items
- Vector< T >::Reserve( VectorBase::Count() + sourceCount );
- Iterator iter = source.Begin();
- ConstIterator end = source.End();
- for( ; iter != end; ++iter )
+ Vector<T>::Reserve(VectorBase::Count() + sourceCount);
+ Iterator iter = source.Begin();
+ ConstIterator end = source.End();
+ for(; iter != end; ++iter)
{
T pointer = *iter;
- Vector< T >::PushBack( pointer );
+ Vector<T>::PushBack(pointer);
}
// cannot call Clear on OwnerContainer as that deletes the elements
- source.Vector< T >::Clear();
+ source.Vector<T>::Clear();
}
}
}
private:
-
/**
* @brief delete the contents of the pointer
* Function provided to allow classes to provide a custom destructor through template specialisation
* @param pointer to the object
*/
- void Delete( T pointer )
+ void Delete(T pointer)
{
delete pointer;
}
-
-
};
} // namespace Dali
namespace Dali
{
-
/**
* @brief A reference counting wrapper for a vector class that allows
* a set of referencing smart pointers to collaborate in managing its
* stack.
* @tparam T type of the data that the vector holds
*/
-template< typename T >
+template<typename T>
class RefCountedVector : public RefObject
{
public:
*
* @return A reference to the vector that this object wraps.
*/
- Vector< T >& GetVector()
+ Vector<T>& GetVector()
{
return mVector;
}
// Not copyable or movable
- RefCountedVector( const RefCountedVector& ) = delete; ///< Deleted copy constructor
- RefCountedVector( RefCountedVector&& ) = delete; ///< Deleted move constructor
- RefCountedVector& operator=( const RefCountedVector& ) = delete; ///< Deleted copy assignment operator
- RefCountedVector& operator=( RefCountedVector&& ) = delete; ///< Deleted move assignment operator
+ RefCountedVector(const RefCountedVector&) = delete; ///< Deleted copy constructor
+ RefCountedVector(RefCountedVector&&) = delete; ///< Deleted move constructor
+ RefCountedVector& operator=(const RefCountedVector&) = delete; ///< Deleted copy assignment operator
+ RefCountedVector& operator=(RefCountedVector&&) = delete; ///< Deleted move assignment operator
protected:
virtual ~RefCountedVector()
}
private:
-
- Vector< T > mVector; ///< The vector of data
+ Vector<T> mVector; ///< The vector of data
};
} // namespace Dali
#define DALI_SET_WRAPPER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <set>
#undef _LIBCPP_INLINE_VISIBILITY
-#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
+#define _LIBCPP_INLINE_VISIBILITY __attribute__((__visibility__("hidden"), __always_inline__))
#undef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#include <bits/stl_tree.h>
#undef _GLIBCXX_VISIBILITY_ATTR
#undef _GLIBCXX_VISIBILITY
-#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ ("hidden")))
-#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ ("hidden")))
+#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__((__visibility__("hidden")))
+#define _GLIBCXX_VISIBILITY(V) __attribute__((__visibility__("hidden")))
#include <set>
#undef _GLIBCXX_VISIBILITY_ATTR
#undef _GLIBCXX_VISIBILITY
-#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY_ATTR`
-#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY`
+#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__((__visibility__(#V))) // restore `_GLIBCXX_VISIBILITY_ATTR`
+#define _GLIBCXX_VISIBILITY(V) __attribute__((__visibility__(#V))) // restore `_GLIBCXX_VISIBILITY`
#endif // #ifdef __clang__
namespace Dali
{
-
SingletonService::SingletonService()
{
}
{
}
-void SingletonService::Register( const std::type_info& info, BaseHandle singleton )
+void SingletonService::Register(const std::type_info& info, BaseHandle singleton)
{
- GetImplementation( *this ).Register( info, singleton );
+ GetImplementation(*this).Register(info, singleton);
}
void SingletonService::UnregisterAll()
{
- GetImplementation( *this ).UnregisterAll();
+ GetImplementation(*this).UnregisterAll();
}
-BaseHandle SingletonService::GetSingleton( const std::type_info& info ) const
+BaseHandle SingletonService::GetSingleton(const std::type_info& info) const
{
- return GetImplementation( *this ).GetSingleton( info );
+ return GetImplementation(*this).GetSingleton(info);
}
-SingletonService::SingletonService( Internal::ThreadLocalStorage* tls )
-: BaseHandle( tls )
+SingletonService::SingletonService(Internal::ThreadLocalStorage* tls)
+: BaseHandle(tls)
{
}
*/
// EXTERNAL INCLUDES
-#include <typeinfo>
#include <dali/public-api/object/base-handle.h>
+#include <typeinfo>
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class ThreadLocalStorage;
class DALI_CORE_API SingletonService : public BaseHandle
{
public:
-
/**
* @brief Create an uninitialized handle.
*
* @param[in] info The type info of the Dali handle generated by the compiler.
* @param[in] singleton The Dali handle to be registered
*/
- void Register( const std::type_info& info, BaseHandle singleton );
+ void Register(const std::type_info& info, BaseHandle singleton);
/**
* @brief Unregisters all singletons.
* @param[in] info The type info of the given type.
* @return the Dali handle if it is registered as a singleton or an uninitialized handle.
*/
- BaseHandle GetSingleton( const std::type_info& info ) const;
+ BaseHandle GetSingleton(const std::type_info& info) const;
public: // Not intended for application developers
-
/**
* @brief This constructor is used by SingletonService::Get().
* @param[in] singletonService A pointer to the internal singleton-service object.
*/
- explicit DALI_INTERNAL SingletonService( Internal::ThreadLocalStorage* singletonService );
+ explicit DALI_INTERNAL SingletonService(Internal::ThreadLocalStorage* singletonService);
};
} // namespace Dali
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace DevelStage
{
-
-KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Stage stage )
+KeyEventGeneratedSignalType& KeyEventGeneratedSignal(Dali::Stage stage)
{
- return GetImplementation( stage ).KeyEventGeneratedSignal();
+ return GetImplementation(stage).KeyEventGeneratedSignal();
}
-void SetRenderingBehavior( Dali::Stage stage, Rendering renderingBehavior )
+void SetRenderingBehavior(Dali::Stage stage, Rendering renderingBehavior)
{
- GetImplementation( stage ).SetRenderingBehavior( renderingBehavior );
+ GetImplementation(stage).SetRenderingBehavior(renderingBehavior);
}
-Rendering GetRenderingBehavior( Dali::Stage stage )
+Rendering GetRenderingBehavior(Dali::Stage stage)
{
- return GetImplementation( stage ).GetRenderingBehavior();
+ return GetImplementation(stage).GetRenderingBehavior();
}
-void AddFrameCallback( Dali::Stage stage, FrameCallbackInterface& frameCallback, Actor rootActor )
+void AddFrameCallback(Dali::Stage stage, FrameCallbackInterface& frameCallback, Actor rootActor)
{
- GetImplementation( stage ).AddFrameCallback( frameCallback, GetImplementation( rootActor ) );
+ GetImplementation(stage).AddFrameCallback(frameCallback, GetImplementation(rootActor));
}
-void RemoveFrameCallback( Dali::Stage stage, FrameCallbackInterface& frameCallback )
+void RemoveFrameCallback(Dali::Stage stage, FrameCallbackInterface& frameCallback)
{
- GetImplementation( stage ).RemoveFrameCallback( frameCallback );
+ GetImplementation(stage).RemoveFrameCallback(frameCallback);
}
} // namespace DevelStage
namespace Dali
{
-
class FrameCallbackInterface;
namespace DevelStage
{
-
/**
* @brief The DALi rendering behavior.
*/
CONTINUOUSLY, ///< Will render continuously.
};
-using KeyEventGeneratedSignalType = Signal<bool( const KeyEvent& )>; ///< Stage key event generated signal type
+using KeyEventGeneratedSignalType = Signal<bool(const KeyEvent&)>; ///< Stage key event generated signal type
/**
* @brief The user would connect to this signal to get a KeyEvent when KeyEvent is generated.
* @param[in] stage The stage to emit a signal
* @return The return is true if KeyEvent is consumed, otherwise false.
*/
-DALI_CORE_API KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Stage stage );
+DALI_CORE_API KeyEventGeneratedSignalType& KeyEventGeneratedSignal(Dali::Stage stage);
/**
* @brief Gives the user the ability to set the rendering behavior of DALi.
* @note By default, DALi uses Rendering::IF_REQUIRED.
* @see Rendering
*/
-DALI_CORE_API void SetRenderingBehavior( Dali::Stage stage, Rendering renderingBehavior );
+DALI_CORE_API void SetRenderingBehavior(Dali::Stage stage, Rendering renderingBehavior);
/**
* @brief Retrieves the rendering behavior of DALi.
* @param[in] stage The stage
* @return The rendering behavior of DALi.
*/
-DALI_CORE_API Rendering GetRenderingBehavior( Dali::Stage stage );
+DALI_CORE_API Rendering GetRenderingBehavior(Dali::Stage stage);
/*
* @brief The FrameCallbackInterface implementation added gets called on every frame from the update-thread.
* @note If the rootActor is destroyed, then the callback is automatically removed
* @see FrameCallbackInterface
*/
-DALI_CORE_API void AddFrameCallback( Dali::Stage stage, FrameCallbackInterface& frameCallback, Actor rootActor );
+DALI_CORE_API void AddFrameCallback(Dali::Stage stage, FrameCallbackInterface& frameCallback, Actor rootActor);
/**
* @brief Removes the specified FrameCallbackInterface implementation from being called on every frame.
* @note This function will block if the FrameCallbackInterface::Update method is being processed in the update-thread.
* @note If the callback implementation has already been removed, then this is a no-op.
*/
-DALI_CORE_API void RemoveFrameCallback( Dali::Stage stage, FrameCallbackInterface& frameCallback );
+DALI_CORE_API void RemoveFrameCallback(Dali::Stage stage, FrameCallbackInterface& frameCallback);
} // namespace DevelStage
#include <dali/devel-api/common/stage.h>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
-#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/common/core-impl.h>
+#include <dali/internal/event/common/stage-impl.h>
+#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/object/object-registry.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
namespace Dali
{
-
using Internal::Core;
Stage::Stage()
Stage Stage::GetCurrent()
{
Internal::Stage* stage = Internal::Stage::GetCurrent();
- DALI_ASSERT_ALWAYS( stage && "Stage doesn't exist" );
- return Stage( stage );
+ DALI_ASSERT_ALWAYS(stage && "Stage doesn't exist");
+ return Stage(stage);
}
bool Stage::IsInstalled()
RenderTaskList Stage::GetRenderTaskList() const
{
- return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
+ return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
}
Vector2 Stage::GetSize() const
ObjectRegistry Stage::GetObjectRegistry() const
{
Internal::Stage* stage = Internal::Stage::GetCurrent();
- DALI_ASSERT_ALWAYS( stage && "GetObjectRegistry() : Stage is null" );
+ DALI_ASSERT_ALWAYS(stage && "GetObjectRegistry() : Stage is null");
Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
return ObjectRegistry(&internal);
}
-void Stage::KeepRendering( float durationSeconds )
+void Stage::KeepRendering(float durationSeconds)
{
- GetImplementation(*this).KeepRendering( durationSeconds );
+ GetImplementation(*this).KeepRendering(durationSeconds);
}
Stage::KeyEventSignalType& Stage::KeyEventSignal()
Stage::TouchEventSignalType& Stage::TouchedSignal()
{
- return GetImplementation( *this ).TouchedSignal();
+ return GetImplementation(*this).TouchedSignal();
}
Stage::WheelEventSignalType& Stage::WheelEventSignal()
class DALI_CORE_API Stage : public BaseHandle
{
public:
- using KeyEventSignalType = Signal<void( const KeyEvent& )>; ///< Key event signal type
- using EventProcessingFinishedSignalType = Signal<void()>; ///< Event Processing finished signal type
- using TouchEventSignalType = Signal<void( const TouchEvent& )>; ///< Touch signal type
- using WheelEventSignalType = Signal<void( const WheelEvent& )>; ///< Wheel signal type
- using ContextStatusSignal = Signal<void()>; ///< Context status signal type
- using SceneCreatedSignalType = Signal<void()>; ///< Scene created signal type
+ using KeyEventSignalType = Signal<void(const KeyEvent&)>; ///< Key event signal type
+ using EventProcessingFinishedSignalType = Signal<void()>; ///< Event Processing finished signal type
+ using TouchEventSignalType = Signal<void(const TouchEvent&)>; ///< Touch signal type
+ using WheelEventSignalType = Signal<void(const WheelEvent&)>; ///< Wheel signal type
+ using ContextStatusSignal = Signal<void()>; ///< Context status signal type
+ using SceneCreatedSignalType = Signal<void()>; ///< Scene created signal type
/**
* @brief Allows the creation of an empty stage handle.
* This method is useful to force screen refreshes e.g. when updating a NativeImage.
* @param[in] durationSeconds Time to keep rendering, 0 means render at least one more frame
*/
- void KeepRendering( float durationSeconds );
+ void KeepRendering(float durationSeconds);
// Signals
SceneCreatedSignalType& SceneCreatedSignal();
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Stage::GetCurrent() methods.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/devel-api/events/hit-test-algorithm.h>
// INTERNAL INCLUDES
-#include <dali/internal/event/events/hit-test-algorithm-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/events/hit-test-algorithm-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
namespace Dali
{
-
namespace HitTestAlgorithm
{
-
-bool HitTest( Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func )
+bool HitTest(Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func)
{
- Internal::Stage& stageImpl = GetImplementation( stage );
- return Internal::HitTestAlgorithm::HitTest( stageImpl.GetSize(), stageImpl.GetRenderTaskList(), stageImpl.GetLayerList(), screenCoordinates, results, func );
+ Internal::Stage& stageImpl = GetImplementation(stage);
+ return Internal::HitTestAlgorithm::HitTest(stageImpl.GetSize(), stageImpl.GetRenderTaskList(), stageImpl.GetLayerList(), screenCoordinates, results, func);
}
} // namespace HitTestAlgorithm
-#ifndef __DALI_HIT_TEST_ALGORITHM_H__
-#define __DALI_HIT_TEST_ALGORITHM_H__
+#ifndef __DALI_HIT_TEST_ALGORITHM_H__
+#define __DALI_HIT_TEST_ALGORITHM_H__
/*
* Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
*/
-#include <dali/public-api/actors/actor.h>
#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/scene.h>
-
+#include <dali/public-api/actors/actor.h>
namespace Dali
{
-
class RenderTask;
/**
*/
namespace HitTestAlgorithm
{
-
/**
* @brief How the actor tree should be traversed.
*/
enum TraverseType
{
- CHECK_ACTOR, ///< Hit test the given actor.
- DESCEND_ACTOR_TREE ///< Check whether the actor tree should be descended to hit-test its children.
+ CHECK_ACTOR, ///< Hit test the given actor.
+ DESCEND_ACTOR_TREE ///< Check whether the actor tree should be descended to hit-test its children.
};
/**
*/
struct Results
{
- Actor actor; ///< The hit actor.
- Vector2 actorCoordinates; ///< The actor coordinates.
+ Actor actor; ///< The hit actor.
+ Vector2 actorCoordinates; ///< The actor coordinates.
};
/**
*
* @return true, if the actor is hittable, false otherwise.
*/
-using HitTestFunction = bool ( * )( Actor, TraverseType );
+using HitTestFunction = bool (*)(Actor, TraverseType);
/**
* @brief Given screen coordinates, this method returns the hit actor & the local coordinates relative to
* @param[in] func The function to use in the hit-test algorithm.
* @return true if something was hit
*/
-DALI_CORE_API bool HitTest( Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func );
+DALI_CORE_API bool HitTest(Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func);
} // namespace HitTestAlgorithm
\r
namespace Dali\r
{\r
-\r
namespace DevelHoverEvent\r
{\r
-\r
-HoverEvent New( uint32_t time )\r
+HoverEvent New(uint32_t time)\r
{\r
- return HoverEvent( new Internal::HoverEvent( time ) );\r
+ return HoverEvent(new Internal::HoverEvent(time));\r
}\r
\r
} // namespace DevelHoverEvent\r
\r
} // namespace Dali\r
-\r
\r
namespace Dali\r
{\r
-\r
namespace DevelHoverEvent\r
{\r
-\r
/**\r
* @brief Creates an initialized HoverEvent.\r
*\r
* @param[in] time The time the event occurred.\r
* @return A handle to a newly allocated Dali resource\r
*/\r
-DALI_CORE_API HoverEvent New( uint32_t time );\r
-\r
+DALI_CORE_API HoverEvent New(uint32_t time);\r
\r
} // namespace DevelHoverEvent\r
\r
\r
namespace Dali\r
{\r
-\r
namespace DevelKeyEvent\r
{\r
-\r
-KeyEvent New( const std::string& keyName,\r
- const std::string& logicalKey,\r
- const std::string& keyString,\r
- int keyCode,\r
- int keyModifier,\r
- unsigned long timeStamp,\r
- const Dali::KeyEvent::State& keyState,\r
- const std::string& compose,\r
- const std::string& deviceName,\r
- const Device::Class::Type deviceClass,\r
- const Device::Subclass::Type deviceSubclass )\r
+KeyEvent New(const std::string& keyName,\r
+ const std::string& logicalKey,\r
+ const std::string& keyString,\r
+ int keyCode,\r
+ int keyModifier,\r
+ unsigned long timeStamp,\r
+ const Dali::KeyEvent::State& keyState,\r
+ const std::string& compose,\r
+ const std::string& deviceName,\r
+ const Device::Class::Type deviceClass,\r
+ const Device::Subclass::Type deviceSubclass)\r
{\r
- Internal::KeyEventPtr internal = Internal::KeyEvent::New( keyName, logicalKey, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass );\r
+ Internal::KeyEventPtr internal = Internal::KeyEvent::New(keyName, logicalKey, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass);\r
\r
- return KeyEvent( internal.Get() );\r
+ return KeyEvent(internal.Get());\r
}\r
\r
-void SetKeyName( KeyEvent keyEvent, const std::string& keyName )\r
+void SetKeyName(KeyEvent keyEvent, const std::string& keyName)\r
{\r
- GetImplementation( keyEvent ).SetKeyName( keyName );\r
+ GetImplementation(keyEvent).SetKeyName(keyName);\r
}\r
\r
-void SetKeyString( KeyEvent keyEvent, const std::string& keyString )\r
+void SetKeyString(KeyEvent keyEvent, const std::string& keyString)\r
{\r
- GetImplementation( keyEvent ).SetKeyString( keyString );\r
+ GetImplementation(keyEvent).SetKeyString(keyString);\r
}\r
\r
-void SetKeyCode( KeyEvent keyEvent, int32_t keyCode )\r
+void SetKeyCode(KeyEvent keyEvent, int32_t keyCode)\r
{\r
- GetImplementation( keyEvent ).SetKeyCode( keyCode );\r
+ GetImplementation(keyEvent).SetKeyCode(keyCode);\r
}\r
\r
-void SetKeyModifier( KeyEvent keyEvent, int32_t keyModifier )\r
+void SetKeyModifier(KeyEvent keyEvent, int32_t keyModifier)\r
{\r
- GetImplementation( keyEvent ).SetKeyModifier( keyModifier );\r
+ GetImplementation(keyEvent).SetKeyModifier(keyModifier);\r
}\r
\r
-void SetTime( KeyEvent keyEvent, unsigned long time )\r
+void SetTime(KeyEvent keyEvent, unsigned long time)\r
{\r
- GetImplementation( keyEvent ).SetTime( time );\r
+ GetImplementation(keyEvent).SetTime(time);\r
}\r
\r
-void SetState( KeyEvent keyEvent, const KeyEvent::State& state )\r
+void SetState(KeyEvent keyEvent, const KeyEvent::State& state)\r
{\r
- GetImplementation( keyEvent ).SetState( state );\r
+ GetImplementation(keyEvent).SetState(state);\r
}\r
\r
} // namespace DevelKeyEvent\r
\r
} // namespace Dali\r
-\r
\r
namespace Dali\r
{\r
-\r
namespace DevelKeyEvent\r
{\r
-\r
/**\r
* @brief Creates an initialized KeyEvent.\r
*\r
* @param[in] deviceSubclass The subclass of device the key event originated from\r
* @return A handle to a newly allocated Dali resource\r
*/\r
-DALI_CORE_API KeyEvent New( const std::string& keyName,\r
- const std::string& logicalKey,\r
- const std::string& keyString,\r
- int keyCode,\r
- int keyModifier,\r
- unsigned long timeStamp,\r
- const Dali::KeyEvent::State& keyState,\r
- const std::string& compose,\r
- const std::string& deviceName,\r
- const Device::Class::Type deviceClass,\r
- const Device::Subclass::Type deviceSubclass );\r
+DALI_CORE_API KeyEvent New(const std::string& keyName,\r
+ const std::string& logicalKey,\r
+ const std::string& keyString,\r
+ int keyCode,\r
+ int keyModifier,\r
+ unsigned long timeStamp,\r
+ const Dali::KeyEvent::State& keyState,\r
+ const std::string& compose,\r
+ const std::string& deviceName,\r
+ const Device::Class::Type deviceClass,\r
+ const Device::Subclass::Type deviceSubclass);\r
\r
/**\r
* @brief Set the name given to the key pressed\r
* @param[in] keyEvent The instance of KeyEvent.\r
* @param[in] keyName The name given to the key pressed.\r
*/\r
-DALI_CORE_API void SetKeyName( KeyEvent keyEvent, const std::string& keyName );\r
+DALI_CORE_API void SetKeyName(KeyEvent keyEvent, const std::string& keyName);\r
\r
/**\r
* @brief Set the actual string of input characters that should be used for input editors.\r
* @param[in] keyEvent The instance of KeyEvent.\r
* @param[in] keyString The actual string of input characters\r
*/\r
-DALI_CORE_API void SetKeyString( KeyEvent keyEvent, const std::string& keyString );\r
+DALI_CORE_API void SetKeyString(KeyEvent keyEvent, const std::string& keyString);\r
\r
/**\r
* @brief Set the unique key code for the key pressed.\r
* @param[in] keyEvent The instance of KeyEvent.\r
* @param[in] keyCode The unique key code for the key pressed\r
*/\r
-DALI_CORE_API void SetKeyCode( KeyEvent keyEvent, int32_t keyCode );\r
+DALI_CORE_API void SetKeyCode(KeyEvent keyEvent, int32_t keyCode);\r
\r
/**\r
* @brief Set the key modifier for special keys like Shift, Alt and Ctrl which modify the next key pressed.\r
* @param[in] keyEvent The instance of KeyEvent.\r
* @param[in] keyModifier The key modifier\r
*/\r
-DALI_CORE_API void SetKeyModifier( KeyEvent keyEvent, int32_t keyModifier );\r
+DALI_CORE_API void SetKeyModifier(KeyEvent keyEvent, int32_t keyModifier);\r
\r
/**\r
* @brief Set the time (in ms) that the key event occurred.\r
* @param[in] keyEvent The instance of KeyEvent.\r
* @param[in] time The time (in ms)\r
*/\r
-DALI_CORE_API void SetTime( KeyEvent keyEvent, unsigned long time );\r
+DALI_CORE_API void SetTime(KeyEvent keyEvent, unsigned long time);\r
\r
/**\r
* @brief Set the state of the key event.\r
* @param[in] keyEvent The instance of KeyEvent.\r
* @param[in] state The state of the key event\r
*/\r
-DALI_CORE_API void SetState( KeyEvent keyEvent, const KeyEvent::State& state );\r
+DALI_CORE_API void SetState(KeyEvent keyEvent, const KeyEvent::State& state);\r
\r
} // namespace DevelKeyEvent\r
\r
namespace Dali
{
-
namespace DevelLongPressGestureDetector
{
-
-uint32_t GetMinimumHoldingTime( LongPressGestureDetector longPressGestureDetector )
+uint32_t GetMinimumHoldingTime(LongPressGestureDetector longPressGestureDetector)
{
- return GetImplementation( longPressGestureDetector ).GetMinimumHoldingTime();
+ return GetImplementation(longPressGestureDetector).GetMinimumHoldingTime();
}
-
} // namespace DevelLongPressGestureDetector
} // namespace Dali
-
namespace Dali
{
-
class LongPressGestureDetector;
namespace DevelLongPressGestureDetector
{
-
/**
* @brief Get the minimum holding time required to be recognized as a long press gesture in milliseconds
*
* @param[in] longPressGestureDetector The target LongPressGestureDetector instance
* @return The time value in milliseconds
*/
-DALI_CORE_API uint32_t GetMinimumHoldingTime( LongPressGestureDetector longPressGestureDetector );
+DALI_CORE_API uint32_t GetMinimumHoldingTime(LongPressGestureDetector longPressGestureDetector);
} // namespace DevelLongPressGestureDetector
\r
namespace Dali\r
{\r
-\r
namespace DevelLongPressGesture\r
{\r
-\r
-LongPressGesture New( GestureState state )\r
+LongPressGesture New(GestureState state)\r
{\r
- return LongPressGesture( new Internal::LongPressGesture( state ) );\r
+ return LongPressGesture(new Internal::LongPressGesture(state));\r
}\r
\r
} // namespace DevelLongPressGesture\r
\r
} // namespace Dali\r
-\r
\r
namespace Dali\r
{\r
-\r
namespace DevelLongPressGesture\r
{\r
-\r
/**\r
* @brief Creates an initialized LongPressGesture.\r
*\r
* @param[in] state The state of the LongPressGesture\r
* @return A handle to a newly allocated Dali resource\r
*/\r
-DALI_CORE_API LongPressGesture New( GestureState state );\r
+DALI_CORE_API LongPressGesture New(GestureState state);\r
\r
} // namespace DevelLongPressGesture\r
\r
// INTERNAL INCLUDES
#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
-
namespace Dali
{
-
namespace DevelPanGesture
{
-
-Dali::PanGesture New( GestureState state )
+Dali::PanGesture New(GestureState state)
{
- return PanGesture( new Internal::PanGesture( state ) );
+ return PanGesture(new Internal::PanGesture(state));
}
-void SetTime( Dali::PanGesture& gesture, uint32_t time )
+void SetTime(Dali::PanGesture& gesture, uint32_t time)
{
- GetImplementation( gesture ).SetTime( time );
+ GetImplementation(gesture).SetTime(time);
}
-void SetVelocity( Dali::PanGesture& gesture, const Vector2& velocity)
+void SetVelocity(Dali::PanGesture& gesture, const Vector2& velocity)
{
- GetImplementation( gesture ).SetVelocity( velocity );
+ GetImplementation(gesture).SetVelocity(velocity);
}
-void SetDisplacement( Dali::PanGesture& gesture, const Vector2& displacement)
+void SetDisplacement(Dali::PanGesture& gesture, const Vector2& displacement)
{
- GetImplementation( gesture ).SetDisplacement( displacement );
+ GetImplementation(gesture).SetDisplacement(displacement);
}
-void SetPosition( Dali::PanGesture& gesture, const Vector2& position)
+void SetPosition(Dali::PanGesture& gesture, const Vector2& position)
{
- GetImplementation( gesture ).SetPosition( position );
+ GetImplementation(gesture).SetPosition(position);
}
-void SetScreenVelocity( Dali::PanGesture& gesture, const Vector2& screenVelocity)
+void SetScreenVelocity(Dali::PanGesture& gesture, const Vector2& screenVelocity)
{
- GetImplementation( gesture ).SetScreenVelocity( screenVelocity );
+ GetImplementation(gesture).SetScreenVelocity(screenVelocity);
}
-void SetScreenDisplacement( Dali::PanGesture& gesture, const Vector2& screenDisplacement)
+void SetScreenDisplacement(Dali::PanGesture& gesture, const Vector2& screenDisplacement)
{
- GetImplementation( gesture ).SetScreenDisplacement( screenDisplacement );
+ GetImplementation(gesture).SetScreenDisplacement(screenDisplacement);
}
-void SetScreenPosition( Dali::PanGesture& gesture, const Vector2& screenPosition)
+void SetScreenPosition(Dali::PanGesture& gesture, const Vector2& screenPosition)
{
- GetImplementation( gesture ).SetScreenPosition( screenPosition );
+ GetImplementation(gesture).SetScreenPosition(screenPosition);
}
-void SetNumberOfTouches( Dali::PanGesture& gesture, uint32_t numberOfTouches )
+void SetNumberOfTouches(Dali::PanGesture& gesture, uint32_t numberOfTouches)
{
- GetImplementation( gesture ).SetNumberOfTouches( numberOfTouches );
+ GetImplementation(gesture).SetNumberOfTouches(numberOfTouches);
}
} // namespace DevelPanGesture
namespace Dali
{
-
namespace DevelPanGesture
{
-
/**
* @brief Create a PanGeture for internal.
* @param[in] state The state of the PanGesture
\r
namespace Dali\r
{\r
-\r
namespace DevelPinchGesture\r
{\r
-\r
-PinchGesture New( GestureState state )\r
+PinchGesture New(GestureState state)\r
{\r
- return PinchGesture( new Internal::PinchGesture( state ) );\r
+ return PinchGesture(new Internal::PinchGesture(state));\r
}\r
\r
} // namespace DevelPinchGesture\r
\r
} // namespace Dali\r
-\r
\r
namespace Dali\r
{\r
-\r
namespace DevelPinchGesture\r
{\r
-\r
/**\r
* @brief Creates an initialized PinchGesture.\r
*\r
* @param[in] state The state of the PinchGesture\r
* @return A handle to a newly allocated Dali resource\r
*/\r
-DALI_CORE_API PinchGesture New( GestureState state );\r
+DALI_CORE_API PinchGesture New(GestureState state);\r
\r
} // namespace DevelPinchGesture\r
\r
\r
namespace Dali\r
{\r
-\r
namespace DevelRotationGesture\r
{\r
-\r
-RotationGesture New( GestureState state )\r
+RotationGesture New(GestureState state)\r
{\r
- return RotationGesture( new Internal::RotationGesture( state ) );\r
+ return RotationGesture(new Internal::RotationGesture(state));\r
}\r
\r
} // namespace DevelRotationGesture\r
\r
} // namespace Dali\r
-\r
\r
namespace Dali\r
{\r
-\r
namespace DevelRotationGesture\r
{\r
-\r
/**\r
* @brief Creates an initialized RotationGesture.\r
*\r
* @param[in] state The state of the RotationGesture\r
* @return A handle to a newly allocated Dali resource\r
*/\r
-DALI_CORE_API RotationGesture New( GestureState state );\r
+DALI_CORE_API RotationGesture New(GestureState state);\r
\r
} // namespace DevelRotationGesture\r
\r
\r
namespace Dali\r
{\r
-\r
namespace DevelTapGesture\r
{\r
-\r
-TapGesture New( GestureState state )\r
+TapGesture New(GestureState state)\r
{\r
- return TapGesture( new Internal::TapGesture( state ) );\r
+ return TapGesture(new Internal::TapGesture(state));\r
}\r
\r
} // namespace DevelTapGesture\r
\r
} // namespace Dali\r
-\r
\r
namespace Dali\r
{\r
-\r
namespace DevelTapGesture\r
{\r
-\r
/**\r
* @brief Creates an initialized TapGesture.\r
*\r
* @param[in] state The state of the TapGesture\r
* @return A handle to a newly allocated Dali resource\r
*/\r
-DALI_CORE_API TapGesture New( GestureState state );\r
+DALI_CORE_API TapGesture New(GestureState state);\r
\r
} // namespace DevelTapGesture\r
\r
namespace Dali
{
-
TouchPoint::TouchPoint(int32_t id, PointState::Type state, float screenX, float screenY)
: deviceId(id),
state(state),
#include <cstdint> // uint32_t
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/point-state.h>
#include <dali/public-api/math/vector2.h>
\r
namespace Dali\r
{\r
-\r
namespace DevelWheelEvent\r
{\r
-\r
-WheelEvent New( WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp )\r
+WheelEvent New(WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp)\r
{\r
- Internal::WheelEventPtr internal = Internal::WheelEvent::New( type, direction, modifiers, point, delta, timeStamp );\r
+ Internal::WheelEventPtr internal = Internal::WheelEvent::New(type, direction, modifiers, point, delta, timeStamp);\r
\r
- return WheelEvent( internal.Get() );\r
+ return WheelEvent(internal.Get());\r
}\r
\r
-} // namespace DevelKeyEvent\r
+} // namespace DevelWheelEvent\r
\r
} // namespace Dali\r
-\r
\r
namespace Dali\r
{\r
-\r
namespace DevelWheelEvent\r
{\r
-\r
/**\r
* @brief Creates an initialized WheelEvent.\r
*\r
* @param[in] timeStamp The time the wheel is being rolled\r
* @return A handle to a newly allocated Dali resource\r
*/\r
-DALI_CORE_API WheelEvent New( WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );\r
-\r
+DALI_CORE_API WheelEvent New(WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp);\r
\r
} // namespace DevelWheelEvent\r
\r
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/devel-api/images/distance-field.h>
// EXTERNAL INCLUDES
-#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <time.h>
+#include <algorithm>
// INTERNAL INCLUDES
#include <dali/public-api/common/constants.h>
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/math-utils.h>
+#include <dali/public-api/math/vector2.h>
namespace Dali
{
-
namespace
{
-
-float Interpolate( float a, float b, float factor )
+float Interpolate(float a, float b, float factor)
{
return a * (1.0f - factor) + b * factor;
}
-float Bilinear( float a, float b, float c, float d, float dx, float dy )
+float Bilinear(float a, float b, float c, float d, float dx, float dy)
{
- return Interpolate( Interpolate( a, b, dx), Interpolate( c, d, dx ), dy );
+ return Interpolate(Interpolate(a, b, dx), Interpolate(c, d, dx), dy);
}
-void ScaleField( int width, int height, float* in, uint32_t targetWidth, uint32_t targetHeight, float* out )
+void ScaleField(int width, int height, float* in, uint32_t targetWidth, uint32_t targetHeight, float* out)
{
- float xScale = static_cast<float>( width ) / static_cast<float>( targetWidth );
- float yScale = static_cast<float>( height ) / static_cast<float>( targetHeight );
+ float xScale = static_cast<float>(width) / static_cast<float>(targetWidth);
+ float yScale = static_cast<float>(height) / static_cast<float>(targetHeight);
// for each row in target
for(uint32_t y = 0; y < targetHeight; ++y)
{
- const int32_t sampleY = static_cast< int32_t >( yScale * static_cast<float>( y ) );
- const int32_t otherY = std::min( sampleY + 1, height - 1 );
- const float dy = (yScale * static_cast<float>( y ) ) - static_cast<float>( sampleY );
+ const int32_t sampleY = static_cast<int32_t>(yScale * static_cast<float>(y));
+ const int32_t otherY = std::min(sampleY + 1, height - 1);
+ const float dy = (yScale * static_cast<float>(y)) - static_cast<float>(sampleY);
// for each column in target
- for (uint32_t x = 0; x < targetWidth; ++x)
+ for(uint32_t x = 0; x < targetWidth; ++x)
{
- const int32_t sampleX = static_cast< int32_t >( xScale * static_cast<float>( x ) );
- const int32_t otherX = std::min( sampleX + 1, width - 1 );
- const float dx = (xScale * static_cast<float>( x ) ) - static_cast<float>( sampleX );
-
- float value = Bilinear( in[ sampleY * width + sampleX ],
- in[ sampleY * width + otherX ],
- in[ otherY * width + sampleX ],
- in[ otherY * width + otherX ],
- dx, dy );
-
- out[y * targetWidth + x] = std::min( value, 1.0f );
+ const int32_t sampleX = static_cast<int32_t>(xScale * static_cast<float>(x));
+ const int32_t otherX = std::min(sampleX + 1, width - 1);
+ const float dx = (xScale * static_cast<float>(x)) - static_cast<float>(sampleX);
+
+ float value = Bilinear(in[sampleY * width + sampleX],
+ in[sampleY * width + otherX],
+ in[otherY * width + sampleX],
+ in[otherY * width + otherX],
+ dx,
+ dy);
+
+ out[y * targetWidth + x] = std::min(value, 1.0f);
}
}
}
#define SQUARE(a) ((a) * (a))
-const float MAX_DISTANCE = static_cast<float>( 1e20 );
+const float MAX_DISTANCE = static_cast<float>(1e20);
/**
* Distance transform of 1D function using squared distance
*/
-void DistanceTransform( float *source, float* dest, uint32_t length )
+void DistanceTransform(float* source, float* dest, uint32_t length)
{
- std::vector<int32_t> parabolas(length); // Locations of parabolas in lower envelope
- std::vector<float> edge(length + 1); // Locations of boundaries between parabolas
+ std::vector<int32_t> parabolas(length); // Locations of parabolas in lower envelope
+ std::vector<float> edge(length + 1); // Locations of boundaries between parabolas
- int32_t rightmost(0); // Index of rightmost parabola in lower envelope
+ int32_t rightmost(0); // Index of rightmost parabola in lower envelope
parabolas[0] = 0;
- edge[0] = -MAX_DISTANCE;
- edge[1] = +MAX_DISTANCE;
- for( uint32_t i = 1; i <= length - 1; i++ )
+ edge[0] = -MAX_DISTANCE;
+ edge[1] = +MAX_DISTANCE;
+ for(uint32_t i = 1; i <= length - 1; i++)
{
- const float initialDistance( source[i] + static_cast<float>( i*i ) );
- int32_t parabola = parabolas[rightmost];
- float newDistance( (initialDistance - (source[parabola] + static_cast<float>( parabola * parabola ))) / static_cast<float>(2 * i - 2 * parabola) );
- while( rightmost > 0 && newDistance <= edge[rightmost] )
+ const float initialDistance(source[i] + static_cast<float>(i * i));
+ int32_t parabola = parabolas[rightmost];
+
+ float newDistance((initialDistance - (source[parabola] + static_cast<float>(parabola * parabola))) / static_cast<float>(2 * i - 2 * parabola));
+
+ while(rightmost > 0 && newDistance <= edge[rightmost])
{
rightmost--;
- parabola = parabolas[rightmost];
- newDistance = (initialDistance - (source[parabola] + static_cast<float>( parabola * parabola ))) / static_cast<float>(2 * i - 2 * parabola);
+ parabola = parabolas[rightmost];
+ newDistance = (initialDistance - (source[parabola] + static_cast<float>(parabola * parabola))) / static_cast<float>(2 * i - 2 * parabola);
}
rightmost++;
parabolas[rightmost] = i;
- edge[rightmost] = newDistance;
- edge[rightmost + 1] = MAX_DISTANCE;
+ edge[rightmost] = newDistance;
+ edge[rightmost + 1] = MAX_DISTANCE;
}
rightmost = 0;
- for( uint32_t i = 0; i <= length - 1; ++i )
+ for(uint32_t i = 0; i <= length - 1; ++i)
{
- while( edge[rightmost + 1] < static_cast<float>( i ) )
+ while(edge[rightmost + 1] < static_cast<float>(i))
{
++rightmost;
}
- dest[i] = static_cast<float>( SQUARE( static_cast< int32_t >( i ) - parabolas[rightmost] ) ) + source[parabolas[rightmost]];
+ dest[i] = static_cast<float>(SQUARE(static_cast<int32_t>(i) - parabolas[rightmost])) + source[parabolas[rightmost]];
}
}
/**
* Distance transform of 2D function using squared distance
*/
-void DistanceTransform( float* data, uint32_t width, uint32_t height, float* sourceBuffer, float* destBuffer )
+void DistanceTransform(float* data, uint32_t width, uint32_t height, float* sourceBuffer, float* destBuffer)
{
// transform along columns
- for( uint32_t x = 0; x < width; ++x )
+ for(uint32_t x = 0; x < width; ++x)
{
- for( uint32_t y = 0; y < height; ++y )
+ for(uint32_t y = 0; y < height; ++y)
{
- sourceBuffer[y] = data[ y * width + x ];
+ sourceBuffer[y] = data[y * width + x];
}
- DistanceTransform( sourceBuffer, destBuffer, height );
+ DistanceTransform(sourceBuffer, destBuffer, height);
- for( uint32_t y = 0; y < height; y++ )
+ for(uint32_t y = 0; y < height; y++)
{
data[y * width + x] = destBuffer[y];
}
}
// transform along rows
- for( uint32_t y = 0; y < height; ++y )
+ for(uint32_t y = 0; y < height; ++y)
{
- for( uint32_t x = 0; x < width; ++x )
+ for(uint32_t x = 0; x < width; ++x)
{
- sourceBuffer[x] = data[ y * width + x ];
+ sourceBuffer[x] = data[y * width + x];
}
- DistanceTransform( sourceBuffer, destBuffer, width );
+ DistanceTransform(sourceBuffer, destBuffer, width);
- for( uint32_t x = 0; x < width; x++ )
+ for(uint32_t x = 0; x < width; x++)
{
data[y * width + x] = destBuffer[x];
}
} // namespace
-void GenerateDistanceFieldMap(const uint8_t* const imagePixels, const Size& imageSize,
- uint8_t* const distanceMap, const Size& distanceMapSize,
- const float fieldRadius, const uint32_t fieldBorder, bool highQuality)
+void GenerateDistanceFieldMap(const uint8_t* const imagePixels, const Size& imageSize, uint8_t* const distanceMap, const Size& distanceMapSize, const float fieldRadius, const uint32_t fieldBorder, bool highQuality)
{
- GenerateDistanceFieldMap( imagePixels, imageSize, distanceMap, distanceMapSize, fieldBorder, imageSize, highQuality );
+ GenerateDistanceFieldMap(imagePixels, imageSize, distanceMap, distanceMapSize, fieldBorder, imageSize, highQuality);
}
-void GenerateDistanceFieldMap( const uint8_t* const imagePixels, const Size& imageSize,
- uint8_t* const distanceMap, const Size& distanceMapSize,
- const uint32_t fieldBorder,
- const Vector2& maxSize,
- bool highQuality )
+void GenerateDistanceFieldMap(const uint8_t* const imagePixels, const Size& imageSize, uint8_t* const distanceMap, const Size& distanceMapSize, const uint32_t fieldBorder, const Vector2& maxSize, bool highQuality)
{
// constants to reduce redundant calculations
- const uint32_t originalWidth( static_cast<int32_t>(imageSize.width) );
- const uint32_t originalHeight( static_cast<int32_t>(imageSize.height) );
- const uint32_t paddedWidth( originalWidth + (fieldBorder * 2 ) );
- const uint32_t paddedHeight( originalHeight + (fieldBorder * 2 ) );
- const uint32_t scaledWidth( static_cast<int32_t>(distanceMapSize.width) );
- const uint32_t scaledHeight( static_cast<int32_t>(distanceMapSize.height) );
- const uint32_t maxWidth( static_cast<int32_t>(maxSize.width) + (fieldBorder * 2 ));
- const uint32_t maxHeight( static_cast<int32_t>(maxSize.height) + (fieldBorder * 2 ) );
+ const uint32_t originalWidth(static_cast<int32_t>(imageSize.width));
+ const uint32_t originalHeight(static_cast<int32_t>(imageSize.height));
+ const uint32_t paddedWidth(originalWidth + (fieldBorder * 2));
+ const uint32_t paddedHeight(originalHeight + (fieldBorder * 2));
+ const uint32_t scaledWidth(static_cast<int32_t>(distanceMapSize.width));
+ const uint32_t scaledHeight(static_cast<int32_t>(distanceMapSize.height));
+ const uint32_t maxWidth(static_cast<int32_t>(maxSize.width) + (fieldBorder * 2));
+ const uint32_t maxHeight(static_cast<int32_t>(maxSize.height) + (fieldBorder * 2));
- const uint32_t bufferLength( std::max( maxWidth, std::max(paddedWidth, scaledWidth) ) *
- std::max( maxHeight, std::max(paddedHeight, scaledHeight) ) );
+ const uint32_t bufferLength(std::max(maxWidth, std::max(paddedWidth, scaledWidth)) *
+ std::max(maxHeight, std::max(paddedHeight, scaledHeight)));
- std::vector<float> outsidePixels( bufferLength, 0.0f );
- std::vector<float> insidePixels( bufferLength, 0.0f );
+ std::vector<float> outsidePixels(bufferLength, 0.0f);
+ std::vector<float> insidePixels(bufferLength, 0.0f);
- float* outside( outsidePixels.data() );
- float* inside( insidePixels.data() );
+ float* outside(outsidePixels.data());
+ float* inside(insidePixels.data());
- for( uint32_t y = 0; y < paddedHeight; ++y )
+ for(uint32_t y = 0; y < paddedHeight; ++y)
{
- for ( uint32_t x = 0; x < paddedWidth; ++x)
+ for(uint32_t x = 0; x < paddedWidth; ++x)
{
- if( y < static_cast< uint32_t >( fieldBorder ) || y >= ( paddedHeight - static_cast< uint32_t >( fieldBorder ) ) ||
- x < static_cast< uint32_t >( fieldBorder ) || x >= ( paddedWidth - static_cast< uint32_t >( fieldBorder ) ) )
+ if(y < static_cast<uint32_t>(fieldBorder) ||
+ y >= (paddedHeight - static_cast<uint32_t>(fieldBorder)) ||
+ x < static_cast<uint32_t>(fieldBorder) ||
+ x >= (paddedWidth - static_cast<uint32_t>(fieldBorder)))
{
- outside[ y * paddedWidth + x ] = MAX_DISTANCE;
- inside[ y * paddedWidth + x ] = 0.0f;
+ outside[y * paddedWidth + x] = MAX_DISTANCE;
+ inside[y * paddedWidth + x] = 0.0f;
}
else
{
- uint32_t pixel( imagePixels[ (y - fieldBorder) * originalWidth + (x - fieldBorder) ] );
- outside[ y * paddedWidth + x ] = (pixel == 0) ? MAX_DISTANCE : SQUARE( static_cast<float>(255 - pixel) / 255.0f);
- inside[ y * paddedWidth + x ] = (pixel == 255) ? MAX_DISTANCE : SQUARE( static_cast<float>(pixel) / 255.0f);
+ uint32_t pixel(imagePixels[(y - fieldBorder) * originalWidth + (x - fieldBorder)]);
+ outside[y * paddedWidth + x] = (pixel == 0) ? MAX_DISTANCE : SQUARE(static_cast<float>(255 - pixel) / 255.0f);
+ inside[y * paddedWidth + x] = (pixel == 255) ? MAX_DISTANCE : SQUARE(static_cast<float>(pixel) / 255.0f);
}
}
}
// perform distance transform if high quality requested, else use original figure
- if( highQuality )
+ if(highQuality)
{
// create temporary buffers for DistanceTransform()
- const uint32_t tempBufferLength( std::max(paddedWidth, paddedHeight) );
- std::vector<float> tempSourceBuffer( tempBufferLength, 0.0f );
- std::vector<float> tempDestBuffer( tempBufferLength, 0.0f );
+ const uint32_t tempBufferLength(std::max(paddedWidth, paddedHeight));
+ std::vector<float> tempSourceBuffer(tempBufferLength, 0.0f);
+ std::vector<float> tempDestBuffer(tempBufferLength, 0.0f);
// Perform distance transform for pixels 'outside' the figure
- DistanceTransform( outside, paddedWidth, paddedHeight, tempSourceBuffer.data(), tempDestBuffer.data() );
+ DistanceTransform(outside, paddedWidth, paddedHeight, tempSourceBuffer.data(), tempDestBuffer.data());
// Perform distance transform for pixels 'inside' the figure
- DistanceTransform( inside, paddedWidth, paddedHeight, tempSourceBuffer.data(), tempDestBuffer.data() );
+ DistanceTransform(inside, paddedWidth, paddedHeight, tempSourceBuffer.data(), tempDestBuffer.data());
}
// distmap = outside - inside; % Bipolar distance field
- for( uint32_t y = 0; y < paddedHeight; ++y)
+ for(uint32_t y = 0; y < paddedHeight; ++y)
{
- for( uint32_t x = 0; x < paddedWidth; ++x )
+ for(uint32_t x = 0; x < paddedWidth; ++x)
{
- const int32_t offset( y * paddedWidth + x );
- float pixel( sqrtf(outside[offset]) - sqrtf(inside[offset]) );
- pixel = 128.0f + pixel * 16.0f;
- pixel = Clamp( pixel, 0.0f, 255.0f );
+ const int32_t offset(y * paddedWidth + x);
+ float pixel(sqrtf(outside[offset]) - sqrtf(inside[offset]));
+ pixel = 128.0f + pixel * 16.0f;
+ pixel = Clamp(pixel, 0.0f, 255.0f);
outside[offset] = (255.0f - pixel) / 255.0f;
}
}
// scale the figure to the distance field tile size
- ScaleField( paddedWidth, paddedHeight, outside, scaledWidth, scaledHeight, inside );
+ ScaleField(paddedWidth, paddedHeight, outside, scaledWidth, scaledHeight, inside);
// convert from floats to integers
- for( uint32_t y = 0; y < scaledHeight; ++y )
+ for(uint32_t y = 0; y < scaledHeight; ++y)
{
- for( uint32_t x = 0; x < scaledWidth; ++x )
+ for(uint32_t x = 0; x < scaledWidth; ++x)
{
- float pixel( inside[ y * scaledWidth + x ] );
- distanceMap[y * scaledWidth + x ] = static_cast< uint8_t >(pixel * 255.0f);
+ float pixel(inside[y * scaledWidth + x]);
+ distanceMap[y * scaledWidth + x] = static_cast<uint8_t>(pixel * 255.0f);
}
}
}
#define DALI_DISTANCE_FIELD_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
struct Vector2;
/**
* @param[in] maxSize The image is scaled from this size to distanceMapSize
* @param[in] highQuality Set true to generate high quality distance fields
*/
-DALI_CORE_API void GenerateDistanceFieldMap( const uint8_t* const imagePixels, const Vector2& imageSize,
- uint8_t* const distanceMap, const Vector2& distanceMapSize,
- const uint32_t fieldBorder,
- const Vector2& maxSize,
- bool highQuality = true );
+DALI_CORE_API void GenerateDistanceFieldMap(
+ const uint8_t* const imagePixels,
+ const Vector2& imageSize,
+ uint8_t* const distanceMap,
+ const Vector2& distanceMapSize,
+ const uint32_t fieldBorder,
+ const Vector2& maxSize,
+ bool highQuality = true);
} //namespace Dali
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace DevelPixelData
{
-
-PixelDataBuffer ReleasePixelDataBuffer( PixelData& pixelData )
+PixelDataBuffer ReleasePixelDataBuffer(PixelData& pixelData)
{
- Internal::PixelData& pixelDataImpl = GetImplementation( pixelData );
- PixelDataBuffer pixelDataBuffer = pixelDataImpl.ReleaseBuffer();
+ Internal::PixelData& pixelDataImpl = GetImplementation(pixelData);
+ PixelDataBuffer pixelDataBuffer = pixelDataImpl.ReleaseBuffer();
pixelData.Reset();
return pixelDataBuffer;
}
#define DALI_PIXEL_DATA_DEVEL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace DevelPixelData
{
-
/**
* Struct to keep the buffer pointer and the allocation method.
*
*/
struct PixelDataBuffer
{
- uint8_t* buffer;
- uint32_t bufferSize;
+ uint8_t* buffer;
+ uint32_t bufferSize;
PixelData::ReleaseFunction releaseFunction;
- PixelDataBuffer( uint8_t* buffer,
- uint32_t bufferSize,
- PixelData::ReleaseFunction releaseFunction )
+ PixelDataBuffer(uint8_t* buffer,
+ uint32_t bufferSize,
+ PixelData::ReleaseFunction releaseFunction)
: buffer(buffer),
bufferSize(bufferSize),
releaseFunction(releaseFunction)
* @param[in,out] pixelData The pixel data object to take the buffer from
* @return the buffer and the data release mechanism
*/
-DALI_CORE_API PixelDataBuffer ReleasePixelDataBuffer( PixelData& pixelData );
+DALI_CORE_API PixelDataBuffer ReleasePixelDataBuffer(PixelData& pixelData);
} // namespace DevelPixelData
-} // Dali
+} // namespace Dali
#endif // DALI_PIXEL_DATA_DEVEL_H
namespace Dali
{
-
namespace CSharpTypeInfo
{
-
/**
* @brief Call back used to create an instance of the associated object type
*
* @param[in] typeName The type name of the object to be created.
* @return Pointer to a BaseHandle
*/
-using CreateFunction = BaseHandle *(*)( const char *const );
+using CreateFunction = BaseHandle* (*)(const char* const);
/**
* @brief Callback to set an event-thread only property.
* @param[in] value The new value of the property for the object specified.
* @see PropertyRegistration.
*/
-using SetPropertyFunction = void ( * )( BaseObject *, const char *const, Property::Value * );
+using SetPropertyFunction = void (*)(BaseObject*, const char* const, Property::Value*);
/**
* @brief Callback to get the value of an event-thread only property.
* @return The current value of the property for the object specified.
* @see PropertyRegistration.
*/
-using GetPropertyFunction = Property::Value *(*)( BaseObject *, const char *const );
-}
+using GetPropertyFunction = Property::Value* (*)(BaseObject*, const char* const);
+} // namespace CSharpTypeInfo
} // namespace Dali
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace CSharpTypeRegistry
{
-
-bool RegisterType( const std::string& name, const std::type_info& baseType, CSharpTypeInfo::CreateFunction f )
+bool RegisterType(const std::string& name, const std::type_info& baseType, CSharpTypeInfo::CreateFunction f)
{
- Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
+ Internal::TypeRegistry* impl = Internal::TypeRegistry::Get();
- impl->Register( name, baseType, f );
+ impl->Register(name, baseType, f);
return true;
}
-bool RegisterProperty( const std::string& objectName,
- const std::string& name,
- Property::Index index,
- Property::Type type,
- CSharpTypeInfo::SetPropertyFunction setFunc,
- CSharpTypeInfo::GetPropertyFunction getFunc )
+bool RegisterProperty(const std::string& objectName,
+ const std::string& name,
+ Property::Index index,
+ Property::Type type,
+ CSharpTypeInfo::SetPropertyFunction setFunc,
+ CSharpTypeInfo::GetPropertyFunction getFunc)
{
+ Internal::TypeRegistry* impl = Internal::TypeRegistry::Get();
- Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
-
- return impl->RegisterProperty( objectName, name, index, type, setFunc, getFunc );
+ return impl->RegisterProperty(objectName, name, index, type, setFunc, getFunc);
}
-}
+} // namespace CSharpTypeRegistry
} // namespace Dali
#define DALI_CSHARP_TYPE_REGISTRY_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
*/
-
// EXTERNAL INCLUDES
#include <typeinfo>
-
// INTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
#include <dali/devel-api/object/csharp-type-info.h>
+#include <dali/public-api/object/type-registry.h>
namespace Dali
{
-
-
/**
* Custom static functions for registering C# custom controls and properties
*
*/
namespace CSharpTypeRegistry
{
-
/**
* @brief Constructor registers the type creation function for a named class or type.
*
* @param [in] f registerType instance creation function
* @return true if the name could be registered.
*/
- DALI_CORE_API bool RegisterType( const std::string& name,
- const std::type_info& baseType,
- CSharpTypeInfo::CreateFunction f );
+DALI_CORE_API bool RegisterType(const std::string& name,
+ const std::type_info& baseType,
+ CSharpTypeInfo::CreateFunction f);
- /**
+/**
* Register an event-thread only property with a type (used by C# Custom controls)
* @param [in] objectName name of the object used to register the type
* @param [in] name Property name
* @param [in] getFunc The function to get the value of a property.
* @return true if the property could be registered.
*/
- DALI_CORE_API bool RegisterProperty( const std::string& objectName,
- const std::string& name,
- Property::Index index,
- Property::Type type,
- CSharpTypeInfo::SetPropertyFunction setFunc,
- CSharpTypeInfo::GetPropertyFunction getFunc );
-}
+DALI_CORE_API bool RegisterProperty(const std::string& objectName,
+ const std::string& name,
+ Property::Index index,
+ Property::Type type,
+ CSharpTypeInfo::SetPropertyFunction setFunc,
+ CSharpTypeInfo::GetPropertyFunction getFunc);
+} // namespace CSharpTypeRegistry
} // namespace Dali
#include <dali/devel-api/object/handle-devel.h>
// INTERNAL INCLUDES
-#include <dali/public-api/object/property-key.h>
#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/common/type-info-impl.h>
+#include <dali/public-api/object/property-key.h>
namespace Dali
{
-
namespace DevelHandle
{
-
-void SetTypeInfo( Handle& handle, const TypeInfo& typeInfo )
+void SetTypeInfo(Handle& handle, const TypeInfo& typeInfo)
{
- GetImplementation( handle ).SetTypeInfo( &GetImplementation( typeInfo ) );
+ GetImplementation(handle).SetTypeInfo(&GetImplementation(typeInfo));
}
} // namespace DevelHandle
namespace Dali
{
-
namespace DevelHandle
{
-
/**
* @brief Set the type-info that the object is created by.
*
* @param[in] handle The handle created by this TypeInfo.
* @param[in] typeInfo The TypeInfo that creates the handle.
*/
-DALI_CORE_API void SetTypeInfo( Handle& handle, const TypeInfo& typeInfo );
+DALI_CORE_API void SetTypeInfo(Handle& handle, const TypeInfo& typeInfo);
} // namespace DevelHandle
* These internal macros exist as to perform the compile-time check on the enumeration order, the __COUNTER__ macro is used twice.
* Using it twice within the same macro would result in two different values.
*/
-#define DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, develNamespace, text, valueType, enumIndex ) \
- Dali::PropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace:: develNamespace ::Property::enumIndex, Dali::Property::valueType, &objectType::SetProperty, &objectType::GetProperty ); \
- static_assert( ( objectNamespace:: develNamespace ::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX ) == count );
+#define DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL(count, typeRegistrationObject, objectNamespace, objectType, develNamespace, text, valueType, enumIndex) \
+ Dali::PropertyRegistration DALI_TOKEN_PASTE(property, count)(typeRegistrationObject, text, objectNamespace::develNamespace ::Property::enumIndex, Dali::Property::valueType, &objectType::SetProperty, &objectType::GetProperty); \
+ static_assert((objectNamespace::develNamespace ::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX) == count);
-#define DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY( count, typeRegistrationObject, objectNamespace, objectType, develNamespace, text, valueType, enumIndex ) \
- Dali::PropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace:: develNamespace ::Property::enumIndex, Dali::Property::valueType, NULL, &objectType::GetProperty ); \
- static_assert( ( objectNamespace:: develNamespace ::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX ) == count );
+#define DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY(count, typeRegistrationObject, objectNamespace, objectType, develNamespace, text, valueType, enumIndex) \
+ Dali::PropertyRegistration DALI_TOKEN_PASTE(property, count)(typeRegistrationObject, text, objectNamespace::develNamespace ::Property::enumIndex, Dali::Property::valueType, NULL, &objectType::GetProperty); \
+ static_assert((objectNamespace::develNamespace ::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX) == count);
/**
* @brief These macros are used to define properties for implementations of CustomActor.
* Using these macros have certain prerequisites on how the property enumeration is defined.
* Please see the Programming Guide (within the generated Doxygen) for full details.
*/
-#define DALI_DEVEL_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, DALI_TOKEN_PASTE( Devel, objectType ), text, valueType, enumIndex )
+#define DALI_DEVEL_PROPERTY_REGISTRATION(objectNamespace, objectType, text, valueType, enumIndex) \
+ DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, DALI_TOKEN_PASTE(Devel, objectType), text, valueType, enumIndex)
/**
* @copydoc DALI_DEVEL_PROPERTY_REGISTRATION
*
* @note For Read Only properties
*/
-#define DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY( __COUNTER__, typeRegistration, objectNamespace, objectType, DALI_TOKEN_PASTE( Devel, objectType ), text, valueType, enumIndex )
+#define DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(objectNamespace, objectType, text, valueType, enumIndex) \
+ DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY(__COUNTER__, typeRegistration, objectNamespace, objectType, DALI_TOKEN_PASTE(Devel, objectType), text, valueType, enumIndex)
/**
* @copydoc DALI_DEVEL_PROPERTY_REGISTRATION
*
* @note Animatable property registration
*/
-#define DALI_DEVEL_ANIMATABLE_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, DALI_TOKEN_PASTE( Devel, objectType ), text, valueType, enumIndex )
+#define DALI_DEVEL_ANIMATABLE_PROPERTY_REGISTRATION(objectNamespace, objectType, text, valueType, enumIndex) \
+ DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, DALI_TOKEN_PASTE(Devel, objectType), text, valueType, enumIndex)
/**
* @copydoc DALI_DEVEL_PROPERTY_REGISTRATION
* @note Animatable property registration with default value
*
*/
-#define DALI_DEVEL_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( objectNamespace, objectType, text, value, enumIndex ) \
- DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, DALI_TOKEN_PASTE( Devel, objectType ) , text, value, enumIndex )
+#define DALI_DEVEL_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(objectNamespace, objectType, text, value, enumIndex) \
+ DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, DALI_TOKEN_PASTE(Devel, objectType), text, value, enumIndex)
/**
* @copydoc DALI_DEVEL_PROPERTY_REGISTRATION
* @note Component registration for a Devel Animatable property
*
*/
-#define DALI_DEVEL_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex ) \
- DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, DALI_TOKEN_PASTE( Devel, objectType ), text, enumIndex, baseEnumIndex, componentIndex )
+#define DALI_DEVEL_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex) \
+ DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, DALI_TOKEN_PASTE(Devel, objectType), text, enumIndex, baseEnumIndex, componentIndex)
#endif // DALI_PROPERTY_HELPER_DEVEL_H
namespace Dali
{
-
namespace DevelFrameBuffer
{
-
-void AttachDepthTexture( FrameBuffer frameBuffer, Texture& texture )
+void AttachDepthTexture(FrameBuffer frameBuffer, Texture& texture)
{
- AttachDepthTexture( frameBuffer, texture, 0u );
+ AttachDepthTexture(frameBuffer, texture, 0u);
}
-void AttachDepthTexture( FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel )
+void AttachDepthTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel)
{
- if( texture )
+ if(texture)
{
- Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
- GetImplementation( frameBuffer ).AttachDepthTexture( texturePtr, mipmapLevel );
+ Internal::TexturePtr texturePtr(&GetImplementation(texture));
+ GetImplementation(frameBuffer).AttachDepthTexture(texturePtr, mipmapLevel);
}
}
-void AttachDepthStencilTexture( FrameBuffer frameBuffer, Texture& texture )
+void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture)
{
- AttachDepthStencilTexture( frameBuffer, texture, 0u );
+ AttachDepthStencilTexture(frameBuffer, texture, 0u);
}
-void AttachDepthStencilTexture( FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel )
+void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel)
{
- if( texture )
+ if(texture)
{
- Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
- GetImplementation( frameBuffer ).AttachDepthStencilTexture( texturePtr, mipmapLevel );
+ Internal::TexturePtr texturePtr(&GetImplementation(texture));
+ GetImplementation(frameBuffer).AttachDepthStencilTexture(texturePtr, mipmapLevel);
}
}
-Texture GetColorTexture( const FrameBuffer frameBuffer, uint8_t index )
+Texture GetColorTexture(const FrameBuffer frameBuffer, uint8_t index)
{
- Internal::Texture* texturePtr = GetImplementation( frameBuffer ).GetColorTexture(index);
- return Dali::Texture( texturePtr );
+ Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetColorTexture(index);
+ return Dali::Texture(texturePtr);
}
-Texture GetDepthTexture( FrameBuffer frameBuffer )
+Texture GetDepthTexture(FrameBuffer frameBuffer)
{
Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetDepthTexture();
- return Dali::Texture( texturePtr );
+ return Dali::Texture(texturePtr);
}
-Texture GetDepthStencilTexture( FrameBuffer frameBuffer )
+Texture GetDepthStencilTexture(FrameBuffer frameBuffer)
{
Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetDepthStencilTexture();
- return Dali::Texture( texturePtr );
+ return Dali::Texture(texturePtr);
}
} // namespace DevelFrameBuffer
namespace Dali
{
-
namespace DevelFrameBuffer
{
-
/**
* @brief Maximum number of color attachments supported.
*/
* @note The size of the texture has to be same as that of the frame buffer.
* Otherwise, it won't be attached.
*/
-DALI_CORE_API void AttachDepthTexture( FrameBuffer frameBuffer, Texture& texture );
+DALI_CORE_API void AttachDepthTexture(FrameBuffer frameBuffer, Texture& texture);
/**
* @brief Attaches a depth texture to the frame buffer.
* @note The size of the mipmapped texture has to be same as that of the frame buffer.
* Otherwise, it won't be attached.
*/
-DALI_CORE_API void AttachDepthTexture( FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel );
+DALI_CORE_API void AttachDepthTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel);
/**
* @brief Attaches the base LOD of a stencil texture to the frame buffer.
* @note The size of the texture has to be same as that of the frame buffer.
* Otherwise, it won't be attached.
*/
-DALI_CORE_API void AttachDepthStencilTexture( FrameBuffer frameBuffer, Texture& texture );
+DALI_CORE_API void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture);
/**
* @brief Attaches a depth/stencil texture to the frame buffer.
* @note The size of the mipmapped texture has to be same as that of the frame buffer.
* Otherwise, it won't be attached.
*/
-DALI_CORE_API void AttachDepthStencilTexture( FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel );
+DALI_CORE_API void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel);
/**
* @brief Gets the color texture at the given @a index used as output in the frame buffer.
* @note A maximum of 8 color attachments are supported. Passing an invalid index will return
* an uninitialized handle.
*/
-DALI_CORE_API Texture GetColorTexture( const FrameBuffer frameBuffer, uint8_t index );
+DALI_CORE_API Texture GetColorTexture(const FrameBuffer frameBuffer, uint8_t index);
/**
* @brief Gets the depth texture used as output in the frame buffer.
*
* @return A handle of the texture used as depth output, or an uninitialized handle
*/
-DALI_CORE_API Texture GetDepthTexture( FrameBuffer frameBuffer );
+DALI_CORE_API Texture GetDepthTexture(FrameBuffer frameBuffer);
/**
* @brief Gets the depth/stencil texture used as output in the frame buffer.
*
* @return A handle of the texture used as depth/stencil output, or an uninitialized handle
*/
-DALI_CORE_API Texture GetDepthStencilTexture( FrameBuffer frameBuffer );
+DALI_CORE_API Texture GetDepthStencilTexture(FrameBuffer frameBuffer);
} // namespace DevelFrameBuffer
namespace Dali
{
-
namespace DevelRenderer
{
-
-void AddDrawCommand( Dali::Renderer renderer, const DrawCommand& drawCommand )
+void AddDrawCommand(Dali::Renderer renderer, const DrawCommand& drawCommand)
{
- auto& impl = GetImplementation( renderer );
- impl.AddDrawCommand( drawCommand );
+ auto& impl = GetImplementation(renderer);
+ impl.AddDrawCommand(drawCommand);
}
-} // DevelRenderer
-} // Dali
\ No newline at end of file
+} // namespace DevelRenderer
+} // namespace Dali
\ No newline at end of file
#define DALI_RENDERER_DEVEL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace DevelRenderer
{
-
/**
* The index of render queue used by the DrawCommand
*/
using RenderQueueIndex = uint32_t;
-constexpr RenderQueueIndex RENDER_QUEUE_OPAQUE = 0; ///< Queue for opaque elements
+constexpr RenderQueueIndex RENDER_QUEUE_OPAQUE = 0; ///< Queue for opaque elements
constexpr RenderQueueIndex RENDER_QUEUE_TRANSPARENT = 1; ///<Queue for transparent elements
-constexpr RenderQueueIndex RENDER_QUEUE_MAX = 2;
+constexpr RenderQueueIndex RENDER_QUEUE_MAX = 2;
/**
* Enum describing way of rendering the primitives (indexed draw, array draw)
*/
struct DrawCommand
{
- DrawType drawType; ///< Type of drawing (indexed, array)
- uint32_t firstIndex ; ///< First index into the geometry array
+ DrawType drawType; ///< Type of drawing (indexed, array)
+ uint32_t firstIndex; ///< First index into the geometry array
uint32_t elementCount; ///< Number of elements to draw
- RenderQueueIndex queue; ///< Queue index
+ RenderQueueIndex queue; ///< Queue index
};
/**
* @param[in] renderer a valid Renderer object
* @param[in] drawCommand Valid DrawCommand to add to the Renderer
*/
-DALI_CORE_API void AddDrawCommand( Dali::Renderer renderer, const DrawCommand& drawCommand );
+DALI_CORE_API void AddDrawCommand(Dali::Renderer renderer, const DrawCommand& drawCommand);
namespace Property
{
-
- enum Type
- {
- DEPTH_INDEX = Dali::Renderer::Property::DEPTH_INDEX,
- FACE_CULLING_MODE = Dali::Renderer::Property::FACE_CULLING_MODE,
- BLEND_MODE = Dali::Renderer::Property::BLEND_MODE,
- BLEND_EQUATION_RGB = Dali::Renderer::Property::BLEND_EQUATION_RGB,
- BLEND_EQUATION_ALPHA = Dali::Renderer::Property::BLEND_EQUATION_ALPHA,
- BLEND_FACTOR_SRC_RGB = Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB,
- BLEND_FACTOR_DEST_RGB = Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB,
- BLEND_FACTOR_SRC_ALPHA = Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA,
- BLEND_FACTOR_DEST_ALPHA = Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA,
- BLEND_COLOR = Dali::Renderer::Property::BLEND_COLOR,
- BLEND_PRE_MULTIPLIED_ALPHA = Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA,
- INDEX_RANGE_FIRST = Dali::Renderer::Property::INDEX_RANGE_FIRST,
- INDEX_RANGE_COUNT = Dali::Renderer::Property::INDEX_RANGE_COUNT,
- DEPTH_WRITE_MODE = Dali::Renderer::Property::DEPTH_WRITE_MODE,
- DEPTH_FUNCTION = Dali::Renderer::Property::DEPTH_FUNCTION,
- DEPTH_TEST_MODE = Dali::Renderer::Property::DEPTH_TEST_MODE,
- RENDER_MODE = Dali::Renderer::Property::RENDER_MODE,
- STENCIL_FUNCTION = Dali::Renderer::Property::STENCIL_FUNCTION,
- STENCIL_FUNCTION_MASK = Dali::Renderer::Property::STENCIL_FUNCTION_MASK,
- STENCIL_FUNCTION_REFERENCE = Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE,
- STENCIL_MASK = Dali::Renderer::Property::STENCIL_MASK,
- STENCIL_OPERATION_ON_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL,
- STENCIL_OPERATION_ON_Z_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL,
- STENCIL_OPERATION_ON_Z_PASS = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS,
-
- /**
+enum Type
+{
+ DEPTH_INDEX = Dali::Renderer::Property::DEPTH_INDEX,
+ FACE_CULLING_MODE = Dali::Renderer::Property::FACE_CULLING_MODE,
+ BLEND_MODE = Dali::Renderer::Property::BLEND_MODE,
+ BLEND_EQUATION_RGB = Dali::Renderer::Property::BLEND_EQUATION_RGB,
+ BLEND_EQUATION_ALPHA = Dali::Renderer::Property::BLEND_EQUATION_ALPHA,
+ BLEND_FACTOR_SRC_RGB = Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB,
+ BLEND_FACTOR_DEST_RGB = Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB,
+ BLEND_FACTOR_SRC_ALPHA = Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA,
+ BLEND_FACTOR_DEST_ALPHA = Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA,
+ BLEND_COLOR = Dali::Renderer::Property::BLEND_COLOR,
+ BLEND_PRE_MULTIPLIED_ALPHA = Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA,
+ INDEX_RANGE_FIRST = Dali::Renderer::Property::INDEX_RANGE_FIRST,
+ INDEX_RANGE_COUNT = Dali::Renderer::Property::INDEX_RANGE_COUNT,
+ DEPTH_WRITE_MODE = Dali::Renderer::Property::DEPTH_WRITE_MODE,
+ DEPTH_FUNCTION = Dali::Renderer::Property::DEPTH_FUNCTION,
+ DEPTH_TEST_MODE = Dali::Renderer::Property::DEPTH_TEST_MODE,
+ RENDER_MODE = Dali::Renderer::Property::RENDER_MODE,
+ STENCIL_FUNCTION = Dali::Renderer::Property::STENCIL_FUNCTION,
+ STENCIL_FUNCTION_MASK = Dali::Renderer::Property::STENCIL_FUNCTION_MASK,
+ STENCIL_FUNCTION_REFERENCE = Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE,
+ STENCIL_MASK = Dali::Renderer::Property::STENCIL_MASK,
+ STENCIL_OPERATION_ON_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL,
+ STENCIL_OPERATION_ON_Z_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL,
+ STENCIL_OPERATION_ON_Z_PASS = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS,
+
+ /**
* @brief The opacity of the renderer.
* @details Name "opacity", type Property::FLOAT.
*/
- OPACITY = STENCIL_OPERATION_ON_Z_PASS + 1,
+ OPACITY = STENCIL_OPERATION_ON_Z_PASS + 1,
- /**
+ /**
* @brief The rendering behavior of the renderer.
* @details Name "renderingBehavior", type Property::INTEGER.
*/
- RENDERING_BEHAVIOR = STENCIL_OPERATION_ON_Z_PASS + 2,
- };
+ RENDERING_BEHAVIOR = STENCIL_OPERATION_ON_Z_PASS + 2,
+};
} // namespace Property
namespace Rendering
{
-
-
-
/**
* @brief Enumeration for the rendering behavior
*/
enum Type
{
- IF_REQUIRED, ///< Default. Will only render if required to do so.
- CONTINUOUSLY ///< Will render continuously.
+ IF_REQUIRED, ///< Default. Will only render if required to do so.
+ CONTINUOUSLY ///< Will render continuously.
};
} // namespace Rendering
#define DALI_ENUM_HELPER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
/**
* Macros for creating value, typically enumerations, to string tables.
* Example:
* By default, Dali::Scripting::StringEnum is used as the type for the table, however, a different type can be specified by using
* DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE.
*/
-#define DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE( type, t ) const type t##_TABLE[] = {
-#define DALI_ENUM_TO_STRING_TABLE_BEGIN( t ) DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE( Dali::Scripting::StringEnum, t )
-#define DALI_ENUM_TO_STRING_TABLE_END( t ) }; const uint32_t t##_TABLE_COUNT = static_cast<uint32_t>( sizeof( t##_TABLE ) / sizeof( t##_TABLE[0] ) );
-#define DALI_ENUM_TO_STRING( s ) { #s, s },
+#define DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE(type, t) const type t##_TABLE[] = {
+#define DALI_ENUM_TO_STRING_TABLE_BEGIN(t) DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE(Dali::Scripting::StringEnum, t)
+#define DALI_ENUM_TO_STRING_TABLE_END(t) \
+ } \
+ ; \
+ const uint32_t t##_TABLE_COUNT = static_cast<uint32_t>(sizeof(t##_TABLE) / sizeof(t##_TABLE[0]));
+#define DALI_ENUM_TO_STRING(s) {#s, s},
/**
* Adds a value, typically an enum, to the table within a scope but without the scope name
* Example converts ( Layer, LAYER_UI ) to ( "LAYER_UI", Layer::LayerUI )
*/
-#define DALI_ENUM_TO_STRING_WITH_SCOPE( className, enumName ) { #enumName, className::enumName },
+#define DALI_ENUM_TO_STRING_WITH_SCOPE(className, enumName) {#enumName, className::enumName},
} // namespace Dali
#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
+#include <dali/internal/event/common/property-helper.h>
#include <dali/public-api/actors/actor.h>
-#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/property-array.h>
-#include <dali/internal/event/common/property-helper.h>
+#include <dali/public-api/object/type-registry.h>
namespace Dali
{
-
namespace Scripting
{
-
-bool EnumStringToInteger( const char * const value, const StringEnum* const enumTable, uint32_t tableCount, int& integerEnum )
+bool EnumStringToInteger(const char* const value, const StringEnum* const enumTable, uint32_t tableCount, int& integerEnum)
{
int ret = 0;
bool found = false;
- bool done = false;
+ bool done = false;
- if( value && enumTable && tableCount )
+ if(value && enumTable && tableCount)
{
const char* pValue = value;
const StringEnum* table = enumTable;
- for ( uint32_t i = 0; i < tableCount; ++i )
+ for(uint32_t i = 0; i < tableCount; ++i)
{
- if( Internal::CompareTokens( pValue, table->string, size ) )
+ if(Internal::CompareTokens(pValue, table->string, size))
{
found = true;
ret |= table->value;
if(found)
{
// allow comma separated or'd value
- if( *(pValue+size) == ',' )
+ if(*(pValue + size) == ',')
{
pValue += size + 1;
done = false;
}
}
-
}
integerEnum = ret;
}
- if ( !found )
+ if(!found)
{
- DALI_LOG_ERROR( "Unknown enumeration string %s\n", value );
+ DALI_LOG_ERROR("Unknown enumeration string %s\n", value);
}
return found;
}
-uint32_t FindEnumIndex( const char* value, const StringEnum* table, uint32_t tableCount )
+uint32_t FindEnumIndex(const char* value, const StringEnum* table, uint32_t tableCount)
{
uint32_t index = 0;
- bool found = false;
- for ( uint32_t i = 0; i < tableCount; ++i, ++index )
+ bool found = false;
+ for(uint32_t i = 0; i < tableCount; ++i, ++index)
{
uint32_t sizeIgnored = 0;
- if( Internal::CompareTokens( value, table->string, sizeIgnored ) )
+ if(Internal::CompareTokens(value, table->string, sizeIgnored))
{
found = true;
break;
}
++table;
}
- if ( !found )
+ if(!found)
{
- DALI_LOG_ERROR( "Unknown enumeration string %s\n", value );
+ DALI_LOG_ERROR("Unknown enumeration string %s\n", value);
}
return index;
}
-Actor NewActor( const Property::Map& map )
+Actor NewActor(const Property::Map& map)
{
BaseHandle handle;
// First find type and create Actor
- Property::Value* typeValue = map.Find( "type" );
- if ( typeValue )
+ Property::Value* typeValue = map.Find("type");
+ if(typeValue)
{
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() );
- if ( type )
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo(typeValue->Get<std::string>());
+ if(type)
{
handle = type.CreateInstance();
}
}
- if ( !handle )
+ if(!handle)
{
- DALI_LOG_ERROR( "Actor type not provided\n" );
+ DALI_LOG_ERROR("Actor type not provided\n");
return Actor();
}
- Actor actor( Actor::DownCast( handle ) );
+ Actor actor(Actor::DownCast(handle));
- if ( actor )
+ if(actor)
{
// Now set the properties, or create children
- for ( Property::Map::SizeType i = 0, mapCount = map.Count(); i < mapCount; ++i )
+ for(Property::Map::SizeType i = 0, mapCount = map.Count(); i < mapCount; ++i)
{
- const KeyValuePair pair( map.GetKeyValue( i ) );
- if( pair.first.type == Property::Key::INDEX )
+ const KeyValuePair pair(map.GetKeyValue(i));
+ if(pair.first.type == Property::Key::INDEX)
{
continue;
}
- const std::string& key( pair.first.stringKey );
- if ( key == "type" )
+ const std::string& key(pair.first.stringKey);
+ if(key == "type")
{
continue;
}
- const Property::Value& value( pair.second );
+ const Property::Value& value(pair.second);
- if ( key == "actors" )
+ if(key == "actors")
{
// Create children
- Property::Array actorArray = value.Get< Property::Array >();
- for ( Property::Array::SizeType i = 0; i < actorArray.Size(); ++i)
+ Property::Array actorArray = value.Get<Property::Array>();
+ for(Property::Array::SizeType i = 0; i < actorArray.Size(); ++i)
{
- actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) );
+ actor.Add(NewActor(actorArray[i].Get<Property::Map>()));
}
}
else
{
- Property::Index index( actor.GetPropertyIndex( key ) );
+ Property::Index index(actor.GetPropertyIndex(key));
- if ( index != Property::INVALID_INDEX )
+ if(index != Property::INVALID_INDEX)
{
- actor.SetProperty( index, value );
+ actor.SetProperty(index, value);
}
}
}
return actor;
}
-void CreatePropertyMap( Actor actor, Property::Map& map )
+void CreatePropertyMap(Actor actor, Property::Map& map)
{
map.Clear();
- if ( actor )
+ if(actor)
{
- map[ "type" ] = actor.GetTypeName();
+ map["type"] = actor.GetTypeName();
// Default properties
Property::IndexContainer indices;
- actor.GetPropertyIndices( indices );
+ actor.GetPropertyIndices(indices);
const Property::IndexContainer::ConstIterator endIter = indices.End();
- for ( Property::IndexContainer::Iterator iter = indices.Begin(); iter != endIter; ++iter )
+ for(Property::IndexContainer::Iterator iter = indices.Begin(); iter != endIter; ++iter)
{
- map[ actor.GetPropertyName( *iter ) ] = actor.GetProperty( *iter );
+ map[actor.GetPropertyName(*iter)] = actor.GetProperty(*iter);
}
// Children
- std::size_t childCount( actor.GetChildCount() );
- if ( childCount )
+ std::size_t childCount(actor.GetChildCount());
+ if(childCount)
{
Property::Array childArray;
- for ( uint32_t child = 0; child < childCount; ++child )
+ for(uint32_t child = 0; child < childCount; ++child)
{
Property::Map childMap;
- CreatePropertyMap( actor.GetChildAt( child ), childMap );
- childArray.PushBack( childMap );
+ CreatePropertyMap(actor.GetChildAt(child), childMap);
+ childArray.PushBack(childMap);
}
- map[ "actors" ] = childArray;
+ map["actors"] = childArray;
}
}
}
-void NewAnimation( const Property::Map& map, Dali::AnimationData& outputAnimationData )
+void NewAnimation(const Property::Map& map, Dali::AnimationData& outputAnimationData)
{
// Note: Builder cannot currently pass generic Property::Maps "{" that are nested, so currently we can only have one AnimateTo per animation.
Dali::AnimationData::AnimationDataElement* element = new Dali::AnimationData::AnimationDataElement();
- element->alphaFunction = AlphaFunction::LINEAR;
- element->timePeriodDelay = 0.0f;
+
+ element->alphaFunction = AlphaFunction::LINEAR;
+ element->timePeriodDelay = 0.0f;
element->timePeriodDuration = 1.0f;
// Now set the properties, or create children
- for( Property::Map::SizeType i = 0, animationMapCount = map.Count(); i < animationMapCount; ++i )
+ for(Property::Map::SizeType i = 0, animationMapCount = map.Count(); i < animationMapCount; ++i)
{
- const KeyValuePair pair( map.GetKeyValue( i ) );
- if( pair.first.type == Property::Key::INDEX )
+ const KeyValuePair pair(map.GetKeyValue(i));
+ if(pair.first.type == Property::Key::INDEX)
{
continue; // We don't consider index keys.
}
- const std::string& key( pair.first.stringKey );
+ const std::string& key(pair.first.stringKey);
- const Property::Value& value( pair.second );
+ const Property::Value& value(pair.second);
- if( key == "actor" )
+ if(key == "actor")
{
- element->actor = value.Get< std::string >();
+ element->actor = value.Get<std::string>();
}
- else if( key == "property" )
+ else if(key == "property")
{
- element->property = value.Get< std::string >();
+ element->property = value.Get<std::string>();
}
- else if( key == "value" )
+ else if(key == "value")
{
element->value = value;
}
- else if( key == "alphaFunction" )
+ else if(key == "alphaFunction")
{
- std::string alphaFunctionValue = value.Get< std::string >();
+ std::string alphaFunctionValue = value.Get<std::string>();
- if( alphaFunctionValue == "LINEAR" )
+ if(alphaFunctionValue == "LINEAR")
{
element->alphaFunction = AlphaFunction::LINEAR;
}
- else if( alphaFunctionValue == "REVERSE" )
+ else if(alphaFunctionValue == "REVERSE")
{
element->alphaFunction = AlphaFunction::REVERSE;
}
- else if( alphaFunctionValue == "EASE_IN_SQUARE" )
+ else if(alphaFunctionValue == "EASE_IN_SQUARE")
{
element->alphaFunction = AlphaFunction::EASE_IN_SQUARE;
}
- else if( alphaFunctionValue == "EASE_OUT_SQUARE" )
+ else if(alphaFunctionValue == "EASE_OUT_SQUARE")
{
element->alphaFunction = AlphaFunction::EASE_OUT_SQUARE;
}
- else if( alphaFunctionValue == "EASE_IN" )
+ else if(alphaFunctionValue == "EASE_IN")
{
element->alphaFunction = AlphaFunction::EASE_IN;
}
- else if( alphaFunctionValue == "EASE_OUT" )
+ else if(alphaFunctionValue == "EASE_OUT")
{
element->alphaFunction = AlphaFunction::EASE_OUT;
}
- else if( alphaFunctionValue == "EASE_IN_OUT" )
+ else if(alphaFunctionValue == "EASE_IN_OUT")
{
element->alphaFunction = AlphaFunction::EASE_IN_OUT;
}
- else if( alphaFunctionValue == "EASE_IN_SINE" )
+ else if(alphaFunctionValue == "EASE_IN_SINE")
{
element->alphaFunction = AlphaFunction::EASE_IN_SINE;
}
- else if( alphaFunctionValue == "EASE_OUT_SINE" )
+ else if(alphaFunctionValue == "EASE_OUT_SINE")
{
element->alphaFunction = AlphaFunction::EASE_OUT_SINE;
}
- else if( alphaFunctionValue == "EASE_IN_OUT_SINE" )
+ else if(alphaFunctionValue == "EASE_IN_OUT_SINE")
{
element->alphaFunction = AlphaFunction::EASE_IN_OUT_SINE;
}
- else if( alphaFunctionValue == "BOUNCE" )
+ else if(alphaFunctionValue == "BOUNCE")
{
element->alphaFunction = AlphaFunction::BOUNCE;
}
- else if( alphaFunctionValue == "SIN" )
+ else if(alphaFunctionValue == "SIN")
{
element->alphaFunction = AlphaFunction::SIN;
}
- else if( alphaFunctionValue == "EASE_OUT_BACK" )
+ else if(alphaFunctionValue == "EASE_OUT_BACK")
{
element->alphaFunction = AlphaFunction::EASE_OUT_BACK;
}
}
- else if( key == "timePeriod" )
+ else if(key == "timePeriod")
{
- Property::Map timeMap = value.Get< Property::Map >();
- for( Property::Map::SizeType i = 0; i < timeMap.Count(); ++i )
+ Property::Map timeMap = value.Get<Property::Map>();
+ for(Property::Map::SizeType i = 0; i < timeMap.Count(); ++i)
{
- const KeyValuePair timePair( timeMap.GetKeyValue( i ) );
- if( timePair.first.type == Property::Key::INDEX )
+ const KeyValuePair timePair(timeMap.GetKeyValue(i));
+ if(timePair.first.type == Property::Key::INDEX)
{
continue;
}
- const std::string& key( timePair.first.stringKey );
+ const std::string& key(timePair.first.stringKey);
- if( key == "delay" )
+ if(key == "delay")
{
- element->timePeriodDelay = timePair.second.Get< float >();
+ element->timePeriodDelay = timePair.second.Get<float>();
}
- else if( key == "duration" )
+ else if(key == "duration")
{
- element->timePeriodDuration = timePair.second.Get< float >();
+ element->timePeriodDuration = timePair.second.Get<float>();
}
}
}
}
- outputAnimationData.Add( element );
+ outputAnimationData.Add(element);
}
-} // namespace scripting
+} // namespace Scripting
} // namespace Dali
*/
// INTERNAL INCLUDES
+#include <dali/devel-api/animation/animation-data.h>
#include <dali/public-api/actors/actor-enumerations.h>
#include <dali/public-api/actors/draw-mode.h>
-#include <dali/devel-api/animation/animation-data.h>
#include <dali/public-api/object/property-array.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/property-value.h>
namespace Dali
{
-
class Actor;
/**
*/
namespace Scripting
{
-
/**
* @brief Structure which stores an enumeration and its string equivalent.
*/
struct StringEnum
{
- const char* string; ///< The string representation
- const int32_t value; ///< The enumeration value wrapped in int
+ const char* string; ///< The string representation
+ const int32_t value; ///< The enumeration value wrapped in int
};
/**
* @param[in] tableCount Number of items in the array.
* @return The index of the enumeration. If enumeration is not found, logs an error and returns tableCount.
*/
-DALI_CORE_API uint32_t FindEnumIndex( const char* value, const StringEnum* table, uint32_t tableCount );
+DALI_CORE_API uint32_t FindEnumIndex(const char* value, const StringEnum* table, uint32_t tableCount);
/**
* @brief Find the enum as an integer from the table
* @param[out] integerEnum The value of the enum.
* @return true if one or more enums in value.
*/
-DALI_CORE_API bool EnumStringToInteger( const char* const value, const StringEnum* const table, uint32_t tableCount, int& integerEnum );
+DALI_CORE_API bool EnumStringToInteger(const char* const value, const StringEnum* const table, uint32_t tableCount, int& integerEnum);
/**
* @brief Chooses the appropriate enumeration for the provided string from the given table.
*
* @return True if the value was found from the table
*/
-template< typename T >
-bool GetEnumeration( const char* value, const StringEnum* table, uint32_t tableCount, T& result )
+template<typename T>
+bool GetEnumeration(const char* value, const StringEnum* table, uint32_t tableCount, T& result)
{
- bool retVal( false );
- if( table )
+ bool retVal(false);
+ if(table)
{
int integerEnum = 0;
// check to avoid crash, not asserting on purpose, error is logged instead
- if( EnumStringToInteger( value, table, tableCount, integerEnum ) )
+ if(EnumStringToInteger(value, table, tableCount, integerEnum))
{
- result = static_cast<T>( integerEnum );
+ result = static_cast<T>(integerEnum);
retVal = true;
}
}
* @param[out] result The enum value. This is not modified if the enumeration could not be converted.
* @return True if the value was found successfully AND the value has changed. This is to allow the caller to do nothing if there is no change.
*/
-template< typename T >
-bool GetEnumerationProperty( const Property::Value& propertyValue, const StringEnum* table, uint32_t tableCount, T& result )
+template<typename T>
+bool GetEnumerationProperty(const Property::Value& propertyValue, const StringEnum* table, uint32_t tableCount, T& result)
{
- int newValue;
- bool set = false;
+ int newValue;
+ bool set = false;
Property::Type type = propertyValue.GetType();
- if( type == Property::INTEGER )
+ if(type == Property::INTEGER)
{
// Attempt to fetch the property as an INTEGER type.
- if( propertyValue.Get( newValue ) )
+ if(propertyValue.Get(newValue))
{
// Success.
set = true;
}
}
- else if( type == Property::STRING )
+ else if(type == Property::STRING)
{
// Attempt to fetch the property as an STRING type, and convert it from string to enumeration value.
std::string propertyString;
- if( table && propertyValue.Get( propertyString ) && EnumStringToInteger( propertyString.c_str(), table, tableCount, newValue ) )
+ if(table && propertyValue.Get(propertyString) && EnumStringToInteger(propertyString.c_str(), table, tableCount, newValue))
{
// Success.
set = true;
}
// If the property was converted OK, AND the value has changed, update the result and return true.
- if( set && ( result != static_cast<T>( newValue ) ) )
+ if(set && (result != static_cast<T>(newValue)))
{
- result = static_cast<T>( newValue );
+ result = static_cast<T>(newValue);
return true;
}
* @param[out] result The enum value. This is not modified if the enumeration could not be converted.
* @return True if the value was found successfully AND the value has changed. This is to allow the caller to do nothing if there is no change.
*/
-template< typename T >
-bool GetBitmaskEnumerationProperty( const Property::Value& propertyValue, const Scripting::StringEnum* table, uint32_t tableCount, T& result )
+template<typename T>
+bool GetBitmaskEnumerationProperty(const Property::Value& propertyValue, const Scripting::StringEnum* table, uint32_t tableCount, T& result)
{
bool returnValue = true;
// Evaluate as a single INTEGER or STRING first.
- if( !GetEnumerationProperty( propertyValue, table, tableCount, result ) )
+ if(!GetEnumerationProperty(propertyValue, table, tableCount, result))
{
// If not, then check if it's an ARRAY
- if ( propertyValue.GetType() == Property::ARRAY )
+ if(propertyValue.GetType() == Property::ARRAY)
{
- int newValue = 0;
+ int newValue = 0;
Property::Array array;
- propertyValue.Get( array );
- for( Property::Array::SizeType i = 0; i < array.Count(); ++i )
+ propertyValue.Get(array);
+ for(Property::Array::SizeType i = 0; i < array.Count(); ++i)
{
- Property::Value currentValue = array[ i ];
+ Property::Value currentValue = array[i];
// Use an initial value of -1 so any successful property conversion
// causes a change (and true to be returned).
- T current = static_cast< T >( -1 );
- if( GetEnumerationProperty( currentValue, table, tableCount, current ) )
+ T current = static_cast<T>(-1);
+ if(GetEnumerationProperty(currentValue, table, tableCount, current))
{
newValue |= current;
}
}
// If we didn't hit an invalid type and the value has changed, update the result.
- if( returnValue && ( result != static_cast<T>( newValue ) ) )
+ if(returnValue && (result != static_cast<T>(newValue)))
{
- result = static_cast<T>( newValue );
+ result = static_cast<T>(newValue);
}
}
else
*
* @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
*/
-template< typename T >
-const char* GetEnumerationName( T value, const StringEnum* table, uint32_t tableCount )
+template<typename T>
+const char* GetEnumerationName(T value, const StringEnum* table, uint32_t tableCount)
{
- if( table )
+ if(table)
{
- for ( uint32_t i = 0; i < tableCount; ++i )
+ for(uint32_t i = 0; i < tableCount; ++i)
{
- if ( value == T(table[ i ].value) )
+ if(value == T(table[i].value))
{
- return table[ i ].string;
+ return table[i].string;
}
}
}
*
* @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
*/
-template< typename T >
-const char * GetLinearEnumerationName( T value, const StringEnum* table, uint32_t tableCount )
+template<typename T>
+const char* GetLinearEnumerationName(T value, const StringEnum* table, uint32_t tableCount)
{
- if ( table && ( value > 0 || value <= static_cast<int>( tableCount ) ) )
+ if(table && (value > 0 || value <= static_cast<int>(tableCount)))
{
return table[value].string;
}
*
* @return A handle to the newly created actor.
*/
-DALI_CORE_API Actor NewActor( const Property::Map& map );
+DALI_CORE_API Actor NewActor(const Property::Map& map);
/**
* @brief Creates a Property::Map from the actor provided.
* @param[in] actor The base-actor from which a Property::Map should be created
* @param[out] map This map is cleared and a property map of actor and its children is filled in
*/
-DALI_CORE_API void CreatePropertyMap( Actor actor, Property::Map& map );
+DALI_CORE_API void CreatePropertyMap(Actor actor, Property::Map& map);
/**
* @brief Creates description data required to create an Animation object from a property map.
* @param[in] map The property value map containing the animation description
* @param[out] outputAnimationData Resultant data retrieved from the property map is written here
*/
-DALI_CORE_API void NewAnimation( const Property::Map& map, Dali::AnimationData& outputAnimationData );
+DALI_CORE_API void NewAnimation(const Property::Map& map, Dali::AnimationData& outputAnimationData);
} // namespace Scripting
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
// CallbackBaseFunctor methods:
-SignalDelegate::CallbackBaseFunctor::CallbackBaseFunctor( CallbackBase* callback )
-: mCallback( callback )
+SignalDelegate::CallbackBaseFunctor::CallbackBaseFunctor(CallbackBase* callback)
+: mCallback(callback)
{
}
void SignalDelegate::CallbackBaseFunctor::operator()()
{
- if( mCallback )
+ if(mCallback)
{
- CallbackBase::Execute( *mCallback );
+ CallbackBase::Execute(*mCallback);
}
}
delete mCallback;
}
-
// SignalDelegate methods:
-SignalDelegate::SignalDelegate( Dali::Actor connectActor, const std::string& signalName )
-: mIsConnected( false ),
- mConnectActor( connectActor ),
- mSignalName( signalName )
+SignalDelegate::SignalDelegate(Dali::Actor connectActor, const std::string& signalName)
+: mIsConnected(false),
+ mConnectActor(connectActor),
+ mSignalName(signalName)
{
}
return mIsConnected;
}
-
} // namespace Dali
#define DALI_SIGNAL_DELEGATE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
/**
* @brief The SignalDelegate object allows direct connection to a signal that has been pre-configured internally.
*
class DALI_CORE_API SignalDelegate
{
public:
-
/**
* @brief Create and set up a signal delegate.
*
* @param[in] connectActor The actor whose signal should be connected to.
* @param[in] signalName The name of the signal within the actor to connect to.
*/
- SignalDelegate( Dali::Actor connectActor, const std::string& signalName );
+ SignalDelegate(Dali::Actor connectActor, const std::string& signalName);
/**
* @brief Destructor.
}
public:
-
/**
* @brief Connect to a FunctorDelegate as received from a type-registry signal connection call.
*
* @param[in] functorDelegate A functor delegate object that must be executed when the signal is emitted.
* @return True of the connection was made, false otherwise.
*/
- bool Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* functorDelegate )
+ bool Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* functorDelegate)
{
- if( !mIsConnected )
+ if(!mIsConnected)
{
// Note: We have to new the CallbackBaseFunctor rather than have it as a concrete object, as it
// is converted to a FunctorDelegate again within ConnectSignal. FunctorDelegates gain ownership
// of any functor they are created from and therefore always attempt to delete them.
- CallbackBaseFunctor* callbackFunctor = new CallbackBaseFunctor( new CallbackFunctorDelegate0( functorDelegate ) );
- mConnectActor.ConnectSignal( connectionTracker, mSignalName, *callbackFunctor );
+ CallbackBaseFunctor* callbackFunctor = new CallbackBaseFunctor(new CallbackFunctorDelegate0(functorDelegate));
+ mConnectActor.ConnectSignal(connectionTracker, mSignalName, *callbackFunctor);
mIsConnected = true;
return true;
* @param[in] memberFunction The member-function to call when the signal is emitted.
* @return True of the connection was made, false otherwise.
*/
- template< class T >
- bool Connect( T* object, void ( T::*memberFunction )( void ) )
+ template<class T>
+ bool Connect(T* object, void (T::*memberFunction)(void))
{
- if( !mIsConnected )
+ if(!mIsConnected)
{
- CallbackBaseFunctor* callbackFunctor = new CallbackBaseFunctor( MakeCallback( object, memberFunction ) );
- mConnectActor.ConnectSignal( object, mSignalName, *callbackFunctor );
+ CallbackBaseFunctor* callbackFunctor = new CallbackBaseFunctor(MakeCallback(object, memberFunction));
+ mConnectActor.ConnectSignal(object, mSignalName, *callbackFunctor);
mIsConnected = true;
return true;
*/
bool IsConnected();
-
private:
-
/**
* This functor is used by SignalDelegate in order to callback to a non-static member function
* (after it has been converted to a CallbackBase).
*
* @param[in] callback A CallbackBase which can be created from a member function, or a FunctorDelegate.
*/
- CallbackBaseFunctor( CallbackBase* callback );
+ CallbackBaseFunctor(CallbackBase* callback);
/**
* @brief Executes the functor.
*/
~CallbackBaseFunctor();
- private:
-
- CallbackBase* mCallback; ///< Stores (and owns) the callback to be called on execution.
+ private:
+ CallbackBase* mCallback; ///< Stores (and owns) the callback to be called on execution.
};
private:
-
/**
* @brief Not defined.
*/
- SignalDelegate( const SignalDelegate& rhs );
+ SignalDelegate(const SignalDelegate& rhs);
/**
* @brief Not defined.
*/
- const SignalDelegate& operator=( const SignalDelegate& rhs );
+ const SignalDelegate& operator=(const SignalDelegate& rhs);
private:
- bool mIsConnected; ///< Boolean to know if it is connected already.
+ bool mIsConnected; ///< Boolean to know if it is connected already.
Dali::Actor mConnectActor; ///< The actor owning the signal to connect to.
std::string mSignalName; ///< The name of the signal to connect to.
};
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/devel-api/threading/conditional-wait.h>
// EXTERNAL INCLUDES
-#include <mutex>
#include <condition_variable>
+#include <mutex>
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
*/
struct ConditionalWait::ConditionalWaitImpl
{
- std::mutex mutex;
+ std::mutex mutex;
std::condition_variable condition;
- volatile unsigned int count;
+ volatile unsigned int count;
};
/**
*/
struct ConditionalWait::ScopedLock::ScopedLockImpl
{
- ScopedLockImpl( ConditionalWait& wait )
- : wait( wait ),
- lock( wait.mImpl->mutex ) // locks for the lifecycle of this object
- { }
- ConditionalWait& wait;
+ ScopedLockImpl(ConditionalWait& wait)
+ : wait(wait),
+ lock(wait.mImpl->mutex) // locks for the lifecycle of this object
+ {
+ }
+ ConditionalWait& wait;
std::unique_lock<std::mutex> lock;
};
-ConditionalWait::ScopedLock::ScopedLock( ConditionalWait& wait )
-: mImpl( new ConditionalWait::ScopedLock::ScopedLockImpl( wait ) )
+ConditionalWait::ScopedLock::ScopedLock(ConditionalWait& wait)
+: mImpl(new ConditionalWait::ScopedLock::ScopedLockImpl(wait))
{
Internal::MutexTrace::Lock(); // matching sequence in mutex.cpp
}
}
ConditionalWait::ConditionalWait()
-: mImpl( new ConditionalWaitImpl )
+: mImpl(new ConditionalWaitImpl)
{
mImpl->count = 0;
}
void ConditionalWait::Notify()
{
// conditional wait requires a lock to be held
- ScopedLock lock( *this );
+ ScopedLock lock(*this);
volatile unsigned int previousCount = mImpl->count;
+
mImpl->count = 0; // change state before broadcast as that may wake clients immediately
// notify does nothing if the thread is not waiting but still has a system call overhead
// notify all threads to continue
- if( 0 != previousCount )
+ if(0 != previousCount)
{
mImpl->condition.notify_all(); // no return value
}
}
-void ConditionalWait::Notify( const ScopedLock& scope )
+void ConditionalWait::Notify(const ScopedLock& scope)
{
// Scope must be locked:
- DALI_ASSERT_DEBUG( &scope.GetLockedWait() == this );
+ DALI_ASSERT_DEBUG(&scope.GetLockedWait() == this);
volatile unsigned int previousCount = mImpl->count;
+
mImpl->count = 0; // change state before broadcast as that may wake clients immediately
// notify does nothing if the thread is not waiting but still has a system call overhead
// notify all threads to continue
- if( 0 != previousCount )
+ if(0 != previousCount)
{
mImpl->condition.notify_all(); // no return value
}
void ConditionalWait::Wait()
{
// conditional wait requires a lock to be held
- ScopedLock scope( *this );
+ ScopedLock scope(*this);
++(mImpl->count);
// conditional wait may wake up without anyone calling Notify
do
{
// wait while condition changes
- mImpl->condition.wait( scope.mImpl->lock ); // need to pass in the std::unique_lock
- }
- while( 0 != mImpl->count );
+ mImpl->condition.wait(scope.mImpl->lock); // need to pass in the std::unique_lock
+ } while(0 != mImpl->count);
}
-void ConditionalWait::Wait( const ScopedLock& scope )
+void ConditionalWait::Wait(const ScopedLock& scope)
{
// Scope must be locked:
- DALI_ASSERT_DEBUG( &scope.GetLockedWait() == this );
+ DALI_ASSERT_DEBUG(&scope.GetLockedWait() == this);
++(mImpl->count);
do
{
// wait while condition changes
- mImpl->condition.wait( scope.mImpl->lock ); // need to pass in the std::unique_lock
- }
- while( 0 != mImpl->count );
+ mImpl->condition.wait(scope.mImpl->lock); // need to pass in the std::unique_lock
+ } while(0 != mImpl->count);
// We return with our mutex locked safe in the knowledge that the ScopedLock
// passed in will unlock it in the caller.
#define DALI_CONDITIONAL_WAIT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
/**
* Helper class to allow conditional waiting and notifications between multiple threads.
*/
class DALI_CORE_API ConditionalWait
{
public:
-
/**
* @brief Allows client code to synchronize updates to its own state with the
* internal state of a ConditionalWait object.
* @brief Will acquire the internal mutex of the ConditionalWait object passed in.
* @param[in] wait The ConditionalWait object to lock.
*/
- ScopedLock( ConditionalWait& wait );
+ ScopedLock(ConditionalWait& wait);
/**
* Destructor
ConditionalWait& GetLockedWait() const;
public: // Data, public to allow nesting class to access
-
struct ScopedLockImpl;
ScopedLockImpl* mImpl;
private:
-
// Not implemented as ScopedLock cannot be copied:
- ScopedLock( const ScopedLock& );
- const ScopedLock& operator=( const ScopedLock& );
+ ScopedLock(const ScopedLock&);
+ const ScopedLock& operator=(const ScopedLock&);
};
/**
*
* @param[in] scope A pre-existing lock on the internal state of this object.
*/
- void Notify( const ScopedLock& scope );
+ void Notify(const ScopedLock& scope);
/**
* @brief Wait for another thread to notify us when the condition is true and we can continue
* @param[in] scope A pre-existing lock on the internal state of this object.
* @pre scope must have been passed this ConditionalWait during its construction.
*/
- void Wait( const ScopedLock& scope );
+ void Wait(const ScopedLock& scope);
/**
* @brief Return the count of threads waiting for this conditional
unsigned int GetWaitCount() const;
private:
-
// Not implemented as ConditionalWait is not copyable
- ConditionalWait( const ConditionalWait& );
- const ConditionalWait& operator=( const ConditionalWait& );
+ ConditionalWait(const ConditionalWait&);
+ const ConditionalWait& operator=(const ConditionalWait&);
struct ConditionalWaitImpl;
ConditionalWaitImpl* mImpl;
-
};
} // namespace Dali
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
struct Mutex::MutexImpl
{
std::mutex mutex;
- bool locked;
+ bool locked;
};
Mutex::Mutex()
-: mImpl( new MutexImpl )
+: mImpl(new MutexImpl)
{
mImpl->locked = false;
}
return mImpl->locked;
}
-Mutex::ScopedLock::ScopedLock( Mutex& mutex )
-: mMutex( mutex )
+Mutex::ScopedLock::ScopedLock(Mutex& mutex)
+: mMutex(mutex)
{
mMutex.mImpl->mutex.lock();
Internal::MutexTrace::Lock(); // matching sequence in conditional-wait.cpp
#define DALI_MUTEX_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
namespace Dali
{
-
/**
* Class to synchronize access to critical resources from multiple threads
*/
class DALI_CORE_API Mutex
{
public:
-
/**
* @brief Constructor, acquires the mutex from the underlying OS
*/
bool IsLocked();
public:
-
/**
* Helper class to do a scoped lock on a mutex implementing the RAII idiom.
* Note! this class *does not* prevent a deadlock in the case when same thread is
class DALI_CORE_API ScopedLock
{
public:
-
/**
* Constructor
* @param mutex to lock
*/
- ScopedLock( Mutex& mutex );
+ ScopedLock(Mutex& mutex);
/**
* Destructor, releases the lock
};
private:
-
/// Not implemented as Mutex is not copyable
- Mutex( const Mutex& );
- const Mutex& operator= ( const Mutex& );
+ Mutex(const Mutex&);
+ const Mutex& operator=(const Mutex&);
struct MutexImpl;
MutexImpl* mImpl;
-
};
} // namespace Dali
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include "thread-pool.h"
#include <cmath>
-
-
namespace Dali
{
namespace
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
-}
+} // namespace
/**
* WorkerThread executes tasks submitted to the pool
class WorkerThread
{
public:
-
/**
* @brief Constructor of worker thread
* @param index Thread index assigned to the object during pool initialisation
*/
- explicit WorkerThread( uint32_t index );
+ explicit WorkerThread(uint32_t index);
/**
* @brief Destructor of the worker thread
*/
~WorkerThread();
- WorkerThread(const WorkerThread &other) = delete;
- WorkerThread &operator=(const WorkerThread &other) = delete;
+ WorkerThread(const WorkerThread& other) = delete;
+ WorkerThread& operator=(const WorkerThread& other) = delete;
/**
* @brief Adds task to the task queue
* @param task Task to be executed by the thread
*/
- void AddTask( Task task );
+ void AddTask(Task task);
/**
* @brief Wakes up thread.
void Wait();
private:
-
/**
* @brief Internal thread loop function
*/
void WaitAndExecute();
- std::thread mWorker;
- uint32_t mIndex;
- TaskQueue mTaskQueue;
- std::mutex mTaskQueueMutex;
+ std::thread mWorker;
+ uint32_t mIndex;
+ TaskQueue mTaskQueue;
+ std::mutex mTaskQueueMutex;
std::condition_variable mConditionVariable;
- bool mTerminating {false} ;
+ bool mTerminating{false};
};
void WorkerThread::WaitAndExecute()
{
- while( true )
+ while(true)
{
Task task;
{
- std::unique_lock< std::mutex > lock{ mTaskQueueMutex };
+ std::unique_lock<std::mutex> lock{mTaskQueueMutex};
- mConditionVariable.wait( lock, [ this ]() -> bool {
+ mConditionVariable.wait(lock, [this]() -> bool {
return !mTaskQueue.empty() || mTerminating;
- } );
+ });
- if( mTerminating )
+ if(mTerminating)
{
break;
}
task = mTaskQueue.front();
}
- task( mIndex );
+ task(mIndex);
{
- std::lock_guard< std::mutex > lock{ mTaskQueueMutex };
+ std::lock_guard<std::mutex> lock{mTaskQueueMutex};
mTaskQueue.pop();
}
}
-WorkerThread::WorkerThread(uint32_t index) : mIndex( index )
+WorkerThread::WorkerThread(uint32_t index)
+: mIndex(index)
{
// Have to pass "this" as an argument because WaitAndExecute is a member function.
- mWorker = std::thread{ &WorkerThread::WaitAndExecute, this };
+ mWorker = std::thread{&WorkerThread::WaitAndExecute, this};
}
WorkerThread::~WorkerThread()
{
- if( mWorker.joinable() )
+ if(mWorker.joinable())
{
Notify();
Wait();
{
- std::lock_guard< std::mutex > lock{ mTaskQueueMutex };
+ std::lock_guard<std::mutex> lock{mTaskQueueMutex};
mTerminating = true;
mConditionVariable.notify_one();
}
}
}
-void WorkerThread::AddTask( Task task )
+void WorkerThread::AddTask(Task task)
{
- std::lock_guard< std::mutex > lock{ mTaskQueueMutex };
- mTaskQueue.push( std::move( task ) );
+ std::lock_guard<std::mutex> lock{mTaskQueueMutex};
+ mTaskQueue.push(std::move(task));
mConditionVariable.notify_one();
}
void WorkerThread::Notify()
{
- std::lock_guard< std::mutex > lock{ mTaskQueueMutex };
+ std::lock_guard<std::mutex> lock{mTaskQueueMutex};
mConditionVariable.notify_one();
}
void WorkerThread::Wait()
{
- std::unique_lock< std::mutex > lock{ mTaskQueueMutex };
- mConditionVariable.wait( lock, [ this ]() -> bool {
+ std::unique_lock<std::mutex> lock{mTaskQueueMutex};
+ mConditionVariable.wait(lock, [this]() -> bool {
return mTaskQueue.empty();
- } );
+ });
}
// ThreadPool -----------------------------------------------------------------------------------------------
struct ThreadPool::Impl
{
std::vector<std::unique_ptr<WorkerThread>> mWorkers;
- uint32_t mWorkerIndex{ 0u };
+ uint32_t mWorkerIndex{0u};
};
ThreadPool::ThreadPool()
ThreadPool::~ThreadPool() = default;
-bool ThreadPool::Initialize( uint32_t threadCount )
+bool ThreadPool::Initialize(uint32_t threadCount)
{
/**
* Get the system's supported thread count.
*/
auto thread_count = threadCount + 1;
- if( !threadCount )
+ if(!threadCount)
{
thread_count = std::thread::hardware_concurrency();
- if( !thread_count )
+ if(!thread_count)
{
return false;
}
/**
* Spawn the worker threads.
*/
- for( auto i = 0u; i < thread_count - 1; i++ )
+ for(auto i = 0u; i < thread_count - 1; i++)
{
/**
* The workers will execute an infinite loop function
* and will wait for a job to enter the job queue. Once a job is in the the queue
* the threads will wake up to acquire and execute it.
*/
- mImpl->mWorkers.push_back( make_unique< WorkerThread >( i ) );
+ mImpl->mWorkers.push_back(make_unique<WorkerThread>(i));
}
return true;
}
-
void ThreadPool::Wait()
{
- for( auto& worker : mImpl->mWorkers )
+ for(auto& worker : mImpl->mWorkers)
{
worker->Wait();
}
}
-SharedFuture ThreadPool::SubmitTask( uint32_t workerIndex, const Task& task )
+SharedFuture ThreadPool::SubmitTask(uint32_t workerIndex, const Task& task)
{
- auto future = std::shared_ptr< Future< void > >( new Future< void > );
- mImpl->mWorkers[workerIndex]->AddTask( [task, future]( uint32_t index )
- {
- task( index );
+ auto future = std::shared_ptr<Future<void>>(new Future<void>);
+ mImpl->mWorkers[workerIndex]->AddTask([task, future](uint32_t index) {
+ task(index);
- future->mPromise.set_value();
- });
+ future->mPromise.set_value();
+ });
return future;
}
-SharedFuture ThreadPool::SubmitTasks( const std::vector< Task >& tasks )
+SharedFuture ThreadPool::SubmitTasks(const std::vector<Task>& tasks)
{
- auto future = std::shared_ptr< Future< void > >( new Future< void > );
+ auto future = std::shared_ptr<Future<void>>(new Future<void>);
- mImpl->mWorkers[ mImpl->mWorkerIndex++ % static_cast< uint32_t >( mImpl->mWorkers.size() )]->AddTask(
- [ future, tasks ]( uint32_t index ) {
- for( auto& task : tasks )
+ mImpl->mWorkers[mImpl->mWorkerIndex++ % static_cast<uint32_t>(mImpl->mWorkers.size())]->AddTask(
+ [future, tasks](uint32_t index) {
+ for(auto& task : tasks)
{
- task( index );
+ task(index);
}
future->mPromise.set_value();
-
- } );
+ });
return future;
}
-UniqueFutureGroup ThreadPool::SubmitTasks( const std::vector< Task >& tasks, uint32_t threadMask )
+UniqueFutureGroup ThreadPool::SubmitTasks(const std::vector<Task>& tasks, uint32_t threadMask)
{
auto retval = make_unique<FutureGroup<void>>();
*/
auto threads = uint32_t(std::log2(float(tasks.size())));
- if( threadMask != 0 )
+ if(threadMask != 0)
{
threads = threadMask;
}
- if( threads > mImpl->mWorkers.size() )
+ if(threads > mImpl->mWorkers.size())
{
threads = uint32_t(mImpl->mWorkers.size());
}
- else if( !threads )
+ else if(!threads)
{
threads = 1;
}
auto payloadPerThread = uint32_t(tasks.size() / threads);
- auto remaining = uint32_t(tasks.size() % threads);
+ auto remaining = uint32_t(tasks.size() % threads);
uint32_t taskIndex = 0;
- uint32_t taskSize = uint32_t(remaining + payloadPerThread); // add 'remaining' tasks to the very first job list
+ uint32_t taskSize = uint32_t(remaining + payloadPerThread); // add 'remaining' tasks to the very first job list
- for( auto wt = 0u; wt < threads; ++wt )
+ for(auto wt = 0u; wt < threads; ++wt)
{
- auto future = std::shared_ptr< Future< void > >( new Future< void > );
- retval->mFutures.emplace_back( future );
- mImpl->mWorkers[ mImpl->mWorkerIndex++ % static_cast< uint32_t >( mImpl->mWorkers.size() )]->AddTask(
- [ future, tasks, taskIndex, taskSize ]( uint32_t index ) {
+ auto future = std::shared_ptr<Future<void>>(new Future<void>);
+ retval->mFutures.emplace_back(future);
+ mImpl->mWorkers[mImpl->mWorkerIndex++ % static_cast<uint32_t>(mImpl->mWorkers.size())]->AddTask(
+ [future, tasks, taskIndex, taskSize](uint32_t index) {
auto begin = tasks.begin() + int(taskIndex);
- auto end = begin + int(taskSize);
- for( auto it = begin; it < end; ++it )
+ auto end = begin + int(taskSize);
+ for(auto it = begin; it < end; ++it)
{
- (*it)( index );
+ (*it)(index);
}
future->mPromise.set_value();
- } );
+ });
taskIndex += taskSize;
taskSize = payloadPerThread;
#define DALI_THREAD_POOL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/common/dali-common.h>
// EXTERNAL INCLUDES
-#include <thread>
-#include <functional>
-#include <mutex>
-#include <queue>
+#include <algorithm>
#include <condition_variable>
+#include <functional>
#include <future>
-#include <algorithm>
#include <iostream>
#include <memory>
+#include <mutex>
+#include <queue>
+#include <thread>
namespace Dali
{
friend class ThreadPool;
public:
-
/**
* @brief Constructor of Future
*/
*/
void Wait() const
{
- if( IsValid() )
+ if(IsValid())
{
mFuture.wait();
}
}
private:
-
std::promise<T> mPromise{};
std::future<T> mFuture{};
};
friend class ThreadPool;
public:
-
/**
* Waits for all the Futures to complete.
*/
void Wait()
{
- for (auto &future : mFutures)
+ for(auto& future : mFutures)
{
future->Wait();
}
}
private:
-
- std::vector<std::shared_ptr<Future<T> > > mFutures;
+ std::vector<std::shared_ptr<Future<T>>> mFutures;
};
using UniqueFutureGroup = std::unique_ptr<FutureGroup<void>>;
-
-
/**
* ThreadPool creates and manages worker threads and tasks submitted for execution.
*/
class DALI_CORE_API ThreadPool final
{
public:
-
/**
* @brief Constructor of thread pool.
*/
* @param threadCount Number of worker threads to use. If 0 then thread count equals hardware thread count.
* @return True if success
*/
- bool Initialize( uint32_t threadCount = 0u );
+ bool Initialize(uint32_t threadCount = 0u);
/**
* @brief Waits until all threads finish execution and go back to the idle state.
* @param task Task submitted for execution
* @return Shared pointer to the Future object
*/
- SharedFuture SubmitTask(uint32_t workerIndex, const Task &task);
+ SharedFuture SubmitTask(uint32_t workerIndex, const Task& task);
/**
* @brief Submits vector of tasks to the pool
size_t GetWorkerCount() const;
private:
-
struct Impl;
std::unique_ptr<Impl> mImpl;
};
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/devel-api/threading/thread.h>
// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
#include <cstddef>
#include <thread>
-#include <dali/integration-api/debug.h>
namespace Dali
{
-
struct Thread::ThreadImpl
{
- ThreadImpl( Thread& aThis )
- : thread( &Thread::InternalThreadEntryFunc, std::ref( aThis ) )
+ ThreadImpl(Thread& aThis)
+ : thread(&Thread::InternalThreadEntryFunc, std::ref(aThis))
{
// std::thread starts execution immediately
}
- ~ThreadImpl( )
+ ~ThreadImpl()
{
thread.join();
}
};
Thread::Thread()
-: mImpl( nullptr )
+: mImpl(nullptr)
{
}
void Thread::Start()
{
- if( !mImpl )
+ if(!mImpl)
{
- mImpl = new Thread::ThreadImpl( *this );
+ mImpl = new Thread::ThreadImpl(*this);
}
}
mImpl = nullptr;
}
-void Thread::InternalThreadEntryFunc( Thread& aThis )
+void Thread::InternalThreadEntryFunc(Thread& aThis)
{
aThis.Run();
}
*/
namespace Dali
{
-
/*
* @brief Abstract class for thread functionality. Can be used for worker threads.
*/
class DALI_CORE_API Thread
{
public:
-
/**
* @brief Creates a new thread and make it executable.
*/
void Join();
protected:
-
/**
* @brief Constructor
*/
virtual void Run() = 0;
private:
-
/**
* Helper for the thread calling the entry function.
* @param[in] This A pointer to the current thread object
*/
- static void InternalThreadEntryFunc( Thread& This );
+ static void InternalThreadEntryFunc(Thread& This);
// Not copyable or movable
- Thread( const Thread& ) = delete; ///< Deleted copy constructor
- Thread( Thread&& ) = delete; ///< Deleted move constructor
- Thread& operator=( const Thread& ) = delete; ///< Deleted copy assignment operator
- Thread& operator=( Thread&& ) = delete; ///< Deleted move assignment operator
+ Thread(const Thread&) = delete; ///< Deleted copy constructor
+ Thread(Thread&&) = delete; ///< Deleted move constructor
+ Thread& operator=(const Thread&) = delete; ///< Deleted copy assignment operator
+ Thread& operator=(Thread&&) = delete; ///< Deleted move assignment operator
private:
-
struct ThreadImpl;
ThreadImpl* mImpl;
-
};
-}
+} // namespace Dali
#endif // DALI_THREAD_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
FrameCallbackInterface::FrameCallbackInterface()
-: mImpl( std::unique_ptr< Impl >( new Impl ) )
+: mImpl(std::unique_ptr<Impl>(new Impl))
{
}
FrameCallbackInterface::~FrameCallbackInterface()
{
- if( Internal::Stage::IsInstalled() )
+ if(Internal::Stage::IsInstalled())
{
Internal::StagePtr stage = Internal::Stage::GetCurrent();
- if( stage )
+ if(stage)
{
// This will be a no-op if the callback has already been removed
- stage->RemoveFrameCallback( *this );
+ stage->RemoveFrameCallback(*this);
}
}
}
#define DALI_FRAME_CALLBACK_INTERFACE_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
class UpdateProxy;
/**
class DALI_CORE_API FrameCallbackInterface
{
public:
-
/**
* @brief Called from the update-thread after the scene has been updated, and is ready to render.
* @param[in] updateProxy Use this to get/set required values for the Actor.
* @param[in] elapsedSeconds Time elapsed time since the last frame (in seconds)
* @see FrameCallbackInterface
*/
- virtual void Update( UpdateProxy& updateProxy, float elapsedSeconds ) = 0;
+ virtual void Update(UpdateProxy& updateProxy, float elapsedSeconds) = 0;
protected:
-
/**
* @brief Protected constructor.
*/
class Impl;
private:
- std::unique_ptr< Impl > mImpl;
+ std::unique_ptr<Impl> mImpl;
/// @endcond
};
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
-bool UpdateProxy::GetPosition( uint32_t id, Vector3& position ) const
+bool UpdateProxy::GetPosition(uint32_t id, Vector3& position) const
{
- return mImpl.GetPosition( id, position );
+ return mImpl.GetPosition(id, position);
}
-bool UpdateProxy::SetPosition( uint32_t id, const Vector3& position )
+bool UpdateProxy::SetPosition(uint32_t id, const Vector3& position)
{
- return mImpl.SetPosition( id, position );
+ return mImpl.SetPosition(id, position);
}
-bool UpdateProxy::BakePosition( uint32_t id, const Vector3& position )
+bool UpdateProxy::BakePosition(uint32_t id, const Vector3& position)
{
- return mImpl.BakePosition( id, position );
+ return mImpl.BakePosition(id, position);
}
-bool UpdateProxy::GetSize( uint32_t id, Vector3& size ) const
+bool UpdateProxy::GetSize(uint32_t id, Vector3& size) const
{
- return mImpl.GetSize( id, size );
+ return mImpl.GetSize(id, size);
}
-bool UpdateProxy::SetSize( uint32_t id, const Vector3& size )
+bool UpdateProxy::SetSize(uint32_t id, const Vector3& size)
{
- return mImpl.SetSize( id, size );
+ return mImpl.SetSize(id, size);
}
-bool UpdateProxy::BakeSize( uint32_t id, const Vector3& size )
+bool UpdateProxy::BakeSize(uint32_t id, const Vector3& size)
{
- return mImpl.BakeSize( id, size );
+ return mImpl.BakeSize(id, size);
}
-bool UpdateProxy::GetPositionAndSize( uint32_t id, Vector3& position, Vector3& size ) const
+bool UpdateProxy::GetPositionAndSize(uint32_t id, Vector3& position, Vector3& size) const
{
- return mImpl.GetPositionAndSize( id, position, size );
+ return mImpl.GetPositionAndSize(id, position, size);
}
-bool UpdateProxy::GetScale( uint32_t id, Vector3& scale ) const
+bool UpdateProxy::GetScale(uint32_t id, Vector3& scale) const
{
- return mImpl.GetScale( id, scale );
+ return mImpl.GetScale(id, scale);
}
-bool UpdateProxy::SetScale( uint32_t id, const Vector3& scale )
+bool UpdateProxy::SetScale(uint32_t id, const Vector3& scale)
{
- return mImpl.SetScale( id, scale );
+ return mImpl.SetScale(id, scale);
}
-bool UpdateProxy::BakeScale( uint32_t id, const Vector3& scale )
+bool UpdateProxy::BakeScale(uint32_t id, const Vector3& scale)
{
- return mImpl.BakeScale( id, scale );
+ return mImpl.BakeScale(id, scale);
}
-bool UpdateProxy::GetColor( uint32_t id, Vector4& color ) const
+bool UpdateProxy::GetColor(uint32_t id, Vector4& color) const
{
- return mImpl.GetColor( id, color );
+ return mImpl.GetColor(id, color);
}
-bool UpdateProxy::SetColor( uint32_t id, const Vector4& color )
+bool UpdateProxy::SetColor(uint32_t id, const Vector4& color)
{
- return mImpl.SetColor( id, color );
+ return mImpl.SetColor(id, color);
}
-bool UpdateProxy::BakeColor( uint32_t id, const Vector4& color )
+bool UpdateProxy::BakeColor(uint32_t id, const Vector4& color)
{
- return mImpl.BakeColor( id, color );
+ return mImpl.BakeColor(id, color);
}
-UpdateProxy::UpdateProxy( Internal::UpdateProxy& impl )
-: mImpl( impl )
+UpdateProxy::UpdateProxy(Internal::UpdateProxy& impl)
+: mImpl(impl)
{
}
#define DALI_UPDATE_PROXY_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class UpdateProxy;
class DALI_CORE_API UpdateProxy
{
public:
-
/**
* @brief Given the Actor ID, this retrieves that Actor's local position.
* @param[in] id The Actor ID
* @param[out] position Set to the Actor's current position, if Actor ID is valid
* @return Whether the method call was successful or not.
*/
- bool GetPosition( uint32_t id, Vector3& position ) const;
+ bool GetPosition(uint32_t id, Vector3& position) const;
/**
* @brief Allows setting an Actor's local position from the Frame callback function for the current frame only.
* @return Whether the method call was successful or not.
* @note This will get reset to the internally calculated or previously baked value in the next frame, so will have to be set again.
*/
- bool SetPosition( uint32_t id, const Vector3& position );
+ bool SetPosition(uint32_t id, const Vector3& position);
/**
* @brief Allows baking an Actor's local position from the Frame callback function.
* @return Whether the method call was successful or not.
* @note The value is saved so will cause undesired effects if this property is being animated.
*/
- bool BakePosition( uint32_t id, const Vector3& position );
+ bool BakePosition(uint32_t id, const Vector3& position);
/**
* @brief Given the Actor ID, this retrieves that Actor's size.
* @param[out] size Set to the Actor's current size, if Actor ID is valid
* @return Whether the method call was successful or not.
*/
- bool GetSize( uint32_t id, Vector3& size ) const;
+ bool GetSize(uint32_t id, Vector3& size) const;
/**
* @brief Allows setting an Actor's size from the Frame callback function for the current frame only.
* @return Whether the method call was successful or not.
* @note This will get reset to the internally calculated or previously baked value in the next frame, so will have to be set again.
*/
- bool SetSize( uint32_t id, const Vector3& size );
+ bool SetSize(uint32_t id, const Vector3& size);
/**
* @brief Allows baking an Actor's size from the Frame callback function.
* @return Whether the method call was successful or not.
* @note The value is saved so will cause undesired effects if this property is being animated.
*/
- bool BakeSize( uint32_t id, const Vector3& size );
+ bool BakeSize(uint32_t id, const Vector3& size);
/**
* @brief Given the Actor ID, this retrieves that Actor's local position and size.
* @param[out] size Set to the Actor's current size, if Actor ID is valid
* @return Whether the method call was successful or not.
*/
- bool GetPositionAndSize( uint32_t id, Vector3& position, Vector3& size ) const;
+ bool GetPositionAndSize(uint32_t id, Vector3& position, Vector3& size) const;
/**
* @brief Given the Actor ID, this retrieves that Actor's local scale.
* @param[out] scale Set to the Actor's current scale, if Actor ID is valid
* @return Whether the method call was successful or not.
*/
- bool GetScale( uint32_t id, Vector3& scale ) const;
+ bool GetScale(uint32_t id, Vector3& scale) const;
/**
* @brief Allows setting an Actor's local scale from the Frame callback function for the current frame only.
* @return Whether the method call was successful or not.
* @note This will get reset to the internally calculated or previously baked value in the next frame, so will have to be set again.
*/
- bool SetScale( uint32_t id, const Vector3& scale );
+ bool SetScale(uint32_t id, const Vector3& scale);
/**
* @brief Allows baking an Actor's local scale from the Frame callback function.
* @return Whether the method call was successful or not.
* @note The value is saved so will cause undesired effects if this property is being animated.
*/
- bool BakeScale( uint32_t id, const Vector3& scale );
+ bool BakeScale(uint32_t id, const Vector3& scale);
/**
* @brief Given the Actor ID, this retrieves that Actor's local color.
* @param[out] color Set to the Actor's current color, if Actor ID is valid
* @return Whether the method call was successful or not.
*/
- bool GetColor( uint32_t id, Vector4& color ) const;
+ bool GetColor(uint32_t id, Vector4& color) const;
/**
* @brief Allows setting an Actor's local color from the Frame callback function for the current frame only.
* @return Whether the method call was successful or not.
* @note This will get reset to the internally calculated or previously baked value in the next frame, so will have to be set again.
*/
- bool SetColor( uint32_t id, const Vector4& color );
+ bool SetColor(uint32_t id, const Vector4& color);
/**
* @brief Allows baking an Actor's local color from the Frame callback function.
* @return Whether the method call was successful or not.
* @note The value is saved so will cause undesired effects if this property is being animated.
*/
- bool BakeColor( uint32_t id, const Vector4& color );
+ bool BakeColor(uint32_t id, const Vector4& color);
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief Constructor.
* @param[in] impl A reference to the internal object.
*/
- DALI_INTERNAL UpdateProxy( Internal::UpdateProxy& impl );
+ DALI_INTERNAL UpdateProxy(Internal::UpdateProxy& impl);
/**
* @brief Destructor.
// Not copyable or movable
- UpdateProxy( const UpdateProxy& ) = delete; ///< Deleted copy constructor
- UpdateProxy( UpdateProxy&& ) = delete; ///< Deleted move constructor
- UpdateProxy& operator=( const UpdateProxy& ) = delete; ///< Deleted copy assignment operator
- UpdateProxy& operator=( UpdateProxy&& ) = delete; ///< Deleted move assignment operator
+ UpdateProxy(const UpdateProxy&) = delete; ///< Deleted copy constructor
+ UpdateProxy(UpdateProxy&&) = delete; ///< Deleted move constructor
+ UpdateProxy& operator=(const UpdateProxy&) = delete; ///< Deleted copy assignment operator
+ UpdateProxy& operator=(UpdateProxy&&) = delete; ///< Deleted move assignment operator
/// @endcond
private:
-
/// @cond internal
Internal::UpdateProxy& mImpl;
/// @endcond
{
return mSingleton;
}
-}
-}
+} // namespace Integration
+} // namespace Dali
#include <dali/public-api/object/base-handle.h>
// EXTERNAL EXCLUDES
-#include <string>
+#include <cstdio>
+#include <functional>
#include <memory>
+#include <string>
#include <vector>
-#include <functional>
-#include <cstdio>
namespace Dali
{
* @param[in] rev Revision version number
* @return returns 32-bit version number
*/
-constexpr uint32_t DALI_ADDON_VERSION( uint32_t maj, uint32_t min, uint32_t rev )
+constexpr uint32_t DALI_ADDON_VERSION(uint32_t maj, uint32_t min, uint32_t rev)
{
- return ((maj&0xff) << 24) | ((min & 0xfff) << 16);
+ return ((maj & 0xff) << 24) | ((min & 0xfff) << 16);
}
/**
*/
struct AddOnInfo
{
- AddOnType type; /// may be use in order to classify extension
- void* next; /// holds pointer to additional data-structures
+ AddOnType type; /// may be use in order to classify extension
+ void* next; /// holds pointer to additional data-structures
- std::string name; /// Name of the extension
+ std::string name; /// Name of the extension
uint32_t version;
/**
struct AddOnDispatchTable
{
std::string name;
- void (*GetAddOnInfo)( Dali::AddOnInfo&) = nullptr;
- void*(*GetGlobalProc)(const char*) = nullptr;
- void*(*GetInstanceProc)(const char*) = nullptr;
+ void (*GetAddOnInfo)(Dali::AddOnInfo&) = nullptr;
+ void* (*GetGlobalProc)(const char*) = nullptr;
+ void* (*GetInstanceProc)(const char*) = nullptr;
// Lifecycle callbacks
- void(*OnStart)() = nullptr;
- void(*OnResume)() = nullptr;
- void(*OnPause)() = nullptr;
- void(*OnStop)() = nullptr;
+ void (*OnStart)() = nullptr;
+ void (*OnResume)() = nullptr;
+ void (*OnPause)() = nullptr;
+ void (*OnStop)() = nullptr;
};
/**
AddOnManager();
public:
-
/**
* @brief Destructor
*/
* @param[out]] info Output reference
* @return True on success, False if extension info cannot be retrieved
*/
- virtual bool GetAddOnInfo(const std::string& name, AddOnInfo& info ) = 0;
+ virtual bool GetAddOnInfo(const std::string& name, AddOnInfo& info) = 0;
/**
* @brief Loads and initialises specified extensions
* @param[in] extensionNames Array of extension names
* @return vector of initialised extension handles
*/
- virtual std::vector<AddOnLibrary> LoadAddOns( const std::vector<std::string>& addonNames ) = 0;
+ virtual std::vector<AddOnLibrary> LoadAddOns(const std::vector<std::string>& addonNames) = 0;
/**
* @brief Loads AddOn with specified name
* @param[in] addOnName Name of AddOn to be acquired
* @return Returns a valid handle or nullptr
*/
- inline AddOnLibrary GetAddOn( const std::string& addonName )
+ inline AddOnLibrary GetAddOn(const std::string& addonName)
{
- return LoadAddOns( { addonName } )[0];
+ return LoadAddOns({addonName})[0];
}
/**
* @param[in] procName Name of the function to retrieve
* @return Pointer to the function or null if function doesn't exist
*/
- virtual void* GetGlobalProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) = 0;
+ virtual void* GetGlobalProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) = 0;
/**
* @brief Returns addon instance function pointer
* @param[in] procName Name of the function to retrieve
* @return Pointer to the function or null if function doesn't exist
*/
- virtual void* GetInstanceProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) = 0;
+ virtual void* GetInstanceProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) = 0;
/**
* @brief Returns addon global function of specified type
* @return std::function object or null if function doesn't exist
*/
template<class T>
- DALI_INTERNAL std::function<T> GetGlobalProc( const Dali::AddOnLibrary& addonlibrary, const char* procName )
+ DALI_INTERNAL std::function<T> GetGlobalProc(const Dali::AddOnLibrary& addonlibrary, const char* procName)
{
- auto ptr = GetGlobalProc( addonlibrary, procName );
- if( ptr )
+ auto ptr = GetGlobalProc(addonlibrary, procName);
+ if(ptr)
{
- return std::function<T>( *reinterpret_cast<T**>(&ptr) );
+ return std::function<T>(*reinterpret_cast<T**>(&ptr));
}
return {};
};
* @return std::function object or null if function doesn't exist
*/
template<class T>
- DALI_INTERNAL std::function<T> GetInstanceProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName )
+ DALI_INTERNAL std::function<T> GetInstanceProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName)
{
- auto ptr = GetInstanceProc( addOnLibrary, procName );
- if( ptr )
+ auto ptr = GetInstanceProc(addOnLibrary, procName);
+ if(ptr)
{
- return std::function<T>( *reinterpret_cast<T**>(&ptr) );
+ return std::function<T>(*reinterpret_cast<T**>(&ptr));
}
return {};
};
* @return Result of called function
*/
template<class R, class... Args>
- DALI_INTERNAL R InvokeGlobalProc( AddOnLibrary addOnLibrary, const char* functionName, Args&&... args)
+ DALI_INTERNAL R InvokeGlobalProc(AddOnLibrary addOnLibrary, const char* functionName, Args&&... args)
{
- return std::move(GetGlobalProc<R(Args...)>( addOnLibrary, functionName )( args... ));
+ return std::move(GetGlobalProc<R(Args...)>(addOnLibrary, functionName)(args...));
}
// Lifecycle events, functions are called by the Adaptor
public:
-
/**
* @brief Lifecycle pause function
*/
// Functions called by the AddOn
public:
-
/**
* @brief Registers the dispatch table with AddOnManager.
*
*
* @param[in] dispatchTable Pointer to the valid dispatch table
*/
- virtual void RegisterAddOnDispatchTable( const AddOnDispatchTable* dispatchTable ) = 0;
+ virtual void RegisterAddOnDispatchTable(const AddOnDispatchTable* dispatchTable) = 0;
/**
* @brief Retrieves AddOnManager singleton
static AddOnManager* Get();
protected:
-
static AddOnManager* mSingleton; ///< Singleton storing an instance of AddOnManager
};
} // namespace Integration
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/gl-abstraction.h>
+#include <dali/integration-api/gl-defines.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/images/bitmap-packed-pixel.h>
#include <dali/internal/event/images/bitmap-compressed.h>
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/integration-api/gl-defines.h>
+#include <dali/internal/event/images/bitmap-packed-pixel.h>
namespace Dali
{
-
namespace Integration
{
using namespace Dali::Pixel;
-void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& internalFormat )
+void ConvertToGlFormat(Format pixelformat, unsigned& pixelDataType, unsigned& internalFormat)
{
// Compressed textures have no pixelDataType, so init to an invalid value:
- pixelDataType = -1;
+ pixelDataType = -1;
- switch( pixelformat )
+ switch(pixelformat)
{
case A8:
{
- pixelDataType = GL_UNSIGNED_BYTE;
- internalFormat= GL_ALPHA;
+ pixelDataType = GL_UNSIGNED_BYTE;
+ internalFormat = GL_ALPHA;
break;
}
case L8:
{
- pixelDataType = GL_UNSIGNED_BYTE;
- internalFormat= GL_LUMINANCE;
+ pixelDataType = GL_UNSIGNED_BYTE;
+ internalFormat = GL_LUMINANCE;
break;
}
case LA88:
{
- pixelDataType = GL_UNSIGNED_BYTE;
- internalFormat= GL_LUMINANCE_ALPHA;
+ pixelDataType = GL_UNSIGNED_BYTE;
+ internalFormat = GL_LUMINANCE_ALPHA;
break;
}
case RGB565:
{
- pixelDataType = GL_UNSIGNED_SHORT_5_6_5;
- internalFormat= GL_RGB;
+ pixelDataType = GL_UNSIGNED_SHORT_5_6_5;
+ internalFormat = GL_RGB;
break;
}
case BGR565:
{
DALI_LOG_ERROR("Pixel format BGR565 is not supported by GLES.\n");
- pixelDataType = GL_UNSIGNED_SHORT_5_6_5;
+ pixelDataType = GL_UNSIGNED_SHORT_5_6_5;
#ifdef _ARCH_ARM_
- internalFormat= GL_BGRA_EXT; // alpha is reserved but not used
+ internalFormat = GL_BGRA_EXT; // alpha is reserved but not used
#else
- internalFormat= GL_RGBA; // alpha is reserved but not used
+ internalFormat = GL_RGBA; // alpha is reserved but not used
#endif
break;
}
case RGBA4444:
{
- pixelDataType = GL_UNSIGNED_SHORT_4_4_4_4;
- internalFormat= GL_RGBA;
+ pixelDataType = GL_UNSIGNED_SHORT_4_4_4_4;
+ internalFormat = GL_RGBA;
break;
}
case BGRA4444:
{
DALI_LOG_ERROR("Pixel format BGRA4444 is not supported by GLES.\n");
- pixelDataType = GL_UNSIGNED_SHORT_4_4_4_4;
+ pixelDataType = GL_UNSIGNED_SHORT_4_4_4_4;
#ifdef _ARCH_ARM_
- internalFormat= GL_BGRA_EXT; // alpha is reserved but not used
+ internalFormat = GL_BGRA_EXT; // alpha is reserved but not used
#else
- internalFormat= GL_RGBA; // alpha is reserved but not used
+ internalFormat = GL_RGBA; // alpha is reserved but not used
#endif
break;
}
case RGBA5551:
{
- pixelDataType = GL_UNSIGNED_SHORT_5_5_5_1;
- internalFormat= GL_RGBA;
+ pixelDataType = GL_UNSIGNED_SHORT_5_5_5_1;
+ internalFormat = GL_RGBA;
break;
}
case BGRA5551:
{
DALI_LOG_ERROR("Pixel format BGRA5551 is not supported by GLES.\n");
- pixelDataType = GL_UNSIGNED_SHORT_5_5_5_1;
+ pixelDataType = GL_UNSIGNED_SHORT_5_5_5_1;
#ifdef _ARCH_ARM_
- internalFormat= GL_BGRA_EXT; // alpha is reserved but not used
+ internalFormat = GL_BGRA_EXT; // alpha is reserved but not used
#else
- internalFormat= GL_RGBA; // alpha is reserved but not used
+ internalFormat = GL_RGBA; // alpha is reserved but not used
#endif
break;
}
case RGB888:
{
- pixelDataType = GL_UNSIGNED_BYTE;
- internalFormat= GL_RGB;
+ pixelDataType = GL_UNSIGNED_BYTE;
+ internalFormat = GL_RGB;
break;
}
case RGB8888:
{
- pixelDataType = GL_UNSIGNED_BYTE;
- internalFormat= GL_RGBA; // alpha is reserved but not used
+ pixelDataType = GL_UNSIGNED_BYTE;
+ internalFormat = GL_RGBA; // alpha is reserved but not used
break;
}
{
pixelDataType = GL_UNSIGNED_BYTE;
#ifdef GL_BGRA_EXT
- internalFormat= GL_BGRA_EXT; // alpha is reserved but not used
+ internalFormat = GL_BGRA_EXT; // alpha is reserved but not used
#else
- internalFormat= GL_RGBA; // alpha is reserved but not used
+ internalFormat = GL_RGBA; // alpha is reserved but not used
#endif
- break;
+ break;
}
case RGBA8888:
{
- pixelDataType = GL_UNSIGNED_BYTE;
- internalFormat= GL_RGBA;
+ pixelDataType = GL_UNSIGNED_BYTE;
+ internalFormat = GL_RGBA;
break;
}
{
pixelDataType = GL_UNSIGNED_BYTE;
#ifdef GL_BGRA_EXT
- internalFormat= GL_BGRA_EXT; // alpha is reserved but not used
+ internalFormat = GL_BGRA_EXT; // alpha is reserved but not used
#else
- internalFormat= GL_RGBA; // alpha is reserved but not used
+ internalFormat = GL_RGBA; // alpha is reserved but not used
#endif
break;
}
// GLES 2 extension compressed formats:
case COMPRESSED_RGB8_ETC1:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB8_ETC1.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB8_ETC1.\n");
internalFormat = 0x8D64; ///! < Hardcoded so we can test before we move to GLES 3.0 or greater.
break;
}
case COMPRESSED_RGB_PVRTC_4BPPV1:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB_PVRTC_4BPPV1.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB_PVRTC_4BPPV1.\n");
internalFormat = 0x8C00; ///! < Hardcoded so we can test before we move to GLES 3.0 or greater.
break;
}
}
case COMPRESSED_SIGNED_R11_EAC:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_R11_EAC.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_R11_EAC.\n");
internalFormat = GL_COMPRESSED_SIGNED_R11_EAC;
break;
}
case COMPRESSED_RG11_EAC:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RG11_EAC.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RG11_EAC.\n");
internalFormat = GL_COMPRESSED_RG11_EAC;
break;
}
case COMPRESSED_SIGNED_RG11_EAC:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_RG11_EAC.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_RG11_EAC.\n");
internalFormat = GL_COMPRESSED_SIGNED_RG11_EAC;
break;
}
case COMPRESSED_RGB8_ETC2:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_ETC2.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_ETC2.\n");
internalFormat = GL_COMPRESSED_RGB8_ETC2;
break;
}
case COMPRESSED_SRGB8_ETC2:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ETC2.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ETC2.\n");
internalFormat = GL_COMPRESSED_SRGB8_ETC2;
break;
}
case COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n");
internalFormat = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
break;
}
case COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n");
internalFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
break;
}
case COMPRESSED_RGBA8_ETC2_EAC:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGBA8_ETC2_EAC.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGBA8_ETC2_EAC.\n");
internalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ETC2_EAC.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ETC2_EAC.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
break;
}
// GLES 3.1 extension compressed formats:
case COMPRESSED_RGBA_ASTC_4x4_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_4x4_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_4x4_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_5x4_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x4_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x4_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_5x5_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x5_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x5_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_6x5_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x5_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x5_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_6x6_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x6_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x6_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_8x5_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x5_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x5_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_8x6_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x6_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x6_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_8x8_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x8_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x8_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_10x5_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x5_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x5_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_10x6_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x6_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x6_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_10x8_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x8_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x8_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_10x10_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x10_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x10_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_12x10_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x10_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x10_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
break;
}
case COMPRESSED_RGBA_ASTC_12x12_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x12_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x12_KHR.\n");
internalFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
break;
}
case COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR.\n" );
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR.\n");
internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
break;
}
// GLES 3.0 floating point formats.
case RGB16F:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n" );
- pixelDataType = GL_HALF_FLOAT;
- internalFormat= GL_RGB;
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n");
+ pixelDataType = GL_HALF_FLOAT;
+ internalFormat = GL_RGB;
break;
}
case RGB32F:
{
- DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n" );
- pixelDataType = GL_FLOAT;
- internalFormat= GL_RGB;
+ DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n");
+ pixelDataType = GL_FLOAT;
+ internalFormat = GL_RGB;
break;
}
// GLES 3.0 depth and stencil formats
case Pixel::DEPTH_UNSIGNED_INT:
{
- pixelDataType = GL_UNSIGNED_INT;
+ pixelDataType = GL_UNSIGNED_INT;
internalFormat = GL_DEPTH_COMPONENT;
break;
}
case Pixel::DEPTH_FLOAT:
{
- pixelDataType = GL_FLOAT;
+ pixelDataType = GL_FLOAT;
internalFormat = GL_DEPTH_COMPONENT;
break;
}
case Pixel::DEPTH_STENCIL:
{
- pixelDataType = GL_UNSIGNED_INT_24_8;
+ pixelDataType = GL_UNSIGNED_INT_24_8;
internalFormat = GL_DEPTH_STENCIL;
break;
}
case INVALID:
{
- DALI_LOG_ERROR( "Invalid pixel format for bitmap\n" );
+ DALI_LOG_ERROR("Invalid pixel format for bitmap\n");
internalFormat = 0;
break;
}
}
}
-Bitmap* Bitmap::New( const Profile profile = BITMAP_2D_PACKED_PIXELS,
- ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_DISCARD )
+Bitmap* Bitmap::New(const Profile profile = BITMAP_2D_PACKED_PIXELS,
+ ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_DISCARD)
{
DALI_ASSERT_DEBUG(profile == BITMAP_2D_PACKED_PIXELS || profile == BITMAP_COMPRESSED);
- switch( profile )
+ switch(profile)
{
/** A 2D array of pixels where each pixel is a whole number of bytes
* and each scanline of the backing memory buffer may have additional
* scanlines past the bottom of the image in the buffer if requested.*/
case BITMAP_2D_PACKED_PIXELS:
{
- Bitmap * const bitmap = new Dali::Internal::BitmapPackedPixel( discardable );
+ Bitmap* const bitmap = new Dali::Internal::BitmapPackedPixel(discardable);
return bitmap;
}
/** The data for the bitmap is buffered in an opaque form.*/
case BITMAP_COMPRESSED:
{
- return new Dali::Internal::BitmapCompressed( discardable );
+ return new Dali::Internal::BitmapCompressed(discardable);
}
}
return nullptr;
}
-
-Bitmap::Bitmap( ResourcePolicy::Discardable discardable, Dali::Integration::PixelBuffer* pixBuf)
+Bitmap::Bitmap(ResourcePolicy::Discardable discardable, Dali::Integration::PixelBuffer* pixBuf)
: mImageWidth(0),
mImageHeight(0),
mPixelFormat(Pixel::RGBA8888),
PixelBuffer* Bitmap::GetBufferOwnership()
{
PixelBuffer* buffer = mData;
- mData = nullptr;
+ mData = nullptr;
return buffer;
}
void Bitmap::DiscardBuffer()
{
- if( mDiscardable == ResourcePolicy::OWNED_DISCARD )
+ if(mDiscardable == ResourcePolicy::OWNED_DISCARD)
{
DeletePixelBuffer();
}
* */
void Bitmap::DeletePixelBuffer()
{
- if( !mData )
+ if(!mData)
{
return;
}
- free ( mData );
+ free(mData);
mData = nullptr;
}
-
-void Bitmap::Initialize( Pixel::Format pixelFormat,
- unsigned int width,
- unsigned int height)
+void Bitmap::Initialize(Pixel::Format pixelFormat,
+ unsigned int width,
+ unsigned int height)
{
DALI_ASSERT_DEBUG(width * height < (32 * 1024) * (32 * 1024) && "The total area of the bitmap is too great.\n");
- mImageWidth = width;
- mImageHeight = height;
- mPixelFormat = pixelFormat;
+ mImageWidth = width;
+ mImageHeight = height;
+ mPixelFormat = pixelFormat;
mHasAlphaChannel = Pixel::HasAlpha(pixelFormat);
}
#define DALI_INTEGRATION_BITMAP_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/resource-policies.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/images/pixel.h>
#include <dali/public-api/object/ref-object.h>
-#include <dali/integration-api/resource-policies.h>
namespace Dali
{
-
namespace Integration
{
-
/**
* Returns GL data type and internal format for specified pixel format
* @param[in] pixelformat pixel format (eg. Pixel::RGBA32)
class DALI_CORE_API Bitmap : public Dali::RefObject
{
protected:
-
/**
* Constructor
* Use the static function Bitmap::New() to create instances.
* @param[in] discardable Flag to tell the bitmap if it can delete the buffer with the pixel data.
* @param[in] pixBuf External buffer of pixel data or null.
*/
- Bitmap( ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_RETAIN, Dali::Integration::PixelBuffer* pixBuf = nullptr );
+ Bitmap(ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_RETAIN, Dali::Integration::PixelBuffer* pixBuf = nullptr);
/**
* Initializes internal class members
* @param[in] height Image height in pixels
*/
void Initialize(Pixel::Format pixelFormat,
- uint32_t width,
- uint32_t height);
-
+ uint32_t width,
+ uint32_t height);
public:
/** Defines the characteristics of the Bitmap returned from the factory
enum ReleaseFunction
{
- FREE, ///< Use free function to release the buffer
- DELETE_ARRAY, ///< Use delete[] operator to release the buffer
+ FREE, ///< Use free function to release the buffer
+ DELETE_ARRAY, ///< Use delete[] operator to release the buffer
};
/**
* OWNED_RETAIN means that the data is owned and must be kept in CPU memory
* e.g. for an image that cannot be reloaded from disk.
*/
- static Bitmap* New( Profile profile, ResourcePolicy::Discardable discardable );
+ static Bitmap* New(Profile profile, ResourcePolicy::Discardable discardable);
/** \name GeneralFeatures
* Features that are generic between profiles. */
/**@}*/ ///< End of generic features
-
/** \name PackedPixelsProfile
* Features that are active only if the Bitmap was created with a
* BITMAP_2D_PACKED_PIXELS profile. */
class PackedPixelsProfile
{
public:
-
/**
* (Re-)Allocate pixel buffer for the Bitmap. Any previously allocated pixel buffer is deleted.
* Dali has ownership of the buffer, but its contents can be modified.
* @return pixel buffer pointer
*/
virtual PixelBuffer* ReserveBuffer(Pixel::Format pixelFormat,
- uint32_t width,
- uint32_t height,
- uint32_t bufferWidth = 0,
- uint32_t bufferHeight = 0) = 0;
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth = 0,
+ uint32_t bufferHeight = 0) = 0;
/**
* Assign a pixel buffer. Any previously allocated pixel buffer is deleted.
* @param[in] bufferHeight Buffer height in pixels
*/
virtual void AssignBuffer(Pixel::Format pixelFormat,
- PixelBuffer* buffer,
- uint32_t bufferSize,
- uint32_t width,
- uint32_t height,
- uint32_t bufferWidth = 0,
- uint32_t bufferHeight = 0) = 0;
+ PixelBuffer* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bufferWidth = 0,
+ uint32_t bufferHeight = 0) = 0;
/**
* Get the width of the buffer (stride)
* @return The width of the buffer in pixels
virtual void TestForTransparency() = 0;
protected:
-
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~PackedPixelsProfile() {}
+ virtual ~PackedPixelsProfile()
+ {
+ }
};
/**
* Get interface to features that are active only if the Bitmap was created
* with a BITMAP_2D_PACKED_PIXELS profile. */
- virtual const PackedPixelsProfile* GetPackedPixelsProfile() const { return nullptr; }
+ virtual const PackedPixelsProfile* GetPackedPixelsProfile() const
+ {
+ return nullptr;
+ }
/**
* Get interface to features that are active only if the Bitmap was created
* with a BITMAP_2D_PACKED_PIXELS profile. */
- virtual PackedPixelsProfile* GetPackedPixelsProfile() { return nullptr; }
+ virtual PackedPixelsProfile* GetPackedPixelsProfile()
+ {
+ return nullptr;
+ }
/**@}*/ ///< End of packed pixel features.
-
/** \name CompressedProfile
* Features that only apply to opaque/compressed formats. */
/**@{*/
* @param[in] bufferSize Buffer size in bytes
* @return pixel buffer pointer
*/
- virtual PixelBuffer* ReserveBufferOfSize( Pixel::Format pixelFormat,
- const unsigned width,
- const unsigned height,
- const uint32_t numBytes ) = 0;
- protected:
+ virtual PixelBuffer* ReserveBufferOfSize(Pixel::Format pixelFormat,
+ const unsigned width,
+ const unsigned height,
+ const uint32_t numBytes) = 0;
+ protected:
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~CompressedProfile() {}
+ virtual ~CompressedProfile()
+ {
+ }
};
- virtual const CompressedProfile* GetCompressedProfile() const { return nullptr; }
- virtual CompressedProfile* GetCompressedProfile() { return nullptr; }
+ virtual const CompressedProfile* GetCompressedProfile() const
+ {
+ return nullptr;
+ }
+ virtual CompressedProfile* GetCompressedProfile()
+ {
+ return nullptr;
+ }
/**@}*/
-
/**
* Inform the bitmap that its pixel buffer is no longer required and can be
* deleted to free up memory if the bitmap owns the buffer.
void DeletePixelBuffer();
protected:
-
/**
* A reference counted object may only be deleted by calling Unreference()
*/
~Bitmap() override;
protected:
-
- uint32_t mImageWidth; ///< Image width in pixels
- uint32_t mImageHeight; ///< Image height in pixels
- Pixel::Format mPixelFormat; ///< Pixel format
- bool mHasAlphaChannel; ///< Whether the image has an alpha channel
- bool mAlphaChannelUsed; ///< Whether the alpha channel is used in case the image owns one.
- PixelBuffer* mData; ///< Raw pixel data
+ uint32_t mImageWidth; ///< Image width in pixels
+ uint32_t mImageHeight; ///< Image height in pixels
+ Pixel::Format mPixelFormat; ///< Pixel format
+ bool mHasAlphaChannel; ///< Whether the image has an alpha channel
+ bool mAlphaChannelUsed; ///< Whether the alpha channel is used in case the image owns one.
+ PixelBuffer* mData; ///< Raw pixel data
private:
-
ResourcePolicy::Discardable mDiscardable; ///< Should delete the buffer when discard buffer is called.
- Bitmap(const Bitmap& other); ///< defined private to prevent use
- Bitmap& operator = (const Bitmap& other); ///< defined private to prevent use
+ Bitmap(const Bitmap& other); ///< defined private to prevent use
+ Bitmap& operator=(const Bitmap& other); ///< defined private to prevent use
// Changes scope, should be at end of class
DALI_LOG_OBJECT_STRING_DECLARATION;
#define DALI_INTEGRATION_CONTEXT_NOTIFIER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
{
namespace Integration
{
-
/**
* Interface to inform dali core of context loss and regain
*/
virtual void NotifyContextRegained() = 0;
protected:
-
/**
* Virtual destructor, no deletion through this interface
*/
- virtual ~ContextNotifierInterface() {}
-
+ virtual ~ContextNotifierInterface()
+ {
+ }
};
} // namespace Integration
} // namespace Dali
-
#endif // DALI_INTEGRATION_CONTEXT_NOTIFIER_H
#define DALI_INTEGRATION_CORE_ENUMERATIONS_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/integration-api/context-notifier.h>
#include <dali/integration-api/resource-policies.h>
+#include <dali/public-api/common/dali-common.h>
#undef FALSE
#undef TRUE
namespace Dali
{
-
namespace Integration
{
-
/**
* @brief Enumerations to specify whether we should render to the frame-buffer.
*/
#include <dali/integration-api/core.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/actors/layer.h>
-#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/integration-api/events/event.h>
-#include <dali/integration-api/gl-sync-abstraction.h>
#include <dali/integration-api/gl-context-helper-abstraction.h>
+#include <dali/integration-api/gl-sync-abstraction.h>
#include <dali/integration-api/processor-interface.h>
#include <dali/internal/common/core-impl.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
namespace Dali
{
-
namespace Integration
{
-
-Core* Core::New( RenderController& renderController,
- PlatformAbstraction& platformAbstraction,
- GlAbstraction& glAbstraction,
- GlSyncAbstraction& glSyncAbstraction,
- GlContextHelperAbstraction& glContextHelperAbstraction,
- RenderToFrameBuffer renderToFboEnabled,
- DepthBufferAvailable depthBufferAvailable,
- StencilBufferAvailable stencilBufferAvailable,
- PartialUpdateAvailable partialUpdateAvailable )
-{
- Core* instance = new Core;
- instance->mImpl = new Internal::Core( renderController,
- platformAbstraction,
- glAbstraction,
- glSyncAbstraction,
- glContextHelperAbstraction,
- renderToFboEnabled,
- depthBufferAvailable,
- stencilBufferAvailable,
- partialUpdateAvailable );
+Core* Core::New(RenderController& renderController,
+ PlatformAbstraction& platformAbstraction,
+ GlAbstraction& glAbstraction,
+ GlSyncAbstraction& glSyncAbstraction,
+ GlContextHelperAbstraction& glContextHelperAbstraction,
+ RenderToFrameBuffer renderToFboEnabled,
+ DepthBufferAvailable depthBufferAvailable,
+ StencilBufferAvailable stencilBufferAvailable,
+ PartialUpdateAvailable partialUpdateAvailable)
+{
+ Core* instance = new Core;
+ instance->mImpl = new Internal::Core(renderController,
+ platformAbstraction,
+ glAbstraction,
+ glSyncAbstraction,
+ glContextHelperAbstraction,
+ renderToFboEnabled,
+ depthBufferAvailable,
+ stencilBufferAvailable,
+ partialUpdateAvailable);
return instance;
}
return mImpl->GetMaximumUpdateCount();
}
-void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
+void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo)
{
- mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo );
+ mImpl->Update(elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo);
}
-void Core::PreRender( RenderStatus& status, bool forceClear, bool uploadOnly )
+void Core::PreRender(RenderStatus& status, bool forceClear, bool uploadOnly)
{
- mImpl->PreRender( status, forceClear, uploadOnly );
+ mImpl->PreRender(status, forceClear, uploadOnly);
}
-void Core::PreRender( Integration::Scene& scene, std::vector<Rect<int>>& damagedRects )
+void Core::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
{
- mImpl->PreRender( scene, damagedRects );
+ mImpl->PreRender(scene, damagedRects);
}
-void Core::RenderScene( RenderStatus& status, Integration::Scene& scene, bool renderToFbo )
+void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo)
{
- mImpl->RenderScene( status, scene, renderToFbo );
+ mImpl->RenderScene(status, scene, renderToFbo);
}
-void Core::RenderScene( RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect )
+void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect)
{
- mImpl->RenderScene( status, scene, renderToFbo, clippingRect );
+ mImpl->RenderScene(status, scene, renderToFbo, clippingRect);
}
-void Core::PostRender( bool uploadOnly )
+void Core::PostRender(bool uploadOnly)
{
- mImpl->PostRender( uploadOnly );
+ mImpl->PostRender(uploadOnly);
}
-void Core::RegisterProcessor( Processor& processor )
+void Core::RegisterProcessor(Processor& processor)
{
- mImpl->RegisterProcessor( processor );
+ mImpl->RegisterProcessor(processor);
}
-void Core::UnregisterProcessor( Processor& processor )
+void Core::UnregisterProcessor(Processor& processor)
{
- mImpl->UnregisterProcessor( processor );
+ mImpl->UnregisterProcessor(processor);
}
ObjectRegistry Core::GetObjectRegistry() const
{
- return ObjectRegistry( &mImpl->GetObjectRegistry() );
+ return ObjectRegistry(&mImpl->GetObjectRegistry());
}
Core::Core()
-: mImpl( nullptr )
+: mImpl(nullptr)
{
}
#include <cstdint> // uint32_t
// INTERNAL INCLUDES
+#include <dali/integration-api/context-notifier.h>
+#include <dali/integration-api/core-enumerations.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/math/rect.h>
-#include <dali/integration-api/context-notifier.h>
-#include <dali/integration-api/core-enumerations.h>
namespace Dali
{
-
class Layer;
class ObjectRegistry;
class RenderTaskList;
struct Event;
struct TouchEvent;
-
/**
* The reasons why further updates are required.
*/
{
enum Reasons
{
- NOT_REQUESTED = 0, ///< Zero means that no further updates are required
- STAGE_KEEP_RENDERING = 1<<1, ///< - Stage::KeepRendering() is being used
- ANIMATIONS_RUNNING = 1<<2, ///< - Animations are ongoing
- MONITORING_PERFORMANCE = 1<<3, ///< - The --enable-performance-monitor option is being used
- RENDER_TASK_SYNC = 1<<4 ///< - A render task is waiting for render sync
+ NOT_REQUESTED = 0, ///< Zero means that no further updates are required
+ STAGE_KEEP_RENDERING = 1 << 1, ///< - Stage::KeepRendering() is being used
+ ANIMATIONS_RUNNING = 1 << 2, ///< - Animations are ongoing
+ MONITORING_PERFORMANCE = 1 << 3, ///< - The --enable-performance-monitor option is being used
+ RENDER_TASK_SYNC = 1 << 4 ///< - A render task is waiting for render sync
};
}
class UpdateStatus
{
public:
-
/**
* Constructor
*/
: keepUpdating(false),
needsNotification(false),
surfaceRectChanged(false),
- secondsFromLastFrame( 0.0f )
+ secondsFromLastFrame(0.0f)
{
}
public:
-
/**
* Query whether the Core has further frames to update & render e.g. when animations are ongoing.
* @return A bitmask of KeepUpdating values
*/
- uint32_t KeepUpdating() { return keepUpdating; }
+ uint32_t KeepUpdating()
+ {
+ return keepUpdating;
+ }
/**
* Query whether the Core requires an Notification event.
* This should be sent through the same mechanism (e.g. event loop) as input events.
* @return True if an Notification event should be sent.
*/
- bool NeedsNotification() { return needsNotification; }
+ bool NeedsNotification()
+ {
+ return needsNotification;
+ }
/**
* Query wheter the default surface rect is changed or not.
* @return true if the default surface rect is changed.
*/
- bool SurfaceRectChanged() { return surfaceRectChanged; }
+ bool SurfaceRectChanged()
+ {
+ return surfaceRectChanged;
+ }
/**
* This method is provided so that FPS can be easily calculated with a release version
* of Core.
* @return the seconds from last frame as float
*/
- float SecondsFromLastFrame() { return secondsFromLastFrame; }
+ float SecondsFromLastFrame()
+ {
+ return secondsFromLastFrame;
+ }
public:
-
uint32_t keepUpdating; ///< A bitmask of KeepUpdating values
- bool needsNotification;
- bool surfaceRectChanged;
- float secondsFromLastFrame;
+ bool needsNotification;
+ bool surfaceRectChanged;
+ float secondsFromLastFrame;
};
/**
class RenderStatus
{
public:
-
/**
* Constructor
*/
RenderStatus()
- : needsUpdate( false ),
- needsPostRender( false )
+ : needsUpdate(false),
+ needsPostRender(false)
{
}
* Set whether update needs to run following a render.
* @param[in] updateRequired Set to true if an update is required to be run
*/
- void SetNeedsUpdate( bool updateRequired )
+ void SetNeedsUpdate(bool updateRequired)
{
needsUpdate = updateRequired;
}
* If nothing is rendered this frame, we can skip post-render.
* @param[in] postRenderRequired Set to True if post-render is required to be run
*/
- void SetNeedsPostRender( bool postRenderRequired )
+ void SetNeedsPostRender(bool postRenderRequired)
{
needsPostRender = postRenderRequired;
}
}
private:
-
- bool needsUpdate :1; ///< True if update is required to be run
- bool needsPostRender :1; ///< True if post-render is required to be run.
+ bool needsUpdate : 1; ///< True if update is required to be run
+ bool needsPostRender : 1; ///< True if post-render is required to be run.
};
-
/**
* Integration::Core is used for integration with the native windowing system.
* The following integration tasks must be completed:
class DALI_CORE_API Core
{
public:
-
/**
* Create a new Core.
* This object is used for integration with the native windowing system.
* @param[in] partialUpdateAvailable Whether the partial update is available
* @return A newly allocated Core.
*/
- static Core* New( RenderController& renderController,
- PlatformAbstraction& platformAbstraction,
- GlAbstraction& glAbstraction,
- GlSyncAbstraction& glSyncAbstraction,
- GlContextHelperAbstraction& glContextHelperAbstraction,
- RenderToFrameBuffer renderToFboEnabled,
- DepthBufferAvailable depthBufferAvailable,
- StencilBufferAvailable stencilBufferAvailable,
- PartialUpdateAvailable partialUpdateAvailable);
+ static Core* New(RenderController& renderController,
+ PlatformAbstraction& platformAbstraction,
+ GlAbstraction& glAbstraction,
+ GlSyncAbstraction& glSyncAbstraction,
+ GlContextHelperAbstraction& glContextHelperAbstraction,
+ RenderToFrameBuffer renderToFboEnabled,
+ DepthBufferAvailable depthBufferAvailable,
+ StencilBufferAvailable stencilBufferAvailable,
+ PartialUpdateAvailable partialUpdateAvailable);
/**
* Non-virtual destructor. Core is not intended as a base class.
* @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
* @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
*/
- void Update( float elapsedSeconds,
- uint32_t lastVSyncTimeMilliseconds,
- uint32_t nextVSyncTimeMilliseconds,
- UpdateStatus& status,
- bool renderToFboEnabled,
- bool isRenderingToFbo );
+ void Update(float elapsedSeconds,
+ uint32_t lastVSyncTimeMilliseconds,
+ uint32_t nextVSyncTimeMilliseconds,
+ UpdateStatus& status,
+ bool renderToFboEnabled,
+ bool isRenderingToFbo);
/**
* This is called before rendering any scene in the next frame. This method should be preceded
* @param[in] forceClear force the Clear on the framebuffer even if nothing is rendered.
* @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
*/
- void PreRender( RenderStatus& status, bool forceClear, bool uploadOnly );
+ void PreRender(RenderStatus& status, bool forceClear, bool uploadOnly);
/**
* This is called before rendering any scene in the next frame. This method should be preceded
* @param[in] scene The scene to be rendered.
* @param[out] damagedRects containing damaged render items rects for this pass.
*/
- void PreRender( Integration::Scene& scene, std::vector<Rect<int>>& damagedRects );
+ void PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects);
/**
* Render a scene in the next frame. This method should be preceded by a call up PreRender.
* @param[in] scene The scene to be rendered.
* @param[in] renderToFbo True to render off-screen frame buffers only if any, and False to render the surface only.
*/
- void RenderScene( RenderStatus& status, Integration::Scene& scene, bool renderToFbo );
+ void RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo);
/**
* Render a scene in the next frame. This method should be preceded by a call up PreRender.
* @param[in] renderToFbo True to render off-screen frame buffers only if any, and False to render the surface only.
* @param[in] clippingRect The rect to clip rendered scene.
*/
- void RenderScene( RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect );
+ void RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect);
/**
* This is called after rendering all the scenes in the next frame. This method should be
* @pre The GL context must have been created, and made current.
* @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
*/
- void PostRender( bool uploadOnly );
+ void PostRender(bool uploadOnly);
/**
* @brief Register a processor
* Note, Core does not take ownership of this processor.
* @param[in] processor The process to register
*/
- void RegisterProcessor( Processor& processor );
+ void RegisterProcessor(Processor& processor);
/**
* @brief Unregister a processor
* @param[in] processor The process to unregister
*/
- void UnregisterProcessor( Processor& processor );
+ void UnregisterProcessor(Processor& processor);
/**
* @brief Gets the Object registry.
ObjectRegistry GetObjectRegistry() const;
private:
-
/**
* Private constructor; see also Core::New()
*/
Core& operator=(const Core& rhs);
private:
-
Internal::Core* mImpl;
-
};
} // namespace Integration
#include <dali/integration-api/debug.h>
// EXTERNAL INCLUDES
-#include <cstdio>
#include <cstdarg>
-#include <cstring>
+#include <cstdio>
#include <cstdlib>
-#include <sstream>
-#include <iomanip>
+#include <cstring>
#include <ctime>
+#include <iomanip>
+#include <sstream>
// INTERNAL INCLUDES
+#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/public-api/common/constants.h>
-#include <dali/public-api/math/matrix3.h>
#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/matrix3.h>
+#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/quaternion.h>
-#include <dali/internal/event/common/thread-local-storage.h>
namespace Dali
{
-
#ifdef DEBUG_ENABLED
// Fake globals for gdb typedefs
#endif
-
namespace // unnamed namespace
{
-
const uint64_t NANOSECONDS_PER_SECOND = 1e+9;
}
namespace Integration
{
-
namespace Log
{
-
thread_local LogFunction gthreadLocalLogFunction = nullptr;
/* Forward declarations */
-std::string FormatToString(const char *format, ...);
-std::string ArgListToString(const char *format, va_list args);
+std::string FormatToString(const char* format, ...);
+std::string ArgListToString(const char* format, va_list args);
void LogMessage(DebugPriority priority, const char* format, ...)
{
- if ( !gthreadLocalLogFunction )
+ if(!gthreadLocalLogFunction)
{
return;
}
std::string message = ArgListToString(format, arg);
va_end(arg);
- gthreadLocalLogFunction(priority,message);
+ gthreadLocalLogFunction(priority, message);
}
void InstallLogFunction(const LogFunction& logFunction)
return activeFilters;
}
-Filter* Filter::New( LogLevel level, bool trace, const char * environmentVariableName )
+Filter* Filter::New(LogLevel level, bool trace, const char* environmentVariableName)
{
- char * environmentVariableValue = getenv( environmentVariableName );
- if ( environmentVariableValue )
+ char* environmentVariableValue = getenv(environmentVariableName);
+ if(environmentVariableValue)
{
unsigned int envLevel(0);
- char envTraceString(0);
- sscanf( environmentVariableValue, "%u,%c", &envLevel, &envTraceString );
+ char envTraceString(0);
+ sscanf(environmentVariableValue, "%u,%c", &envLevel, &envTraceString);
- if ( envLevel > Verbose )
+ if(envLevel > Verbose)
{
envLevel = Verbose;
}
- level = LogLevel( envLevel );
+ level = LogLevel(envLevel);
// Just use 'f' and 't' as it's faster than doing full string comparisons
- if ( envTraceString == 't' )
+ if(envTraceString == 't')
{
trace = true;
}
- else if ( envTraceString == 'f' )
+ else if(envTraceString == 'f')
{
trace = false;
}
}
}
-void Filter::SetGlobalLogLevel( LogLevel level )
+void Filter::SetGlobalLogLevel(LogLevel level)
{
for(FilterIter iter = GetActiveFilters()->begin(); iter != GetActiveFilters()->end(); iter++)
{
- (*iter)->SetLogLevel( level );
+ (*iter)->SetLogLevel(level);
}
}
va_list arg;
va_start(arg, format);
- if( mTraceEnabled )
+ if(mTraceEnabled)
{
- char *buffer = nullptr;
- int numChars = asprintf( &buffer, " %-*c %s", mNesting, ':', format );
- if( numChars >= 0 ) // No error
+ char* buffer = nullptr;
+ int numChars = asprintf(&buffer, " %-*c %s", mNesting, ':', format);
+ if(numChars >= 0) // No error
{
- std::string message = ArgListToString( buffer, arg );
- LogMessage( DebugInfo, message.c_str() );
- free( buffer );
+ std::string message = ArgListToString(buffer, arg);
+ LogMessage(DebugInfo, message.c_str());
+ free(buffer);
}
}
else
{
- std::string message = ArgListToString( format, arg );
- LogMessage( DebugInfo, message.c_str() );
+ std::string message = ArgListToString(format, arg);
+ LogMessage(DebugInfo, message.c_str());
}
va_end(arg);
}
}
-
-TraceObj::TraceObj(Filter* filter, const char*format, ...) : mFilter(filter)
+TraceObj::TraceObj(Filter* filter, const char* format, ...)
+: mFilter(filter)
{
if(mFilter && mFilter->IsTraceEnabled())
{
{
if(mFilter && mFilter->IsTraceEnabled())
{
- if (mFilter->mNesting)
+ if(mFilter->mNesting)
{
--mFilter->mNesting;
}
#endif // DEBUG_ENABLED
-std::string ArgListToString(const char *format, va_list args)
+std::string ArgListToString(const char* format, va_list args)
{
std::string str; // empty string
if(format != nullptr)
{
char* buffer = nullptr;
- int err = vasprintf(&buffer, format, args);
+ int err = vasprintf(&buffer, format, args);
if(err >= 0) // No error
{
str = buffer;
return str;
}
-std::string FormatToString(const char *format, ...)
+std::string FormatToString(const char* format, ...)
{
va_list arg;
va_start(arg, format);
return s;
}
-void GetNanoseconds( uint64_t& timeInNanoseconds )
+void GetNanoseconds(uint64_t& timeInNanoseconds)
{
timespec timeSpec;
- clock_gettime( CLOCK_MONOTONIC, &timeSpec );
+ clock_gettime(CLOCK_MONOTONIC, &timeSpec);
// Convert all values to uint64_t to match our return type
- timeInNanoseconds = ( static_cast< uint64_t >( timeSpec.tv_sec ) * NANOSECONDS_PER_SECOND ) + static_cast< uint64_t >( timeSpec.tv_nsec );
+ timeInNanoseconds = (static_cast<uint64_t>(timeSpec.tv_sec) * NANOSECONDS_PER_SECOND) + static_cast<uint64_t>(timeSpec.tv_nsec);
}
} // namespace Log
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <sstream>
+#include <stdint.h>
#include <iostream>
#include <list>
-#include <stdint.h>
+#include <sstream>
+#include <string>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/common/dali-common.h>
// Using Debug namespace alias shortens the log usage significantly
-namespace Dali{namespace Integration{namespace Log{}}}
+namespace Dali
+{
+namespace Integration
+{
+namespace Log
+{
+}
+} // namespace Integration
+} // namespace Dali
namespace Debug = Dali::Integration::Log;
namespace Dali
{
-
struct Vector2;
struct Vector3;
struct Vector4;
{
namespace Log
{
-
enum DebugPriority
{
DebugInfo,
* @param level debug level
* @param format string format
*/
-DALI_CORE_API void LogMessage(enum DebugPriority level,const char *format, ...);
+DALI_CORE_API void LogMessage(enum DebugPriority level, const char* format, ...);
/**
* typedef for the logging function.
*/
-using LogFunction = void ( * )( DebugPriority, std::string & );
+using LogFunction = void (*)(DebugPriority, std::string&);
/**
* A log function has to be installed for every thread that wants to use logging.
/**
* Provides unfiltered logging for global error level messages
*/
-#define DALI_LOG_ERROR(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, "%s " format, __FUNCTION__, ## __VA_ARGS__)
+#define DALI_LOG_ERROR(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, "%s " format, __FUNCTION__, ##__VA_ARGS__)
-#define DALI_LOG_ERROR_NOFN(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, format, ## __VA_ARGS__)
+#define DALI_LOG_ERROR_NOFN(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, format, ##__VA_ARGS__)
-#define DALI_LOG_WARNING_NOFN(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, format, ## __VA_ARGS__)
+#define DALI_LOG_WARNING_NOFN(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, format, ##__VA_ARGS__)
/**
* Provides unfiltered logging for fps monitor
*/
-#define DALI_LOG_FPS(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## __VA_ARGS__)
+#define DALI_LOG_FPS(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ##__VA_ARGS__)
/**
* Provides unfiltered logging for update status
*/
-#define DALI_LOG_UPDATE_STATUS(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## __VA_ARGS__)
+#define DALI_LOG_UPDATE_STATUS(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ##__VA_ARGS__)
/**
* Provides unfiltered logging for render information
*/
-#define DALI_LOG_RENDER_INFO(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## __VA_ARGS__)
+#define DALI_LOG_RENDER_INFO(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ##__VA_ARGS__)
/**
* Provides unfiltered logging for release
*/
-#define DALI_LOG_RELEASE_INFO(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## __VA_ARGS__)
+#define DALI_LOG_RELEASE_INFO(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ##__VA_ARGS__)
#ifdef DEBUG_ENABLED
/**
* Provides unfiltered logging for global warning level messages
*/
-#define DALI_LOG_WARNING(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, "%s " format, ASSERT_LOCATION, ## __VA_ARGS__)
-
+#define DALI_LOG_WARNING(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, "%s " format, ASSERT_LOCATION, ##__VA_ARGS__)
#else // DEBUG_ENABLED
*/
enum LogLevel
{
- NoLogging = 0,
- Concise = 1,
- General = 2,
- Verbose = 3
+ NoLogging = 0,
+ Concise = 1,
+ General = 2,
+ Verbose = 3
};
-
/**
* The Filter object is used by the DALI_LOG_INFO macro and others to determine if the logging
* should take place, and routes the logging via the platform abstraction's LogMessage.
class DALI_CORE_API Filter
{
public:
- using FilterList = std::list<Filter *>;
- using FilterIter = std::list<Filter *>::iterator;
+ using FilterList = std::list<Filter*>;
+ using FilterIter = std::list<Filter*>::iterator;
public:
-
/**
* Test if the filter is enabled for the given logging level
* @param[in] level - the level to test.
* @return true if this level of logging is enabled.
*/
- bool IsEnabledFor(LogLevel level) { return level != Debug::NoLogging && level <= mLoggingLevel;}
+ bool IsEnabledFor(LogLevel level)
+ {
+ return level != Debug::NoLogging && level <= mLoggingLevel;
+ }
/**
* Test if trace is enabled for this filter.
* @return true if trace is enabled;
*/
- bool IsTraceEnabled() { return mTraceEnabled; }
+ bool IsTraceEnabled()
+ {
+ return mTraceEnabled;
+ }
/**
* Enable tracing on this filter.
*/
- void EnableTrace() { mTraceEnabled = true; }
+ void EnableTrace()
+ {
+ mTraceEnabled = true;
+ }
/**
* Disable tracing on this filter.
*/
- void DisableTrace() { mTraceEnabled = false; }
+ void DisableTrace()
+ {
+ mTraceEnabled = false;
+ }
/**
* Set the log level for this filter. Setting to a higher value than Debug::General also
* enables General;
*/
- void SetLogLevel(LogLevel level) { mLoggingLevel = level; }
+ void SetLogLevel(LogLevel level)
+ {
+ mLoggingLevel = level;
+ }
/**
* Perform the logging for this filter.
* FILTER_ENV=0,true dali-demo // LogLevel NoLogging, Trace ON
* @endcode
*/
- static Filter* New(LogLevel level, bool trace, const char * environmentVariableName );
+ static Filter* New(LogLevel level, bool trace, const char* environmentVariableName);
/**
* Enable trace on all filters.
*
* @param[in] level The log level
*/
- static void SetGlobalLogLevel( LogLevel level );
+ static void SetGlobalLogLevel(LogLevel level);
private:
-
/**
* Constructor.
* @param[in] level - the highest log level.
* @param[in] trace - whether this filter allows tracing.
*/
- Filter(LogLevel level, bool trace) : mLoggingLevel(level), mTraceEnabled(trace), mNesting(0) {}
+ Filter(LogLevel level, bool trace)
+ : mLoggingLevel(level),
+ mTraceEnabled(trace),
+ mNesting(0)
+ {
+ }
static FilterList* GetActiveFilters();
// you can add a filter to your own class or source file. If you do, use Filter::New()
// to tell this class about it.
- static Filter *gRender;
- static Filter *gResource;
- static Filter *gGLResource;
- static Filter *gObject;
- static Filter *gImage;
- static Filter *gModel;
- static Filter *gNode;
- static Filter *gElement;
- static Filter *gActor;
- static Filter *gShader;
+ static Filter* gRender;
+ static Filter* gResource;
+ static Filter* gGLResource;
+ static Filter* gObject;
+ static Filter* gImage;
+ static Filter* gModel;
+ static Filter* gNode;
+ static Filter* gElement;
+ static Filter* gActor;
+ static Filter* gShader;
private:
LogLevel mLoggingLevel;
bool mTraceEnabled;
-public:
- int mNesting;
+public:
+ int mNesting;
};
-
-#define DALI_LOG_FILTER_SET_LEVEL(filter, level) filter->SetLogLevel(level)
-#define DALI_LOG_FILTER_ENABLE_TRACE(filter) filter->EnableTrace()
-#define DALI_LOG_FILTER_DISABLE_TRACE(filter) filter->DisableTrace()
+#define DALI_LOG_FILTER_SET_LEVEL(filter, level) filter->SetLogLevel(level)
+#define DALI_LOG_FILTER_ENABLE_TRACE(filter) filter->EnableTrace()
+#define DALI_LOG_FILTER_DISABLE_TRACE(filter) filter->DisableTrace()
#else
-#define DALI_LOG_FILTER_SET_LEVEL(filter, level)
-#define DALI_LOG_FILTER_ENABLE_TRACE(filter)
-#define DALI_LOG_FILTER_DISABLE_TRACE(filter)
+#define DALI_LOG_FILTER_SET_LEVEL(filter, level)
+#define DALI_LOG_FILTER_ENABLE_TRACE(filter)
+#define DALI_LOG_FILTER_DISABLE_TRACE(filter)
#endif
#ifdef DEBUG_ENABLED
-#define DALI_LOG_INFO(filter, level, format, ...) \
- if(filter && filter->IsEnabledFor(level)) { filter->Log(level, format, ## __VA_ARGS__); }
-
-#define DALI_LOG_STREAM( filter, level, stream ) \
+#define DALI_LOG_INFO(filter, level, format, ...) \
if(filter && filter->IsEnabledFor(level)) \
{ \
- std::ostringstream o; \
- o << stream << std::endl; \
- filter->Log(level, "%s", o.str().c_str()); \
+ filter->Log(level, format, ##__VA_ARGS__); \
+ }
+
+#define DALI_LOG_STREAM(filter, level, stream) \
+ if(filter && filter->IsEnabledFor(level)) \
+ { \
+ std::ostringstream o; \
+ o << stream << std::endl; \
+ filter->Log(level, "%s", o.str().c_str()); \
}
#else // DEBUG_ENABLED
#define DALI_LOG_INFO(filter, level, format, ...)
-#define DALI_LOG_STREAM( filter, level, stream )
+#define DALI_LOG_STREAM(filter, level, stream)
#endif // DEBUG_ENABLED
-
/********************************************************************************
* Trace Macros *
********************************************************************************/
public:
std::string mMessage;
- Filter* mFilter;
+ Filter* mFilter;
};
+#define DALI_LOG_TRACE_METHOD_FMT(filter, format, ...) \
+ Dali::Integration::Log::TraceObj debugTraceObj(filter, "%s: " format, ASSERT_LOCATION, ##__VA_ARGS__)
-#define DALI_LOG_TRACE_METHOD_FMT(filter, format, ...) \
- Dali::Integration::Log::TraceObj debugTraceObj(filter, "%s: " format, ASSERT_LOCATION, ## __VA_ARGS__)
-
-#define DALI_LOG_TRACE_METHOD(filter) \
+#define DALI_LOG_TRACE_METHOD(filter) \
Dali::Integration::Log::TraceObj debugTraceObj(filter, ASSERT_LOCATION)
-
#else // DEBUG_ENABLED
#define DALI_LOG_TRACE_METHOD_FMT(filter, format, ...)
#define DALI_LOG_TRACE_METHOD(filter)
-
#endif
/********************************************************************************
* Warning - this will increase the size of the object for a debug build.
*/
#define DALI_LOG_OBJECT_STRING_DECLARATION \
-public: \
+public: \
std::string mDebugString;
/**
* Print all the actor tree names
**/
-#define DALI_LOG_ACTOR_TREE( node ) { \
- std::stringstream branch; \
- Node* tempNode = node; \
- while( tempNode ) { \
- branch << "<" << tempNode->mDebugString << ">::"; \
- tempNode = tempNode->GetParent(); \
- } \
- DALI_LOG_ERROR_NOFN("Actor tree: %s\n", branch.str().c_str()); \
-}
+#define DALI_LOG_ACTOR_TREE(node) \
+ { \
+ std::stringstream branch; \
+ Node* tempNode = node; \
+ while(tempNode) \
+ { \
+ branch << "<" << tempNode->mDebugString << ">::"; \
+ tempNode = tempNode->GetParent(); \
+ } \
+ DALI_LOG_ERROR_NOFN("Actor tree: %s\n", branch.str().c_str()); \
+ }
/**
* Allows one object to set another object's debug string
/**
* Allows one object to set another object's std::string easily
*/
-#define DALI_LOG_FMT_OBJECT_STRING(object, fmt, ...) (object->mDebugString = FormatToString(fmt, ## __VA_ARGS__))
+#define DALI_LOG_FMT_OBJECT_STRING(object, fmt, ...) (object->mDebugString = FormatToString(fmt, ##__VA_ARGS__))
/**
* Allows one object to get another object's debug string
/**
* Filtered logging of the object's debug string
*/
-#define DALI_LOG_OBJECT(filter, object) DALI_LOG_INFO(filter, Debug::General, object->mDebugString)
-
+#define DALI_LOG_OBJECT(filter, object) DALI_LOG_INFO(filter, Debug::General, object->mDebugString)
#else // DEBUG_ENABLED
#if defined(DEBUG_ENABLED)
-void GetNanoseconds( uint64_t& timeInNanoseconds );
+void GetNanoseconds(uint64_t& timeInNanoseconds);
-#define DALI_LOG_TIMER_START( timeVariable ) \
- uint64_t timeVariable##1; \
- Debug::GetNanoseconds( timeVariable##1 );
+#define DALI_LOG_TIMER_START(timeVariable) \
+ uint64_t timeVariable##1; \
+ Debug::GetNanoseconds(timeVariable##1);
-#define DALI_LOG_TIMER_END( timeVariable, filter, level, preString) \
- uint64_t timeVariable##2; \
- Debug::GetNanoseconds( timeVariable##2 ); \
- DALI_LOG_INFO( filter, level, preString " %ld uSec\n", ((timeVariable##2-timeVariable##1)/1000));
+#define DALI_LOG_TIMER_END(timeVariable, filter, level, preString) \
+ uint64_t timeVariable##2; \
+ Debug::GetNanoseconds(timeVariable##2); \
+ DALI_LOG_INFO(filter, level, preString " %ld uSec\n", ((timeVariable##2 - timeVariable##1) / 1000));
#else // DEBUG_ENABLED
-#define DALI_LOG_TIMER_START( timeVariable )
-#define DALI_LOG_TIMER_END( timeVariable, filter, level, preString)
+#define DALI_LOG_TIMER_START(timeVariable)
+#define DALI_LOG_TIMER_END(timeVariable, filter, level, preString)
#endif
-} // Debug
-} // Integration
-} // Dali
-
+} // namespace Log
+} // namespace Integration
+} // namespace Dali
#endif // DALI_INTEGRATION_DEBUG_H
namespace Dali
{
-
namespace Integration
{
-
Event::~Event()
{
}
#define DALI_INTEGRATION_EVENT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
/**
* Base structure for events passed to Dali::Integration::Core::QueueEvent()
* An instance of this class cannot be created.
enum Type
{
- Touch, ///< A touch event, when the user interacts with the screen.
- Key, ///< A key pressed event, from the virtual or external keyboard.
- Wheel, ///< A wheel event, when the wheel is being rolled from an external mouse.
- Hover ///< A hover event, when the user hovers above the screen.
+ Touch, ///< A touch event, when the user interacts with the screen.
+ Key, ///< A key pressed event, from the virtual or external keyboard.
+ Wheel, ///< A wheel event, when the wheel is being rolled from an external mouse.
+ Hover ///< A hover event, when the user hovers above the screen.
};
// Data
Type type;
protected: // Constructors only to be used by derived structures.
-
/**
* This constructor is only used by derived classes.
* @param[in] eventType The type of event.
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
HoverEvent::HoverEvent()
-: MultiPointEvent( Hover )
+: MultiPointEvent(Hover)
{
}
-HoverEvent::HoverEvent( uint32_t time )
-: MultiPointEvent( Hover, time )
+HoverEvent::HoverEvent(uint32_t time)
+: MultiPointEvent(Hover, time)
{
}
#define DALI_INTEGRATION_HOVER_EVENT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/events/hover-event.h>
#include <dali/integration-api/events/multi-point-event-integ.h>
+#include <dali/public-api/events/hover-event.h>
namespace Dali
{
-
namespace Integration
{
-
/**
* An instance of this structure should be used by the adaptor to send a hover event to Dali core.
*
namespace Dali
{
-
namespace Integration
{
-
KeyEvent::KeyEvent()
-: Event( Key ),
+: Event(Key),
keyName(),
logicalKey(),
keyString(),
- keyCode( -1 ),
- keyModifier( 0 ),
- time( 0 ),
- state( KeyEvent::DOWN ),
- compose( "" ),
- deviceName( "" ),
- deviceClass( Device::Class::NONE ),
- deviceSubclass( Device::Subclass::NONE )
+ keyCode(-1),
+ keyModifier(0),
+ time(0),
+ state(KeyEvent::DOWN),
+ compose(""),
+ deviceName(""),
+ deviceClass(Device::Class::NONE),
+ deviceSubclass(Device::Subclass::NONE)
{
}
-KeyEvent::KeyEvent( const std::string& keyName, const std::string& logicalKey, const std::string& keyString, int keyCode, int keyModifier,
- unsigned long timeStamp, const State& keyState, const std::string& compose, const std::string& deviceName,
- const Device::Class::Type deviceClass, const Device::Subclass::Type deviceSubclass )
-: Event( Key ),
- keyName( keyName ),
- logicalKey( logicalKey ),
- keyString( keyString ),
- keyCode( keyCode ),
- keyModifier( keyModifier ),
- time( timeStamp ),
- state( keyState ),
- compose( compose ),
- deviceName( deviceName ),
- deviceClass( deviceClass ),
- deviceSubclass( deviceSubclass )
+KeyEvent::KeyEvent(const std::string& keyName,
+ const std::string& logicalKey,
+ const std::string& keyString,
+ int keyCode,
+ int keyModifier,
+ unsigned long timeStamp,
+ const State& keyState,
+ const std::string& compose,
+ const std::string& deviceName,
+ const Device::Class::Type deviceClass,
+ const Device::Subclass::Type deviceSubclass)
+: Event(Key),
+ keyName(keyName),
+ logicalKey(logicalKey),
+ keyString(keyString),
+ keyCode(keyCode),
+ keyModifier(keyModifier),
+ time(timeStamp),
+ state(keyState),
+ compose(compose),
+ deviceName(deviceName),
+ deviceClass(deviceClass),
+ deviceSubclass(deviceSubclass)
{
}
namespace Dali
{
-
namespace Integration
{
-
/**
* An instance of this class should be used by the adaptor to send a key event to
* the Dali core.
// Specifies the state of the key event.
enum State
{
- DOWN, /**< Key down */
- UP, /**< Key up */
+ DOWN, /**< Key down */
+ UP, /**< Key up */
};
/**
* @param[in] deviceClass The class of device KeyEvent originated from
* @param[in] deviceSubclass The subclass of device KeyEvent originated from
*/
- KeyEvent(const std::string& keyName,
- const std::string& logicalKey,
- const std::string& keyString,
- int keyCode,
- int keyModifier,
- unsigned long timeStamp,
- const State& keyState,
- const std::string& compose,
- const std::string& deviceName,
- const Device::Class::Type deviceClass,
- const Device::Subclass::Type deviceSubclass );
+ KeyEvent(const std::string& keyName,
+ const std::string& logicalKey,
+ const std::string& keyString,
+ int keyCode,
+ int keyModifier,
+ unsigned long timeStamp,
+ const State& keyState,
+ const std::string& compose,
+ const std::string& deviceName,
+ const Device::Class::Type deviceClass,
+ const Device::Subclass::Type deviceSubclass);
/**
* Virtual destructor
/**
* The unique key code for the key pressed.
*/
- int keyCode;
+ int keyCode;
/**
* The key modifier for special keys like shift and alt
*/
- int keyModifier;
+ int keyModifier;
/**
* The time (in ms) that the key event occurred.
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
-MultiPointEvent::MultiPointEvent( Type eventType )
-: Event( eventType ),
- time( 0 )
+MultiPointEvent::MultiPointEvent(Type eventType)
+: Event(eventType),
+ time(0)
{
}
-MultiPointEvent::MultiPointEvent( Type eventType, uint32_t time )
-: Event( eventType ),
- time( time )
+MultiPointEvent::MultiPointEvent(Type eventType, uint32_t time)
+: Event(eventType),
+ time(time)
{
}
{
}
-void MultiPointEvent::AddPoint( const Point& point )
+void MultiPointEvent::AddPoint(const Point& point)
{
points.push_back(point);
}
-Point& MultiPointEvent::GetPoint( uint32_t point )
+Point& MultiPointEvent::GetPoint(uint32_t point)
{
DALI_ASSERT_ALWAYS(point < points.size() && "MultiPointEvent: Point index out of bounds");
return points[point];
}
-const Point& MultiPointEvent::GetPoint( uint32_t point ) const
+const Point& MultiPointEvent::GetPoint(uint32_t point) const
{
DALI_ASSERT_ALWAYS(point < points.size() && "MultiPointEvent: Point index out of bounds");
return points[point];
uint32_t MultiPointEvent::GetPointCount() const
{
- return static_cast<uint32_t>( points.size() ); // not going to overflow in practice
+ return static_cast<uint32_t>(points.size()); // not going to overflow in practice
}
} // namespace Integration
#define DALI_INTEGRATION_MULTI_POINT_EVENT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/integration-api/events/event.h>
#include <dali/integration-api/events/point.h>
+#include <dali/public-api/common/vector-wrapper.h>
namespace Dali
{
-
namespace Integration
{
using PointContainer = std::vector<Point>; ///< Container of points
MultiPointEvent(Type eventType, uint32_t time);
public:
-
// Data
/**
* @brief Adds a point to the MultiPointEvent.
* @param[in] point The point to add.
*/
- void AddPoint( const Point& point );
+ void AddPoint(const Point& point);
/**
* @brief Retrieves the Point at position point.
* @return The Point at position point.
*/
- Point& GetPoint( uint32_t point );
+ Point& GetPoint(uint32_t point);
/**
* @brief Retrieves a const ref of the Point at position point.
* @return The const ref of the Point at position point.
*/
- const Point& GetPoint( uint32_t point ) const;
+ const Point& GetPoint(uint32_t point) const;
/**
* @brief The total number of Points in this TouchEvent.
namespace Dali
{
-
namespace Integration
{
-
Point::Point()
-: mTouchPoint( 0, PointState::STARTED, 0.0f, 0.0f ),
+: mTouchPoint(0, PointState::STARTED, 0.0f, 0.0f),
mEllipseRadius(),
- mAngle( 0.0f ),
- mDeviceClass( Device::Class::NONE ),
- mDeviceSubclass( Device::Subclass::NONE ),
- mPressure( 1.0f ),
- mRadius( 0.0f ),
- mMouseButton( MouseButton::INVALID )
+ mAngle(0.0f),
+ mDeviceClass(Device::Class::NONE),
+ mDeviceSubclass(Device::Subclass::NONE),
+ mPressure(1.0f),
+ mRadius(0.0f),
+ mMouseButton(MouseButton::INVALID)
{
}
-Point::Point( const TouchPoint& touchPoint )
-: mTouchPoint( touchPoint ),
+Point::Point(const TouchPoint& touchPoint)
+: mTouchPoint(touchPoint),
mEllipseRadius(),
- mAngle( 0.0f ),
- mDeviceClass( Device::Class::NONE ),
- mDeviceSubclass( Device::Subclass::NONE ),
- mPressure( 1.0f ),
- mRadius( 0.0f ),
- mMouseButton( MouseButton::INVALID )
+ mAngle(0.0f),
+ mDeviceClass(Device::Class::NONE),
+ mDeviceSubclass(Device::Subclass::NONE),
+ mPressure(1.0f),
+ mRadius(0.0f),
+ mMouseButton(MouseButton::INVALID)
{
}
{
}
-void Point::SetDeviceId( int32_t deviceId )
+void Point::SetDeviceId(int32_t deviceId)
{
mTouchPoint.deviceId = deviceId;
}
-void Point::SetState( PointState::Type state )
+void Point::SetState(PointState::Type state)
{
- mTouchPoint.state = static_cast< PointState::Type >( state );
+ mTouchPoint.state = static_cast<PointState::Type>(state);
}
-void Point::SetScreenPosition( const Vector2& screenPosition )
+void Point::SetScreenPosition(const Vector2& screenPosition)
{
mTouchPoint.screen = screenPosition;
}
-void Point::SetRadius( float radius )
+void Point::SetRadius(float radius)
{
mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
}
-void Point::SetRadius( float radius, Vector2 ellipseRadius )
+void Point::SetRadius(float radius, Vector2 ellipseRadius)
{
- mRadius = radius;
+ mRadius = radius;
mEllipseRadius = ellipseRadius;
}
-void Point::SetPressure( float pressure )
+void Point::SetPressure(float pressure)
{
mPressure = pressure;
}
-void Point::SetAngle( Degree angle )
+void Point::SetAngle(Degree angle)
{
mAngle = angle;
}
PointState::Type Point::GetState() const
{
- return static_cast< PointState::Type >( mTouchPoint.state );
+ return static_cast<PointState::Type>(mTouchPoint.state);
}
const Vector2& Point::GetScreenPosition() const
return mAngle;
}
-void Point::SetHitActor( Actor hitActor )
+void Point::SetHitActor(Actor hitActor)
{
mTouchPoint.hitActor = hitActor;
}
-void Point::SetLocalPosition( const Vector2& localPosition )
+void Point::SetLocalPosition(const Vector2& localPosition)
{
mTouchPoint.local = localPosition;
}
return mTouchPoint;
}
-void Point::SetDeviceClass( Device::Class::Type deviceClass )
+void Point::SetDeviceClass(Device::Class::Type deviceClass)
{
mDeviceClass = deviceClass;
}
-void Point::SetDeviceSubclass( Device::Subclass::Type deviceSubclass )
+void Point::SetDeviceSubclass(Device::Subclass::Type deviceSubclass)
{
mDeviceSubclass = deviceSubclass;
}
mMouseButton = button;
}
-
} // namespace Integration
} // namespace Dali
*/
// INTERNAL INCLUDES
-#include <dali/public-api/events/point-state.h>
-#include <dali/public-api/math/degree.h>
-#include <dali/public-api/math/vector2.h>
#include <dali/devel-api/events/touch-point.h>
#include <dali/public-api/events/device.h>
#include <dali/public-api/events/mouse-button.h>
+#include <dali/public-api/events/point-state.h>
+#include <dali/public-api/math/degree.h>
+#include <dali/public-api/math/vector2.h>
namespace Dali
{
-
namespace Integration
{
-
/**
* @brief A Point represents a point on the screen that is currently being touched or where touch has stopped.
*/
* @brief Constructor which creates a Point instance from a TouchPoint.
* @param[in] touchPoint The touch-point to copy from.
*/
- explicit Point( const TouchPoint& touchPoint );
+ explicit Point(const TouchPoint& touchPoint);
/**
* @brief Destructor
*
* @param[in] deviceId The Unique Device ID.
*/
- void SetDeviceId( int32_t deviceId );
+ void SetDeviceId(int32_t deviceId);
/**
* @brief Set the state of the point.
* @param[in] state The state of the point.
*/
- void SetState( PointState::Type state );
+ void SetState(PointState::Type state);
/**
* @brief Set the screen position of the point from the top-left of the screen.
* @param[in] screenPosition The screen position of the point from the top-left of the screen.
*/
- void SetScreenPosition( const Vector2& screenPosition );
+ void SetScreenPosition(const Vector2& screenPosition);
/**
* @brief Set the radius of the press point.
* This is the average of both the horizontal and vertical radii of the press point.
* @param[in] radius The average of both the horizontal and vertical radii.
*/
- void SetRadius( float radius );
+ void SetRadius(float radius);
/**
* @brief Set the radius of the press point as an ellipse.
* @param[in] radius The average of both the horizontal and vertical radii.
* @param[in] ellipseRadius The horizontal and vertical radii of the press point (different if an ellipse).
*/
- void SetRadius( float radius, Vector2 ellipseRadius );
+ void SetRadius(float radius, Vector2 ellipseRadius);
/**
* @brief Sets the touch pressure.
*
* @param[in] pressure The touch pressure.
*/
- void SetPressure( float pressure );
+ void SetPressure(float pressure);
/**
* @brief Sets the angle of the press point relative to the Y-Axis.
* @param[in] angle The angle of the press point relative to the Y-Axis.
*/
- void SetAngle( Degree angle );
+ void SetAngle(Degree angle);
/**
* @brief Sets the class of the device for the event
* @param[in] deviceClass The class of the device.
*/
- void SetDeviceClass( Device::Class::Type deviceClass );
+ void SetDeviceClass(Device::Class::Type deviceClass);
/**
* @brief Sets the subclass of the device for the event
* @param[in] deviceSubclass The subclass of the device.
*/
- void SetDeviceSubclass( Device::Subclass::Type deviceSubclass );
+ void SetDeviceSubclass(Device::Subclass::Type deviceSubclass);
/**
* @brief Retrieve the Unique Device ID of the point.
*/
void SetMouseButton(MouseButton::Type button);
-
public: // Not intended for Integration API developers
-
/**
* @brief Sets the hit actor under this point.
* @param[in] hitActor The hit actor.
*/
- DALI_INTERNAL void SetHitActor( Actor hitActor );
+ DALI_INTERNAL void SetHitActor(Actor hitActor);
/**
* @brief Set the co-ordinates relative to the top-left of the hit-actor.
* @param[in] localPosition The local position.
* @note The top-left of an actor is (0.0, 0.0, 0.5).
*/
- DALI_INTERNAL void SetLocalPosition( const Vector2& localPosition );
+ DALI_INTERNAL void SetLocalPosition(const Vector2& localPosition);
/**
* @brief Retrieve the Hit Actor.
DALI_INTERNAL const TouchPoint& GetTouchPoint() const;
private:
-
- TouchPoint mTouchPoint; ///< Stores screen position, device Id, local & screen positions and the hit-actor. @see TouchPoint
- Vector2 mEllipseRadius; ///< Radius of both the horizontal and vertical radius (useful if an ellipse).
- Degree mAngle; ///< The angle of the press point, relative to the Y-Axis.
- Device::Class::Type mDeviceClass;
+ TouchPoint mTouchPoint; ///< Stores screen position, device Id, local & screen positions and the hit-actor. @see TouchPoint
+ Vector2 mEllipseRadius; ///< Radius of both the horizontal and vertical radius (useful if an ellipse).
+ Degree mAngle; ///< The angle of the press point, relative to the Y-Axis.
+ Device::Class::Type mDeviceClass;
Device::Subclass::Type mDeviceSubclass;
- float mPressure; ///< The touch pressure.
- float mRadius; ///< Radius of the press point, an average of the ellipse radius.
- MouseButton::Type mMouseButton; /// < mouse button value.
+ float mPressure; ///< The touch pressure.
+ float mRadius; ///< Radius of the press point, an average of the ellipse radius.
+ MouseButton::Type mMouseButton; /// < mouse button value.
};
} // namespace Integration
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <cmath> // abs<float>
// INTERNAL INCLUDES
-#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/hover-event-integ.h>
+#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
namespace Integration
{
-
namespace
{
-const unsigned long DEFAULT_MINIMUM_MOTION_TIME( 1u );
-const Vector2 DEFAULT_MINIMUM_MOTION_DISTANCE( 1.0f, 1.0f );
+const unsigned long DEFAULT_MINIMUM_MOTION_TIME(1u);
+const Vector2 DEFAULT_MINIMUM_MOTION_DISTANCE(1.0f, 1.0f);
} // unnamed namespace
struct TouchEventCombiner::PointInfo
* @param[in] touchPoint The point to add.
* @param[in] pointTime The time of the point event.
*/
- PointInfo( const Point& touchPoint, uint32_t pointTime )
- : point( touchPoint ),
- time( pointTime )
+ PointInfo(const Point& touchPoint, uint32_t pointTime)
+ : point(touchPoint),
+ time(pointTime)
{
}
// Data
- Point point; ///< The point.
- uint32_t time; ///< The time the point event took place.
+ Point point; ///< The point.
+ uint32_t time; ///< The time the point event took place.
};
TouchEventCombiner::TouchEventCombiner()
-: mMinMotionTime( DEFAULT_MINIMUM_MOTION_TIME ),
- mMinMotionDistance( DEFAULT_MINIMUM_MOTION_DISTANCE )
+: mMinMotionTime(DEFAULT_MINIMUM_MOTION_TIME),
+ mMinMotionDistance(DEFAULT_MINIMUM_MOTION_DISTANCE)
{
}
-TouchEventCombiner::TouchEventCombiner( uint32_t minMotionTime, float minMotionXDistance, float minMotionYDistance )
-: mMinMotionTime( minMotionTime ),
- mMinMotionDistance( minMotionXDistance, minMotionYDistance )
+TouchEventCombiner::TouchEventCombiner(uint32_t minMotionTime, float minMotionXDistance, float minMotionYDistance)
+: mMinMotionTime(minMotionTime),
+ mMinMotionDistance(minMotionXDistance, minMotionYDistance)
{
- DALI_ASSERT_ALWAYS( minMotionXDistance >= 0.0f && minMotionYDistance >= 0.0f && "Negative values not allowed\n" );
+ DALI_ASSERT_ALWAYS(minMotionXDistance >= 0.0f && minMotionYDistance >= 0.0f && "Negative values not allowed\n");
}
-TouchEventCombiner::TouchEventCombiner( uint32_t minMotionTime, Vector2 minMotionDistance )
-: mMinMotionTime( minMotionTime ),
- mMinMotionDistance( minMotionDistance )
+TouchEventCombiner::TouchEventCombiner(uint32_t minMotionTime, Vector2 minMotionDistance)
+: mMinMotionTime(minMotionTime),
+ mMinMotionDistance(minMotionDistance)
{
- DALI_ASSERT_ALWAYS( minMotionDistance.x >= 0.0f && minMotionDistance.y >= 0.0f && "Negative values not allowed\n" );
+ DALI_ASSERT_ALWAYS(minMotionDistance.x >= 0.0f && minMotionDistance.y >= 0.0f && "Negative values not allowed\n");
}
TouchEventCombiner::~TouchEventCombiner()
{
}
-TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent( const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent )
+TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent(const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent)
{
- TouchEventCombiner::EventDispatchType dispatchEvent( TouchEventCombiner::DISPATCH_NONE );
- const PointState::Type state = point.GetState();
- const int deviceId = point.GetDeviceId();
+ TouchEventCombiner::EventDispatchType dispatchEvent(TouchEventCombiner::DISPATCH_NONE);
+ const PointState::Type state = point.GetState();
+ const int deviceId = point.GetDeviceId();
- switch ( state )
+ switch(state)
{
case PointState::STARTED:
{
touchEvent.time = time;
- bool addToContainer( true );
+ bool addToContainer(true);
// Iterate through already stored touch points and add to TouchEvent
- for ( PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter )
+ for(PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter)
{
- if ( iter->point.GetDeviceId() != deviceId )
+ if(iter->point.GetDeviceId() != deviceId)
{
- iter->point.SetState( PointState::STATIONARY );
+ iter->point.SetState(PointState::STATIONARY);
}
else
{
// We do not want to emit another down event for this Point Device ID.
addToContainer = false;
- iter->point = point;
- iter->time = time;
+ iter->point = point;
+ iter->time = time;
}
- touchEvent.AddPoint( iter->point );
+ touchEvent.AddPoint(iter->point);
}
// Add new touch point to the list and to the TouchEvent
- if (addToContainer)
+ if(addToContainer)
{
- mPressedPoints.push_back( PointInfo( point, time ) );
- touchEvent.AddPoint( point );
+ mPressedPoints.push_back(PointInfo(point, time));
+ touchEvent.AddPoint(point);
dispatchEvent = TouchEventCombiner::DISPATCH_TOUCH; // Only dispatch touch event if just added to container
// Check whether hover event was dispatched previously
- if ( !mHoveredPoints.empty() )
+ if(!mHoveredPoints.empty())
{
hoverEvent.time = time;
- PointInfoContainer::iterator match( mHoveredPoints.end() );
- for ( PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter )
+ PointInfoContainer::iterator match(mHoveredPoints.end());
+ for(PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter)
{
- if ( deviceId == iter->point.GetDeviceId() )
+ if(deviceId == iter->point.GetDeviceId())
{
match = iter;
// Add new point to the HoverEvent
- iter->point.SetState( PointState::FINISHED );
- hoverEvent.AddPoint( iter->point );
+ iter->point.SetState(PointState::FINISHED);
+ hoverEvent.AddPoint(iter->point);
}
else
{
- iter->point.SetState( PointState::STATIONARY );
- hoverEvent.AddPoint( iter->point );
+ iter->point.SetState(PointState::STATIONARY);
+ hoverEvent.AddPoint(iter->point);
}
}
- if ( match != mHoveredPoints.end() )
+ if(match != mHoveredPoints.end())
{
- mHoveredPoints.erase( match );
+ mHoveredPoints.erase(match);
dispatchEvent = TouchEventCombiner::DISPATCH_BOTH; // We should only dispatch hover events if the point was actually hovered in this window
}
}
touchEvent.time = time;
// Find pressed touch point in local list (while also adding the stored points to the touchEvent)
- PointInfoContainer::iterator match( mPressedPoints.end() );
- for ( PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter )
+ PointInfoContainer::iterator match(mPressedPoints.end());
+ for(PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter)
{
- if ( deviceId == iter->point.GetDeviceId() )
+ if(deviceId == iter->point.GetDeviceId())
{
match = iter;
// Add new point to the TouchEvent
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
}
else
{
- iter->point.SetState( PointState::STATIONARY );
- touchEvent.AddPoint( iter->point );
+ iter->point.SetState(PointState::STATIONARY);
+ touchEvent.AddPoint(iter->point);
}
}
- if ( match != mPressedPoints.end() )
+ if(match != mPressedPoints.end())
{
- mPressedPoints.erase( match );
+ mPressedPoints.erase(match);
dispatchEvent = TouchEventCombiner::DISPATCH_TOUCH; // We should only dispatch touch events if the point was actually pressed in this window
// Iterate through already stored touch points for HoverEvent and delete them
- for ( PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter )
+ for(PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter)
{
- if ( iter->point.GetDeviceId() == deviceId )
+ if(iter->point.GetDeviceId() == deviceId)
{
- iter = mHoveredPoints.erase( iter );
+ iter = mHoveredPoints.erase(iter);
}
}
}
{
bool fromNewDeviceId = false;
- if ( !mPressedPoints.empty() )
+ if(!mPressedPoints.empty())
{
touchEvent.time = time;
- bool ignore = false;
- PointInfoContainer::iterator match = mPressedPoints.end();
- const Vector2& pointScreenPosition = point.GetScreenPosition();
- for ( PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter )
+ bool ignore = false;
+ PointInfoContainer::iterator match = mPressedPoints.end();
+ const Vector2& pointScreenPosition = point.GetScreenPosition();
+ for(PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter)
{
- if ( deviceId == iter->point.GetDeviceId() )
+ if(deviceId == iter->point.GetDeviceId())
{
- uint32_t timeDiff( time - iter->time );
+ uint32_t timeDiff(time - iter->time);
- if ( timeDiff < mMinMotionTime )
+ if(timeDiff < mMinMotionTime)
{
// Motion event sent too soon after previous event so ignore
ignore = true;
}
const Vector2& currentScreenPosition = iter->point.GetScreenPosition();
- if ( ( std::abs( pointScreenPosition.x - currentScreenPosition.x ) < mMinMotionDistance.x ) &&
- ( std::abs( pointScreenPosition.y - currentScreenPosition.y ) < mMinMotionDistance.y ) )
+ if((std::abs(pointScreenPosition.x - currentScreenPosition.x) < mMinMotionDistance.x) &&
+ (std::abs(pointScreenPosition.y - currentScreenPosition.y) < mMinMotionDistance.y))
{
// Not enough positional change from last event so ignore
ignore = true;
match = iter;
// Add new touch point to the TouchEvent
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
}
else
{
- iter->point.SetState( PointState::STATIONARY );
- touchEvent.AddPoint( iter->point );
+ iter->point.SetState(PointState::STATIONARY);
+ touchEvent.AddPoint(iter->point);
}
}
- if ( match != mPressedPoints.end() )
+ if(match != mPressedPoints.end())
{
- PointInfo matchedPoint( point, time );
- std::swap( *match, matchedPoint );
+ PointInfo matchedPoint(point, time);
+ std::swap(*match, matchedPoint);
dispatchEvent = TouchEventCombiner::DISPATCH_TOUCH; // Dispatch touch event
}
hoverEvent.time = time;
// Iterate through already stored touch points and add to HoverEvent
- bool ignore = false;
- PointInfoContainer::iterator match = mHoveredPoints.end();
- const Vector2& pointScreenPosition = point.GetScreenPosition();
- for ( PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter )
+ bool ignore = false;
+ PointInfoContainer::iterator match = mHoveredPoints.end();
+ const Vector2& pointScreenPosition = point.GetScreenPosition();
+ for(PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter)
{
- if ( iter->point.GetDeviceId() == deviceId )
+ if(iter->point.GetDeviceId() == deviceId)
{
- uint32_t timeDiff( time - iter->time );
+ uint32_t timeDiff(time - iter->time);
- if ( timeDiff < mMinMotionTime )
+ if(timeDiff < mMinMotionTime)
{
// Motion event sent too soon after previous event so ignore
ignore = true;
}
const Vector2& currentScreenPosition = iter->point.GetScreenPosition();
- if ( ( std::abs( pointScreenPosition.x - currentScreenPosition.x ) < mMinMotionDistance.x ) &&
- ( std::abs( pointScreenPosition.y - currentScreenPosition.y ) < mMinMotionDistance.y ) )
+ if((std::abs(pointScreenPosition.x - currentScreenPosition.x) < mMinMotionDistance.x) &&
+ (std::abs(pointScreenPosition.y - currentScreenPosition.y) < mMinMotionDistance.y))
{
// Not enough positional change from last event so ignore
ignore = true;
match = iter;
// Add new touch point to the HoverEvent
- hoverEvent.AddPoint( point );
+ hoverEvent.AddPoint(point);
}
else
{
- iter->point.SetState( PointState::STATIONARY );
- hoverEvent.AddPoint( iter->point );
+ iter->point.SetState(PointState::STATIONARY);
+ hoverEvent.AddPoint(iter->point);
}
}
// Add new hover point to the list and to the HoverEvent
- if ( !ignore ) // Only dispatch hover event when it should not be ignored
+ if(!ignore) // Only dispatch hover event when it should not be ignored
{
- if( match == mHoveredPoints.end() )
+ if(match == mHoveredPoints.end())
{
Point hoverPoint(point);
- hoverPoint.SetState( PointState::STARTED ); // The first hover event received
- mHoveredPoints.push_back( PointInfo( hoverPoint, time ) );
- hoverEvent.AddPoint( hoverPoint );
+ hoverPoint.SetState(PointState::STARTED); // The first hover event received
+ mHoveredPoints.push_back(PointInfo(hoverPoint, time));
+ hoverEvent.AddPoint(hoverPoint);
}
else
{
- PointInfo matchedPoint( point, time );
- std::swap( *match, matchedPoint );
+ PointInfo matchedPoint(point, time);
+ std::swap(*match, matchedPoint);
}
if(dispatchEvent == TouchEventCombiner::DISPATCH_TOUCH)
Reset();
// We should still tell core about the interruption.
- touchEvent.AddPoint( point );
- hoverEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
+ hoverEvent.AddPoint(point);
dispatchEvent = TouchEventCombiner::DISPATCH_BOTH;
break;
}
return dispatchEvent;
}
-void TouchEventCombiner::SetMinimumMotionTimeThreshold( uint32_t minTime )
+void TouchEventCombiner::SetMinimumMotionTimeThreshold(uint32_t minTime)
{
mMinMotionTime = minTime;
}
-void TouchEventCombiner::SetMinimumMotionDistanceThreshold( float minDistance )
+void TouchEventCombiner::SetMinimumMotionDistanceThreshold(float minDistance)
{
- DALI_ASSERT_ALWAYS( minDistance >= 0.0f && "Negative values not allowed\n" );
+ DALI_ASSERT_ALWAYS(minDistance >= 0.0f && "Negative values not allowed\n");
mMinMotionDistance.x = mMinMotionDistance.y = minDistance;
}
-void TouchEventCombiner::SetMinimumMotionDistanceThreshold( float minXDistance, float minYDistance )
+void TouchEventCombiner::SetMinimumMotionDistanceThreshold(float minXDistance, float minYDistance)
{
- DALI_ASSERT_ALWAYS( minXDistance >= 0.0f && minYDistance >= 0.0f && "Negative values not allowed\n" );
+ DALI_ASSERT_ALWAYS(minXDistance >= 0.0f && minYDistance >= 0.0f && "Negative values not allowed\n");
mMinMotionDistance.x = minXDistance;
mMinMotionDistance.y = minYDistance;
}
-void TouchEventCombiner::SetMinimumMotionDistanceThreshold( Vector2 minDistance )
+void TouchEventCombiner::SetMinimumMotionDistanceThreshold(Vector2 minDistance)
{
- DALI_ASSERT_ALWAYS( minDistance.x >= 0.0f && minDistance.y >= 0.0f && "Negative values not allowed\n" );
+ DALI_ASSERT_ALWAYS(minDistance.x >= 0.0f && minDistance.y >= 0.0f && "Negative values not allowed\n");
mMinMotionDistance = minDistance;
}
#define DALI_INTEGRATION_TOUCH_EVENT_COMBINER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
+#include <dali/integration-api/events/point.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/math/vector2.h>
-#include <dali/integration-api/events/point.h>
namespace Dali
{
-
namespace Integration
{
-
struct TouchEvent;
struct HoverEvent;
class DALI_CORE_API TouchEventCombiner
{
public:
-
// Enumerations
enum EventDispatchType
{
- DISPATCH_TOUCH, ///< The touch event should be dispatched.
- DISPATCH_HOVER, ///< The hover event should be dispatched.
- DISPATCH_BOTH, ///< Both touch event and hover event should be dispatched.
- DISPATCH_NONE ///< Neither touch event nor hover event should be dispatched.
+ DISPATCH_TOUCH, ///< The touch event should be dispatched.
+ DISPATCH_HOVER, ///< The hover event should be dispatched.
+ DISPATCH_BOTH, ///< Both touch event and hover event should be dispatched.
+ DISPATCH_NONE ///< Neither touch event nor hover event should be dispatched.
};
/**
* @param[in] minMotionYDistance The minimum distance a finger has to be moved between vertical motion events.
* @note Will assert if any of the parameters is negative.
*/
- TouchEventCombiner( uint32_t minMotionTime, float minMotionXDistance, float minMotionYDistance );
+ TouchEventCombiner(uint32_t minMotionTime, float minMotionXDistance, float minMotionYDistance);
/**
* Construction with parameters.
* @param[in] minMotionDistance A Vector2 representing the minimum distance a finger has to be moved between horizontal and vertical motion events.
* @note Will assert if any of the parameters is negative.
*/
- TouchEventCombiner( uint32_t minMotionTime, Vector2 minMotionDistance );
+ TouchEventCombiner(uint32_t minMotionTime, Vector2 minMotionDistance);
/**
* Non virtual destructor
~TouchEventCombiner();
public:
-
/**
* Allows the caller to pass in a point which is processed and the TouchEvent and/or HoverEvent is appropriately filled with the new,
* and previously stored Point information.
*
* @return true if the point is beyond the different thresholds set thus, should be sent to core, false otherwise.
*/
- EventDispatchType GetNextTouchEvent( const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent );
+ EventDispatchType GetNextTouchEvent(const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent);
/**
* Sets the minimum time (in ms) that should occur between motion events.
* @param[in] minTime Minimum time between motion events.
*/
- void SetMinimumMotionTimeThreshold( uint32_t minTime );
+ void SetMinimumMotionTimeThreshold(uint32_t minTime);
/**
* Sets the minimum distance a finger has to be moved (both X and Y) between motion events.
* @param[in] minDistance The minimum distance between motion events.
* @note Will assert if parameter is negative.
*/
- void SetMinimumMotionDistanceThreshold( float minDistance );
+ void SetMinimumMotionDistanceThreshold(float minDistance);
/**
* Sets the minimum distance a finger has to be moved between motion events.
* @note Use this method if the X and Y threshold required is different.
* @note Will assert if any of the parameters is negative.
*/
- void SetMinimumMotionDistanceThreshold( float minXDistance, float minYDistance );
+ void SetMinimumMotionDistanceThreshold(float minXDistance, float minYDistance);
/**
* Sets the minimum distance a finger has to be moved between motion events.
* @note Use this method if the X and Y threshold required is different.
* @note Will assert if any of the parameters is negative.
*/
- void SetMinimumMotionDistanceThreshold( Vector2 minDistance );
+ void SetMinimumMotionDistanceThreshold(Vector2 minDistance);
/**
* Retrieves the minimum motion time threshold.
void Reset();
private:
-
struct PointInfo;
- typedef std::vector< PointInfo > PointInfoContainer;
- PointInfoContainer mPressedPoints; ///< A container of touched point and time.
- PointInfoContainer mHoveredPoints; ///< A container of hovered point and time.
+ typedef std::vector<PointInfo> PointInfoContainer;
+ PointInfoContainer mPressedPoints; ///< A container of touched point and time.
+ PointInfoContainer mHoveredPoints; ///< A container of hovered point and time.
- uint32_t mMinMotionTime; ///< The minimum time that should elapse before considering a new motion event.
- Vector2 mMinMotionDistance; ///< The minimum distance in the X and Y direction before considering a new motion event.
+ uint32_t mMinMotionTime; ///< The minimum time that should elapse before considering a new motion event.
+ Vector2 mMinMotionDistance; ///< The minimum distance in the X and Y direction before considering a new motion event.
};
} // namespace Integration
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
TouchEvent::TouchEvent()
-: MultiPointEvent( Touch )
+: MultiPointEvent(Touch)
{
}
-TouchEvent::TouchEvent( uint32_t time )
-: MultiPointEvent( Touch, time )
+TouchEvent::TouchEvent(uint32_t time)
+: MultiPointEvent(Touch, time)
{
}
namespace Dali
{
-
namespace Integration
{
-
/**
* An instance of this structure should be used by the adaptor to send a touch event to Dali core.
*
{
namespace Integration
{
-
Dali::TouchEvent NewTouchEvent(uint32_t timeStamp, const TouchPoint& point)
{
- return NewTouchEvent( timeStamp, Integration::Point( point ) );
+ return NewTouchEvent(timeStamp, Integration::Point(point));
}
-Dali::TouchEvent NewTouchEvent( uint32_t timeStamp, const Dali::Integration::Point& point )
+Dali::TouchEvent NewTouchEvent(uint32_t timeStamp, const Dali::Integration::Point& point)
{
- Internal::TouchEventPtr touchEventImpl( new Internal::TouchEvent( timeStamp ) );
- touchEventImpl->AddPoint( point );
- Dali::TouchEvent handle( touchEventImpl.Get() );
+ Internal::TouchEventPtr touchEventImpl(new Internal::TouchEvent(timeStamp));
+ touchEventImpl->AddPoint(point);
+ Dali::TouchEvent handle(touchEventImpl.Get());
return handle;
}
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/events/touch-event.h>
#include <dali/devel-api/events/touch-point.h>
#include <dali/integration-api/events/point.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/events/touch-event.h>
namespace Dali
{
-
namespace Integration
{
-
/**
* Create a new touch data handle from timestamp and touch point.
*
* @param[in] point The point on screen where the touch occurred.
* @return A new touch data handle.
*/
-DALI_CORE_API Dali::TouchEvent NewTouchEvent( uint32_t timeStamp, const Dali::Integration::Point& point );
+DALI_CORE_API Dali::TouchEvent NewTouchEvent(uint32_t timeStamp, const Dali::Integration::Point& point);
} // namespace Integration
namespace Dali
{
-
namespace Integration
{
-
WheelEvent::WheelEvent()
-: Event( Wheel ),
- type( MOUSE_WHEEL ),
- direction( 0 ),
- modifiers( 0 ),
- point( Vector2::ZERO ),
- delta( 0 ),
- timeStamp( 0 )
+: Event(Wheel),
+ type(MOUSE_WHEEL),
+ direction(0),
+ modifiers(0),
+ point(Vector2::ZERO),
+ delta(0),
+ timeStamp(0)
{
}
-WheelEvent::WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int delta, unsigned int timeStamp )
-: Event( Wheel ),
- type( type ),
- direction( direction ),
- modifiers( modifiers ),
- point( point ),
- delta( delta ),
- timeStamp( timeStamp )
+WheelEvent::WheelEvent(Type type, int direction, unsigned int modifiers, Vector2 point, int delta, unsigned int timeStamp)
+: Event(Wheel),
+ type(type),
+ direction(direction),
+ modifiers(modifiers),
+ point(point),
+ delta(delta),
+ timeStamp(timeStamp)
{
}
namespace Dali
{
-
namespace Integration
{
-
/**
* An instance of this class should be used by the adaptor to send a wheel event to
* the Dali core.
*/
enum Type
{
- MOUSE_WHEEL, ///< Mouse wheel event
- CUSTOM_WHEEL ///< Custom wheel event
+ MOUSE_WHEEL, ///< Mouse wheel event
+ CUSTOM_WHEEL ///< Custom wheel event
};
/**
* @param[in] delta The offset of rolling (positive value means roll down, and negative value means roll up)
* @param[in] timeStamp The time the wheel is being rolled.
*/
- WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int delta, unsigned int timeStamp );
+ WheelEvent(Type type, int direction, unsigned int modifiers, Vector2 point, int delta, unsigned int timeStamp);
/**
* Virtual destructor
*@copydoc Dali::WheelEvent::GetTime
*/
unsigned int timeStamp;
-
};
} // namespace Integration
#define DALI_INTEGRATION_GL_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
-
/* OpenGL ES 3.0 */
struct __GLsync;
namespace Dali
{
-
/**
* These types are equivalent to those in the GLES2 API.
* Dali objects should only access GL indirectly, through the Context API.
namespace Integration
{
-
/**
* GlAbstraction is an abstract interface, used to access OpenGL services.
* A concrete implementation must be created for each platform, and provided when creating the
class GlAbstraction
{
protected:
-
/**
* Virtual protected destructor, no deletion through this interface
*/
- virtual ~GlAbstraction() {}
+ virtual ~GlAbstraction()
+ {
+ }
public:
/**
* @param[in] isSubImage Boolian value for the whether the image is subimage or not
* @return Whether the texture will be convert or not.
*/
- virtual bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const = 0;
+ virtual bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const = 0;
/**
* The number of texture units an implementation supports is implementation dependent, but must be at least 8.
static const unsigned int MIN_TEXTURE_UNIT_LIMIT = 8;
/* OpenGL ES 2.0 */
-
+ // clang-format off
virtual void ActiveTexture (GLenum texture) = 0;
virtual void AttachShader (GLuint program, GLuint shader) = 0;
virtual void BindAttribLocation (GLuint program, GLuint index, const char* name) = 0;
virtual void TexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) = 0;
virtual void TexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) = 0;
virtual void GetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) = 0;
-
+ // clang-format on
};
} // namespace Integration
{
namespace Integration
{
-
/**
* This abstraction defines the interface for accessing GL context.
*/
virtual ~GlContextHelperAbstraction() = default;
public:
-
/**
* @brief Switch to the surfaceless GL context
*/
#define DALI_INTERNAL_GL_DEFINES_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
+// clang-format off
+
/* OpenGL ES 2.0 */
/* ClearBufferMask */
#define DALI_INTEGRATION_GL_SYNC_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
{
namespace Integration
{
-
/**
* This abstraction defines an API for syncing CPU with GPU.
* A typical use case is to determine when GL draw calls have finished drawing
/**
* Virtual protected destructor, no deletion through this interface
*/
- virtual ~GlSyncAbstraction() {}
+ virtual ~GlSyncAbstraction()
+ {
+ }
public:
-
class SyncObject
{
protected:
* Core from deleting SyncObjects - only Adaptor implementation is able to delete
* them.
*/
- virtual ~SyncObject() {}
+ virtual ~SyncObject()
+ {
+ }
public:
-
/**
* Determine if the synchronisation object has been signalled.
* @return false if the sync object has not been signalled, true if it has been signalled (and
namespace Dali
{
-
namespace Integration
{
-
-void SetPanGesturePredictionMode( int mode )
+void SetPanGesturePredictionMode(int mode)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
eventProcessor.SetPanGesturePredictionMode(mode);
}
-void SetPanGesturePredictionAmount( unsigned int amount )
+void SetPanGesturePredictionAmount(unsigned int amount)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
eventProcessor.SetPanGesturePredictionAmount(amount);
}
-void SetPanGestureMaximumPredictionAmount( unsigned int amount )
+void SetPanGestureMaximumPredictionAmount(unsigned int amount)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
eventProcessor.SetPanGestureMaximumPredictionAmount(amount);
}
-void SetPanGestureMinimumPredictionAmount( unsigned int amount )
+void SetPanGestureMinimumPredictionAmount(unsigned int amount)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
eventProcessor.SetPanGestureMinimumPredictionAmount(amount);
}
-void SetPanGesturePredictionAmountAdjustment( unsigned int amount )
+void SetPanGesturePredictionAmountAdjustment(unsigned int amount)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
eventProcessor.SetPanGesturePredictionAmountAdjustment(amount);
}
-void SetPanGestureSmoothingMode( int mode )
+void SetPanGestureSmoothingMode(int mode)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
eventProcessor.SetPanGestureSmoothingMode(mode);
}
-void SetPanGestureSmoothingAmount( float amount )
+void SetPanGestureSmoothingAmount(float amount)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
eventProcessor.SetPanGestureSmoothingAmount(amount);
}
-void SetPanGestureUseActualTimes( bool value )
+void SetPanGestureUseActualTimes(bool value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureUseActualTimes( value );
+ eventProcessor.SetPanGestureUseActualTimes(value);
}
-void SetPanGestureInterpolationTimeRange( int value )
+void SetPanGestureInterpolationTimeRange(int value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureInterpolationTimeRange( value );
+ eventProcessor.SetPanGestureInterpolationTimeRange(value);
}
-void SetPanGestureScalarOnlyPredictionEnabled( bool value )
+void SetPanGestureScalarOnlyPredictionEnabled(bool value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureScalarOnlyPredictionEnabled( value );
+ eventProcessor.SetPanGestureScalarOnlyPredictionEnabled(value);
}
-void SetPanGestureTwoPointPredictionEnabled( bool value )
+void SetPanGestureTwoPointPredictionEnabled(bool value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureTwoPointPredictionEnabled( value );
+ eventProcessor.SetPanGestureTwoPointPredictionEnabled(value);
}
-void SetPanGestureTwoPointInterpolatePastTime( int value )
+void SetPanGestureTwoPointInterpolatePastTime(int value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureTwoPointInterpolatePastTime( value );
+ eventProcessor.SetPanGestureTwoPointInterpolatePastTime(value);
}
-void SetPanGestureTwoPointVelocityBias( float value )
+void SetPanGestureTwoPointVelocityBias(float value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureTwoPointVelocityBias( value );
+ eventProcessor.SetPanGestureTwoPointVelocityBias(value);
}
-void SetPanGestureTwoPointAccelerationBias( float value )
+void SetPanGestureTwoPointAccelerationBias(float value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureTwoPointAccelerationBias( value );
+ eventProcessor.SetPanGestureTwoPointAccelerationBias(value);
}
-void SetPanGestureMultitapSmoothingRange( int value )
+void SetPanGestureMultitapSmoothingRange(int value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureMultitapSmoothingRange( value );
+ eventProcessor.SetPanGestureMultitapSmoothingRange(value);
}
-void SetPanGestureMinimumDistance( int value )
+void SetPanGestureMinimumDistance(int value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureMinimumDistance( value );
+ eventProcessor.SetPanGestureMinimumDistance(value);
}
-void SetPanGestureMinimumPanEvents( int value )
+void SetPanGestureMinimumPanEvents(int value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPanGestureMinimumPanEvents( value );
+ eventProcessor.SetPanGestureMinimumPanEvents(value);
}
-void SetPinchGestureMinimumDistance( float value )
+void SetPinchGestureMinimumDistance(float value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPinchGestureMinimumDistance( value );
+ eventProcessor.SetPinchGestureMinimumDistance(value);
}
-void SetPinchGestureMinimumTouchEvents( uint32_t value )
+void SetPinchGestureMinimumTouchEvents(uint32_t value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPinchGestureMinimumTouchEvents( value );
+ eventProcessor.SetPinchGestureMinimumTouchEvents(value);
}
-void SetPinchGestureMinimumTouchEventsAfterStart( uint32_t value )
+void SetPinchGestureMinimumTouchEventsAfterStart(uint32_t value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetPinchGestureMinimumTouchEventsAfterStart( value );
+ eventProcessor.SetPinchGestureMinimumTouchEventsAfterStart(value);
}
-void SetRotationGestureMinimumTouchEvents( uint32_t value )
+void SetRotationGestureMinimumTouchEvents(uint32_t value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetRotationGestureMinimumTouchEvents( value );
+ eventProcessor.SetRotationGestureMinimumTouchEvents(value);
}
-void SetRotationGestureMinimumTouchEventsAfterStart( uint32_t value )
+void SetRotationGestureMinimumTouchEventsAfterStart(uint32_t value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetRotationGestureMinimumTouchEventsAfterStart( value );
+ eventProcessor.SetRotationGestureMinimumTouchEventsAfterStart(value);
}
-void SetLongPressMinimumHoldingTime( unsigned int value )
+void SetLongPressMinimumHoldingTime(unsigned int value)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- eventProcessor.SetLongPressMinimumHoldingTime( value );
+ eventProcessor.SetLongPressMinimumHoldingTime(value);
}
-
} // namespace Integration
} // namespace Dali
#define DALI_INTEGRATION_INPUT_OPTIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
/**
* @brief Called by adaptor to set the pan gesture prediction mode from
* an environment variable
* @pre Should be called after Core creation.
* @param mode The pan gesture prediction mode.
*/
-DALI_CORE_API void SetPanGesturePredictionMode( int mode );
+DALI_CORE_API void SetPanGesturePredictionMode(int mode);
/**
* @brief Called by adaptor to set the prediction amount of the pan gesture
*
* @param[in] amount The prediction amount in milliseconds
*/
-DALI_CORE_API void SetPanGestureMaximumPredictionAmount( unsigned int amount );
+DALI_CORE_API void SetPanGestureMaximumPredictionAmount(unsigned int amount);
/**
* @brief Sets the lower bound of the prediction amount for clamping
*
* @param[in] amount The prediction amount in milliseconds
*/
-DALI_CORE_API void SetPanGestureMinimumPredictionAmount( unsigned int amount );
+DALI_CORE_API void SetPanGestureMinimumPredictionAmount(unsigned int amount);
/**
* @brief Sets the prediction amount to adjust when the pan velocity is changed
*
* @param[in] amount The prediction amount in milliseconds
*/
-DALI_CORE_API void SetPanGesturePredictionAmountAdjustment( unsigned int amount );
+DALI_CORE_API void SetPanGesturePredictionAmountAdjustment(unsigned int amount);
/**
* @brief Called to set how pan gestures smooth input
*
* @param[in] mode The smoothing mode to use
*/
-DALI_CORE_API void SetPanGestureSmoothingMode( int mode );
+DALI_CORE_API void SetPanGestureSmoothingMode(int mode);
/**
* @brief Sets the smoothing amount of the pan gesture
*
* @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing
*/
-DALI_CORE_API void SetPanGestureSmoothingAmount( float amount );
+DALI_CORE_API void SetPanGestureSmoothingAmount(float amount);
/**
* @brief Sets whether to use actual times of the real gesture and frames or not.
*
* @param[in] value True = use actual times, False = use perfect values
*/
-DALI_CORE_API void SetPanGestureUseActualTimes( bool value );
+DALI_CORE_API void SetPanGestureUseActualTimes(bool value);
/**
* @brief Sets the interpolation time range (ms) of past points to use (with weights) when interpolating.
*
* @param[in] value Time range in ms
*/
-DALI_CORE_API void SetPanGestureInterpolationTimeRange( int value );
+DALI_CORE_API void SetPanGestureInterpolationTimeRange(int value);
/**
* @brief Sets whether to use scalar only prediction, which when enabled, ignores acceleration.
*
* @param[in] value True = use scalar prediction only
*/
-DALI_CORE_API void SetPanGestureScalarOnlyPredictionEnabled( bool value );
+DALI_CORE_API void SetPanGestureScalarOnlyPredictionEnabled(bool value);
/**
* @brief Sets whether to use two point prediction. This combines two interpolated points to get more steady acceleration and velocity values.
*
* @param[in] value True = use two point prediction
*/
-DALI_CORE_API void SetPanGestureTwoPointPredictionEnabled( bool value );
+DALI_CORE_API void SetPanGestureTwoPointPredictionEnabled(bool value);
/**
* @brief Sets the time in the past to interpolate the second point when using two point interpolation.
*
* @param[in] value Time in past in ms
*/
-DALI_CORE_API void SetPanGestureTwoPointInterpolatePastTime( int value );
+DALI_CORE_API void SetPanGestureTwoPointInterpolatePastTime(int value);
/**
* @brief Sets the two point velocity bias. This is the ratio of first and second points to use for velocity.
*
* @param[in] value 0.0f = 100% first point. 1.0f = 100% of second point.
*/
-DALI_CORE_API void SetPanGestureTwoPointVelocityBias( float value );
+DALI_CORE_API void SetPanGestureTwoPointVelocityBias(float value);
/**
* @brief Sets the two point acceleration bias. This is the ratio of first and second points to use for acceleration.
*
* @param[in] value 0.0f = 100% first point. 1.0f = 100% of second point.
*/
-DALI_CORE_API void SetPanGestureTwoPointAccelerationBias( float value );
+DALI_CORE_API void SetPanGestureTwoPointAccelerationBias(float value);
/**
* @brief Sets the range of time (ms) of points in the history to perform multitap smoothing with (if enabled).
*
* @param[in] value Time in past in ms
*/
-DALI_CORE_API void SetPanGestureMultitapSmoothingRange( int value );
+DALI_CORE_API void SetPanGestureMultitapSmoothingRange(int value);
/**
* @brief Sets the minimum distance required to start a pan gesture
*
* @param[in] value Distance to move
*/
-DALI_CORE_API void SetPanGestureMinimumDistance( int value );
+DALI_CORE_API void SetPanGestureMinimumDistance(int value);
/**
* @brief Sets the minimum number of touch events to start a pan
*
* @param[in] value Number of pan events
*/
-DALI_CORE_API void SetPanGestureMinimumPanEvents( int value );
+DALI_CORE_API void SetPanGestureMinimumPanEvents(int value);
/**
* @brief Sets the minimum distance required to start a pinch gesture
*
* @param[in] value Distance to move in pixels
*/
-DALI_CORE_API void SetPinchGestureMinimumDistance( float value );
+DALI_CORE_API void SetPinchGestureMinimumDistance(float value);
/**
* @brief Sets the minimum touch events required before a pinch can be started
*
* @param[in] value The number of touch events
*/
-DALI_CORE_API void SetPinchGestureMinimumTouchEvents( uint32_t value );
+DALI_CORE_API void SetPinchGestureMinimumTouchEvents(uint32_t value);
/**
* @brief Sets the minimum touch events required after a pinch started
*
* @param[in] value The number of touch events
*/
-DALI_CORE_API void SetPinchGestureMinimumTouchEventsAfterStart( uint32_t value );
+DALI_CORE_API void SetPinchGestureMinimumTouchEventsAfterStart(uint32_t value);
/**
* @brief Sets the minimum touch events required before a rotation can be started
*
* @param[in] value The number of touch events
*/
-DALI_CORE_API void SetRotationGestureMinimumTouchEvents( uint32_t value );
+DALI_CORE_API void SetRotationGestureMinimumTouchEvents(uint32_t value);
/**
* @brief Sets the minimum touch events required after a rotation started
*
* @param[in] value The number of touch events
*/
-DALI_CORE_API void SetRotationGestureMinimumTouchEventsAfterStart( uint32_t value );
+DALI_CORE_API void SetRotationGestureMinimumTouchEventsAfterStart(uint32_t value);
/**
* @brief Sets the minimum holding time required to be recognized as a long press gesture
*
* @param[in] value The time value in milliseconds
*/
-DALI_CORE_API void SetLongPressMinimumHoldingTime( unsigned int value );
+DALI_CORE_API void SetLongPressMinimumHoldingTime(unsigned int value);
} // namespace Integration
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
-LocklessBuffer::LocklessBuffer( uint32_t size )
-: mState( R0W1 ),
- mSize( size )
+LocklessBuffer::LocklessBuffer(uint32_t size)
+: mState(R0W1),
+ mSize(size)
{
// allocate memory to speed up operation
mBuffer[0] = new uint8_t[size];
mBuffer[1] = new uint8_t[size];
- memset (mBuffer[0], 0, size );
- memset (mBuffer[1], 0, size );
+ memset(mBuffer[0], 0, size);
+ memset(mBuffer[1], 0, size);
}
LocklessBuffer::~LocklessBuffer()
delete[] mBuffer[1];
}
-void LocklessBuffer::Write( const uint8_t *src, uint32_t size )
+void LocklessBuffer::Write(const uint8_t* src, uint32_t size)
{
- DALI_ASSERT_ALWAYS( size <= mSize );
+ DALI_ASSERT_ALWAYS(size <= mSize);
// set WRITING bit
- BufferState currentState( __sync_fetch_and_or( &mState, WRITING ) );
- DALI_ASSERT_DEBUG( !(currentState & WRITING_MASK) ); // WRITING bit should never be set when we get here
+ BufferState currentState(__sync_fetch_and_or(&mState, WRITING));
+ DALI_ASSERT_DEBUG(!(currentState & WRITING_MASK)); // WRITING bit should never be set when we get here
// copy data to current write buffer, negate state to get actual index (recap: R0W1 = 0, R1W0 = 1)
const unsigned int index = (currentState & WRITE_BUFFER_MASK);
- memcpy( mBuffer[index], src, size );
+ memcpy(mBuffer[index], src, size);
// unset WRITING bit, set UPDATED bit
- BufferState checkState = __sync_val_compare_and_swap( &mState,
- static_cast<BufferState>(currentState | WRITING),
- static_cast<BufferState>(index | UPDATED) );
+ BufferState checkState = __sync_val_compare_and_swap(&mState,
+ static_cast<BufferState>(currentState | WRITING),
+ static_cast<BufferState>(index | UPDATED));
- DALI_ASSERT_DEBUG( checkState & WRITING );
+ DALI_ASSERT_DEBUG(checkState & WRITING);
(void)checkState; // Avoid unused variable warning
}
const uint8_t* LocklessBuffer::Read()
{
// current state (only to avoid multiple memory reads with volatile variable)
- BufferState currentState( mState );
- BufferState currentWriteBuf( static_cast<BufferState>( currentState & WRITE_BUFFER_MASK ) );
+ BufferState currentState(mState);
+ BufferState currentWriteBuf(static_cast<BufferState>(currentState & WRITE_BUFFER_MASK));
- if( currentState & UPDATED_MASK )
+ if(currentState & UPDATED_MASK)
{
// Try to swap buffers.
// This will set mState to 1 if readbuffer 0 was updated, 0 if readbuffer 1 was updated and fail if WRITING is set
- if( __sync_bool_compare_and_swap( &mState,
- static_cast<BufferState>(currentWriteBuf | UPDATED),
- static_cast<BufferState>(!currentWriteBuf) ) )
+ if(__sync_bool_compare_and_swap(&mState,
+ static_cast<BufferState>(currentWriteBuf | UPDATED),
+ static_cast<BufferState>(!currentWriteBuf)))
{
// swap successful
return mBuffer[currentWriteBuf];
return static_cast<unsigned int>(mSize);
}
-} // Internal
+} // namespace Integration
-} // Dali
+} // namespace Dali
#define DALI_INTEGRATION_LOCKLESS_BUFFER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <cstdint> // uint32_t, uint8_t
// INTERNAL INCLUDES
-#include <cstring>
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <cstring>
namespace Dali
{
-
namespace Integration
{
-
/**
* The LocklessBuffer class implements double buffering eligible for multi-(two) threaded use,
* where it's possible to read from one thread and write from another
*/
class DALI_CORE_API LocklessBuffer
{
-
public:
/**
* Constructor.
* @param[in] size The size of buffers in bytes.
*/
- LocklessBuffer( uint32_t size );
+ LocklessBuffer(uint32_t size);
/**
* Destructor.
* @param[in] src data source
* @param[in] size size of data in bytes
*/
- void Write( const uint8_t *src, uint32_t size );
+ void Write(const uint8_t* src, uint32_t size);
/**
* Try to swap buffers and read data.
*/
enum BufferState
{
- R0W1 = 0, ///< Read from buffer 0 write to buffer 1
- R1W0 = 1, ///< Read from buffer 1 write to buffer 0
- WRITING = 2, ///< Currently writing to buffer
- UPDATED = 4, ///< Swapping buffer required; there is new data available
+ R0W1 = 0, ///< Read from buffer 0 write to buffer 1
+ R1W0 = 1, ///< Read from buffer 1 write to buffer 0
+ WRITING = 2, ///< Currently writing to buffer
+ UPDATED = 4, ///< Swapping buffer required; there is new data available
WRITE_BUFFER_MASK = 1, ///< indicates which buffer to write to
WRITING_MASK = 2, ///< indicates whether currently writing
UPDATED_MASK = 4 ///< indicates whether new data is available
};
private:
- LocklessBuffer(); ///< undefined default constructor, need to give size on construction
- LocklessBuffer( const LocklessBuffer& ); ///< undefined copy constructor
- LocklessBuffer& operator=( const LocklessBuffer& ); ///< undefined assignment operator
+ LocklessBuffer(); ///< undefined default constructor, need to give size on construction
+ LocklessBuffer(const LocklessBuffer&); ///< undefined copy constructor
+ LocklessBuffer& operator=(const LocklessBuffer&); ///< undefined assignment operator
private:
uint8_t* mBuffer[2]; ///< bitmap buffers
uint32_t mSize; ///< size of buffers
};
-} // Internal
+} // namespace Integration
-} // Dali
+} // namespace Dali
#endif // DALI_INTEGRATION_LOCKLESS_BUFFER_H
#define DALI_INTEGRATION_PLATFORM_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/integration-api/bitmap.h>
#include <dali/integration-api/resource-types.h>
-#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/signals/callback.h>
namespace Dali
{
-
namespace Integration
{
using ResourceId = uint32_t;
class PlatformAbstraction
{
public:
-
// Resource Loading
/**
* flip the image, e.g., from portrait to landscape.
* @return dimensions that image will have if it is loaded with given parameters.
*/
- virtual ImageDimensions GetClosestImageSize( const std::string& filename,
- ImageDimensions size = ImageDimensions( 0, 0 ),
- FittingMode::Type fittingMode = FittingMode::SHRINK_TO_FIT,
- SamplingMode::Type samplingMode = SamplingMode::BOX,
- bool orientationCorrection = true) = 0;
+ virtual ImageDimensions GetClosestImageSize(const std::string& filename,
+ ImageDimensions size = ImageDimensions(0, 0),
+ FittingMode::Type fittingMode = FittingMode::SHRINK_TO_FIT,
+ SamplingMode::Type samplingMode = SamplingMode::BOX,
+ bool orientationCorrection = true) = 0;
/**
* @brief Determine the size of an image the resource loaders will provide when
* flip the image, e.g., from portrait to landscape.
* @return dimensions that image will have if it is loaded with given parameters.
*/
- virtual ImageDimensions GetClosestImageSize( ResourcePointer resourceBuffer,
- ImageDimensions size = ImageDimensions( 0, 0 ),
- FittingMode::Type fittingMode = FittingMode::SHRINK_TO_FIT,
- SamplingMode::Type samplingMode = SamplingMode::BOX,
- bool orientationCorrection = true) = 0;
+ virtual ImageDimensions GetClosestImageSize(ResourcePointer resourceBuffer,
+ ImageDimensions size = ImageDimensions(0, 0),
+ FittingMode::Type fittingMode = FittingMode::SHRINK_TO_FIT,
+ SamplingMode::Type samplingMode = SamplingMode::BOX,
+ bool orientationCorrection = true) = 0;
/**
* Request an image from the native filesystem. This is a synchronous request, i.e.
* @param[in] resourcePath The path to the resource
* @return A pointer to a ref-counted resource
*/
- virtual ResourcePointer LoadImageSynchronously( const BitmapResourceType& resourceType, const std::string& resourcePath ) = 0;
+ virtual ResourcePointer LoadImageSynchronously(const BitmapResourceType& resourceType, const std::string& resourcePath) = 0;
/**
* Decode a buffer of data synchronously.
*
* @return A pointer to the decoded buffer.
*/
- virtual BitmapPtr DecodeBuffer( const BitmapResourceType& resourceType, uint8_t * buffer, size_t bufferSize ) = 0;
+ virtual BitmapPtr DecodeBuffer(const BitmapResourceType& resourceType, uint8_t* buffer, size_t bufferSize) = 0;
/**
* Load a shader binary file into a buffer
* @param[out] buffer A buffer to receive the file.
* @result true if the file is loaded.
*/
- virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< uint8_t >& buffer ) const = 0;
+ virtual bool LoadShaderBinaryFile(const std::string& filename, Dali::Vector<uint8_t>& buffer) const = 0;
/**
* Save a shader binary file to the resource file system.
* @param[in] numbytes Size of the buffer.
* @result true if the file is saved, else false.
*/
- virtual bool SaveShaderBinaryFile( const std::string& filename, const uint8_t * buffer, uint32_t numBytes ) const = 0;
+ virtual bool SaveShaderBinaryFile(const std::string& filename, const uint8_t* buffer, uint32_t numBytes) const = 0;
/**
* Sets a callback to occur in the future
* @param[in] callback function to call when the timer expires
* @result a timer reference ID, to be used for cancelling the timer
*/
- virtual uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback ) = 0;
+ virtual uint32_t StartTimer(uint32_t milliseconds, CallbackBase* callback) = 0;
/**
* Cancels a running timer
* @param[in] timerId the ID reference returned when the timer was started
*/
- virtual void CancelTimer ( uint32_t timerId ) = 0;
+ virtual void CancelTimer(uint32_t timerId) = 0;
protected:
-
/**
* Virtual destructor.
*/
- virtual ~PlatformAbstraction() {}
+ virtual ~PlatformAbstraction()
+ {
+ }
}; // class PlatformAbstraction
#define DALI_INTEGRATION_PROCESSOR_INTERFACE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
/**
* Interface to enable classes to be processed after the event loop. Classes are processed
* in the order they are registered.
virtual void Process() = 0;
protected:
-
/**
* Virtual protected destructor
*/
- virtual ~Processor() { }
+ virtual ~Processor()
+ {
+ }
};
-} // Dali
+} // namespace Integration
-} // Integration
+} // namespace Dali
#endif // DALI_INTEGRATION_PROCESSOR_INTERFACE_H
\ No newline at end of file
#include <dali/internal/update/animation/scene-graph-animation.h>
#include <dali/internal/update/animation/scene-graph-constraint.h>
-
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/nodes/scene-graph-layer.h>
#include <dali/internal/update/rendering/scene-graph-renderer.h>
#include <dali/internal/render/renderers/render-geometry.h>
-#include <dali/internal/render/renderers/render-vertex-buffer.h>
#include <dali/internal/render/renderers/render-renderer.h>
#include <dali/internal/render/renderers/render-sampler.h>
+#include <dali/internal/render/renderers/render-vertex-buffer.h>
#include <dali/internal/update/render-tasks/scene-graph-camera.h>
using Dali::Internal::GestureEventProcessor;
namespace Dali
{
-
namespace Integration
{
-
-void EnableProfiling( ProfilingType type )
+void EnableProfiling(ProfilingType type)
{
GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
- switch( type )
+ switch(type)
{
case PROFILING_TYPE_PAN_GESTURE:
{
namespace Profiling
{
-
const std::size_t ANIMATION_MEMORY_SIZE(
- sizeof( Internal::Animation ) +
- sizeof( Internal::AnimatorConnector<float> ) +
- sizeof( Internal::SceneGraph::Animation ) );
+ sizeof(Internal::Animation) +
+ sizeof(Internal::AnimatorConnector<float>) +
+ sizeof(Internal::SceneGraph::Animation));
const std::size_t CONSTRAINT_MEMORY_SIZE(
- sizeof( Internal::Constraint<float> ) +
- sizeof( Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> > ) );
+ sizeof(Internal::Constraint<float>) +
+ sizeof(Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> >));
const std::size_t ACTOR_MEMORY_SIZE(
- sizeof( Internal::Actor ) +
- sizeof( Internal::SceneGraph::Node ) );
+ sizeof(Internal::Actor) +
+ sizeof(Internal::SceneGraph::Node));
const std::size_t CAMERA_ACTOR_MEMORY_SIZE(
- sizeof( Internal::CameraActor ) +
- sizeof( Internal::SceneGraph::Node ) +
- sizeof( Internal::SceneGraph::Camera ) );
+ sizeof(Internal::CameraActor) +
+ sizeof(Internal::SceneGraph::Node) +
+ sizeof(Internal::SceneGraph::Camera));
const std::size_t LAYER_MEMORY_SIZE(
- sizeof( Internal::Layer ) +
- sizeof( Internal::SceneGraph::Layer ) );
+ sizeof(Internal::Layer) +
+ sizeof(Internal::SceneGraph::Layer));
const std::size_t RENDERER_MEMORY_SIZE(
- sizeof( Internal::Renderer ) +
- sizeof( Internal::SceneGraph::Renderer ) +
- sizeof( Internal::Render::Renderer ) );
+ sizeof(Internal::Renderer) +
+ sizeof(Internal::SceneGraph::Renderer) +
+ sizeof(Internal::Render::Renderer));
const std::size_t GEOMETRY_MEMORY_SIZE(
- sizeof( Internal::Geometry ) +
- sizeof( Internal::Render::Geometry) );
+ sizeof(Internal::Geometry) +
+ sizeof(Internal::Render::Geometry));
const std::size_t PROPERTY_BUFFER_MEMORY_SIZE(
- sizeof( Internal::VertexBuffer ) +
- sizeof( Internal::Render::VertexBuffer ) );
+ sizeof(Internal::VertexBuffer) +
+ sizeof(Internal::Render::VertexBuffer));
const std::size_t TEXTURE_SET_MEMORY_SIZE(
- sizeof( Internal::TextureSet ) +
- sizeof( Internal::SceneGraph::TextureSet ) );
+ sizeof(Internal::TextureSet) +
+ sizeof(Internal::SceneGraph::TextureSet));
const std::size_t SAMPLER_MEMORY_SIZE(
- sizeof( Internal::Sampler ) +
- sizeof( Internal::Render::Sampler ) );
+ sizeof(Internal::Sampler) +
+ sizeof(Internal::Render::Sampler));
const std::size_t SHADER_MEMORY_SIZE(
- sizeof( Internal::Shader ) +
- sizeof( Internal::SceneGraph::Shader ) );
+ sizeof(Internal::Shader) +
+ sizeof(Internal::SceneGraph::Shader));
} // namespace Profiling
#define DALI_INTEGRATION_PROFILING_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
enum ProfilingType
{
PROFILING_TYPE_PAN_GESTURE,
* @pre Should be called after Core creation.
* @param type The type of profiling information to output.
*/
-DALI_CORE_API void EnableProfiling( ProfilingType type );
-
+DALI_CORE_API void EnableProfiling(ProfilingType type);
namespace Profiling
{
-
-DALI_CORE_API extern const std::size_t ANIMATION_MEMORY_SIZE; ///< Total size of animation and associated internal objects
-DALI_CORE_API extern const std::size_t CONSTRAINT_MEMORY_SIZE; ///< Total size of constraint and associated internal objects
-DALI_CORE_API extern const std::size_t ACTOR_MEMORY_SIZE; ///< Total size of actor and associated internal objects
-DALI_CORE_API extern const std::size_t CAMERA_ACTOR_MEMORY_SIZE; ///< Total size of camera actor and associated internal objects
-DALI_CORE_API extern const std::size_t IMAGE_ACTOR_MEMORY_SIZE; ///< Total size of image actor and associated internal objects
-DALI_CORE_API extern const std::size_t LAYER_MEMORY_SIZE; ///< Total size of layer and associated internal objects
-DALI_CORE_API extern const std::size_t IMAGE_MEMORY_SIZE; ///< Total size of image and associated internal objects
-
-DALI_CORE_API extern const std::size_t RENDERER_MEMORY_SIZE; ///< Total size of renderer and associated internal objects
-DALI_CORE_API extern const std::size_t GEOMETRY_MEMORY_SIZE; ///< Total size of geometry and associated internal objects
-DALI_CORE_API extern const std::size_t PROPERTY_BUFFER_MEMORY_SIZE; ///< Total size of property-0buffer and associated internal objects
+DALI_CORE_API extern const std::size_t ANIMATION_MEMORY_SIZE; ///< Total size of animation and associated internal objects
+DALI_CORE_API extern const std::size_t CONSTRAINT_MEMORY_SIZE; ///< Total size of constraint and associated internal objects
+DALI_CORE_API extern const std::size_t ACTOR_MEMORY_SIZE; ///< Total size of actor and associated internal objects
+DALI_CORE_API extern const std::size_t CAMERA_ACTOR_MEMORY_SIZE; ///< Total size of camera actor and associated internal objects
+DALI_CORE_API extern const std::size_t IMAGE_ACTOR_MEMORY_SIZE; ///< Total size of image actor and associated internal objects
+DALI_CORE_API extern const std::size_t LAYER_MEMORY_SIZE; ///< Total size of layer and associated internal objects
+DALI_CORE_API extern const std::size_t IMAGE_MEMORY_SIZE; ///< Total size of image and associated internal objects
+DALI_CORE_API extern const std::size_t RENDERER_MEMORY_SIZE; ///< Total size of renderer and associated internal objects
+DALI_CORE_API extern const std::size_t GEOMETRY_MEMORY_SIZE; ///< Total size of geometry and associated internal objects
+DALI_CORE_API extern const std::size_t PROPERTY_BUFFER_MEMORY_SIZE; ///< Total size of property-0buffer and associated internal objects
DALI_CORE_API extern const std::size_t TEXTURE_SET_MEMORY_SIZE; ///< Total size of TextureSet and associated internal objects
-DALI_CORE_API extern const std::size_t SAMPLER_MEMORY_SIZE; ///< Total size of Sampler and associated internal objects
-DALI_CORE_API extern const std::size_t SHADER_MEMORY_SIZE; ///< Total size of shader and associated internal objects
+DALI_CORE_API extern const std::size_t SAMPLER_MEMORY_SIZE; ///< Total size of Sampler and associated internal objects
+DALI_CORE_API extern const std::size_t SHADER_MEMORY_SIZE; ///< Total size of shader and associated internal objects
} // namespace Profiling
} // namespace Integration
#define DALI_INTEGRATION_RENDER_CONTROLLER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace Integration
{
-
/**
* Abstract interface for an object which controls rendering.
* This will be informed when Dali has new content to render.
class RenderController
{
protected:
-
/**
* Virtual protected destructor, no deletion through this interface
*/
- virtual ~RenderController() {}
+ virtual ~RenderController()
+ {
+ }
public:
-
/**
* Requests a future call to Dali::Integration::Core::Update().
* This is called when Dali has new content, typically in response to Actors/Animations being added.
* Multi-threading note: this method will be called from the main thread only.
* @param[in] forceUpdate true to update forcely.
*/
- virtual void RequestUpdate( bool forceUpdate ) = 0;
+ virtual void RequestUpdate(bool forceUpdate) = 0;
/**
* Requests a future call to Dali::Integration::Core::ProcessEvents(), when the application is idle.
* Multi-threading note: this method will be called from the main thread only.
* @param[in] forceProcess true to process events forcely.
*/
- virtual void RequestProcessEventsOnIdle( bool forceProcess ) = 0;
-
+ virtual void RequestProcessEventsOnIdle(bool forceProcess) = 0;
};
} // namespace Integration
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/integration-api/render-task-list-integ.h>
// INTERNAL INCLUDES
-#include <dali/internal/event/render-tasks/render-task-list-impl.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
+#include <dali/internal/event/render-tasks/render-task-list-impl.h>
namespace Dali
{
-
namespace Integration
{
-
namespace RenderTaskList
{
-
Dali::RenderTaskList New()
{
Dali::Internal::RenderTaskListPtr renderTaskList = Dali::Internal::RenderTaskList::New();
- return Dali::RenderTaskList( renderTaskList.Get() );
+ return Dali::RenderTaskList(renderTaskList.Get());
}
-Dali::RenderTask CreateTask( Dali::RenderTaskList& taskList, Dali::Actor& sourceActor, Dali::CameraActor& cameraActor)
+Dali::RenderTask CreateTask(Dali::RenderTaskList& taskList, Dali::Actor& sourceActor, Dali::CameraActor& cameraActor)
{
- return RenderTask( GetImplementation(taskList).CreateTask( &GetImplementation( sourceActor), &GetImplementation(cameraActor) ).Get() );
+ return RenderTask(GetImplementation(taskList).CreateTask(&GetImplementation(sourceActor), &GetImplementation(cameraActor)).Get());
}
} // namespace RenderTaskList
#define DALI_INTEGRATION_RENDER_TASK_LIST_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
class Actor;
class CameraActor;
namespace Integration
{
-
namespace RenderTaskList
{
-
- /**
+/**
* @brief Helper function to create a new RenderTaskList object.
*
* A RenderTaskList is an ordered list of render tasks that describes
*
* @return A handle to a newly allocated RenderTaskList
*/
- DALI_CORE_API Dali::RenderTaskList New();
+DALI_CORE_API Dali::RenderTaskList New();
- /**
+/**
* @brief Helper function to create a new RenderTask.
*
* The created task will be appended to the list of render-tasks.
* @param[in] cameraActor The actor from which the scene is viewed for this render task.
* @return A valid handle to a new RenderTask
*/
- DALI_CORE_API Dali::RenderTask CreateTask( Dali::RenderTaskList& taskList, Dali::Actor& sourceActor, Dali::CameraActor& cameraActor);
+DALI_CORE_API Dali::RenderTask CreateTask(Dali::RenderTaskList& taskList, Dali::Actor& sourceActor, Dali::CameraActor& cameraActor);
} // namespace RenderTaskList
{
namespace ResourcePolicy
{
-
/**
* The discardable policy determines if a resource can be discarded.
* Discarded means that it can be released after uploading to GPU.
#define DALI_INTEGRATION_RESOURCE_TYPES_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Integration
{
-
/**
* BitmapResourceType describes a bitmap resource.
*/
* @param[in] orientationCorrection Whether to use bitmap metadata to rotate or
* flip the bitmap, e.g., from portrait to landscape.
*/
- BitmapResourceType( ImageDimensions size = ImageDimensions( 0, 0 ),
- FittingMode::Type scalingMode = FittingMode::DEFAULT,
- SamplingMode::Type samplingMode = SamplingMode::DEFAULT,
- bool orientationCorrection = true )
- : size( size ),
- scalingMode( scalingMode ),
- samplingMode( samplingMode ),
- orientationCorrection( orientationCorrection )
- {}
+ BitmapResourceType(ImageDimensions size = ImageDimensions(0, 0),
+ FittingMode::Type scalingMode = FittingMode::DEFAULT,
+ SamplingMode::Type samplingMode = SamplingMode::DEFAULT,
+ bool orientationCorrection = true)
+ : size(size),
+ scalingMode(scalingMode),
+ samplingMode(samplingMode),
+ orientationCorrection(orientationCorrection)
+ {
+ }
/**
* Destructor.
*/
~BitmapResourceType()
- {}
+ {
+ }
/**
* Attributes are copied from the request.
*/
- ImageDimensions size;
- FittingMode::Type scalingMode;
+ ImageDimensions size;
+ FittingMode::Type scalingMode;
SamplingMode::Type samplingMode;
- bool orientationCorrection;
+ bool orientationCorrection;
private:
-
// Undefined copy constructor.
BitmapResourceType(const BitmapResourceType& typePath);
// Undefined assignment operator.
BitmapResourceType& operator=(const BitmapResourceType& rhs);
-
};
} // namespace Integration
#include <dali/integration-api/scene.h>
// INTERNAL INCLUDES
+#include <dali/internal/event/common/scene-impl.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/internal/event/common/scene-impl.h>
namespace Dali
{
-
namespace Integration
{
-
-Scene Scene::New( Size size )
+Scene Scene::New(Size size)
{
- Internal::ScenePtr internal = Internal::Scene::New( size );
- return Scene( internal.Get() );
+ Internal::ScenePtr internal = Internal::Scene::New(size);
+ return Scene(internal.Get());
}
-Scene Scene::DownCast( BaseHandle handle )
+Scene Scene::DownCast(BaseHandle handle)
{
- return Scene( dynamic_cast<Dali::Internal::Scene*>( handle.GetObjectPtr()) );
+ return Scene(dynamic_cast<Dali::Internal::Scene*>(handle.GetObjectPtr()));
}
Scene::Scene()
{
}
-Scene::Scene( const Scene& handle )
-:BaseHandle(handle)
+Scene::Scene(const Scene& handle)
+: BaseHandle(handle)
{
}
-Scene::Scene( Internal::Scene* internal )
+Scene::Scene(Internal::Scene* internal)
: BaseHandle(internal)
{
}
-Scene& Scene::operator=( const Scene& rhs )
+Scene& Scene::operator=(const Scene& rhs)
{
BaseHandle::operator=(rhs);
return *this;
}
-void Scene::Add( Actor actor )
+void Scene::Add(Actor actor)
{
- GetImplementation(*this).Add( GetImplementation(actor) );
+ GetImplementation(*this).Add(GetImplementation(actor));
}
-void Scene::Remove( Actor actor )
+void Scene::Remove(Actor actor)
{
- GetImplementation(*this).Remove( GetImplementation(actor) );
+ GetImplementation(*this).Remove(GetImplementation(actor));
}
Size Scene::GetSize() const
return GetImplementation(*this).GetSize();
}
-void Scene::SetDpi( Vector2 dpi )
+void Scene::SetDpi(Vector2 dpi)
{
- GetImplementation(*this).SetDpi( dpi );
+ GetImplementation(*this).SetDpi(dpi);
}
Vector2 Scene::GetDpi() const
return GetImplementation(*this).GetDpi();
}
-void Scene::SetBackgroundColor( const Vector4& color )
+void Scene::SetBackgroundColor(const Vector4& color)
{
- GetImplementation(*this).SetBackgroundColor( color );
+ GetImplementation(*this).SetBackgroundColor(color);
}
Vector4 Scene::GetBackgroundColor() const
RenderTaskList Scene::GetRenderTaskList() const
{
- return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
+ return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
}
Layer Scene::GetRootLayer() const
return GetImplementation(*this).GetLayerCount();
}
-Layer Scene::GetLayer( uint32_t depth ) const
+Layer Scene::GetLayer(uint32_t depth) const
{
- return GetImplementation(*this).GetLayer( depth );
+ return GetImplementation(*this).GetLayer(depth);
}
-void Scene::SurfaceResized( float width, float height )
+void Scene::SurfaceResized(float width, float height)
{
- GetImplementation( *this ).SurfaceResized( width, height );
+ GetImplementation(*this).SurfaceResized(width, height);
}
void Scene::SurfaceReplaced()
{
- GetImplementation( *this ).SurfaceReplaced();
+ GetImplementation(*this).SurfaceReplaced();
}
void Scene::Discard()
GetImplementation(*this).Discard();
}
-Integration::Scene Scene::Get( Actor actor )
+Integration::Scene Scene::Get(Actor actor)
{
- return Dali::Integration::Scene( &GetImplementation( actor ).GetScene() );
+ return Dali::Integration::Scene(&GetImplementation(actor).GetScene());
}
-void Scene::QueueEvent( const Integration::Event& event )
+void Scene::QueueEvent(const Integration::Event& event)
{
- GetImplementation(*this).QueueEvent( event );
+ GetImplementation(*this).QueueEvent(event);
}
void Scene::ProcessEvents()
GetImplementation(*this).ProcessEvents();
}
-void Scene::AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId )
+void Scene::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
{
- GetImplementation( *this ).AddFrameRenderedCallback( std::move( callback ), frameId );
+ GetImplementation(*this).AddFrameRenderedCallback(std::move(callback), frameId);
}
-void Scene::AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId )
+void Scene::AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
{
- GetImplementation( *this ).AddFramePresentedCallback( std::move( callback ), frameId );
+ GetImplementation(*this).AddFramePresentedCallback(std::move(callback), frameId);
}
-void Scene::GetFrameRenderedCallback( FrameCallbackContainer& callbacks )
+void Scene::GetFrameRenderedCallback(FrameCallbackContainer& callbacks)
{
- GetImplementation( *this ).GetFrameRenderedCallback( callbacks );
+ GetImplementation(*this).GetFrameRenderedCallback(callbacks);
}
-void Scene::GetFramePresentedCallback( FrameCallbackContainer& callbacks )
+void Scene::GetFramePresentedCallback(FrameCallbackContainer& callbacks)
{
- GetImplementation( *this ).GetFramePresentedCallback( callbacks );
+ GetImplementation(*this).GetFramePresentedCallback(callbacks);
}
Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
return GetImplementation(*this).WheelEventSignal();
}
-} // Integration
+} // namespace Integration
-} // Dali
+} // namespace Dali
#include <memory>
// INTERNAL INCLUDES
-#include <dali/public-api/object/handle.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/object/handle.h>
namespace Dali
{
-
class Actor;
class KeyEvent;
class Layer;
namespace Internal DALI_INTERNAL
{
- class Scene;
+class Scene;
}
namespace Integration
{
-
struct Event;
/**
class DALI_CORE_API Scene : public BaseHandle
{
public:
- using EventProcessingFinishedSignalType = Signal<void()>; ///< Event Processing finished signal type
- using KeyEventSignalType = Signal<void( const Dali::KeyEvent& )>; ///< Key event signal type
- using KeyEventGeneratedSignalType = Signal<bool( const Dali::KeyEvent& )>; ///< key event generated signal type
- using TouchEventSignalType = Signal<void( const Dali::TouchEvent& )>; ///< Touch signal type
- using WheelEventSignalType = Signal<void( const Dali::WheelEvent& )>; ///< WheelEvent signal type
+ using EventProcessingFinishedSignalType = Signal<void()>; ///< Event Processing finished signal type
+ using KeyEventSignalType = Signal<void(const Dali::KeyEvent&)>; ///< Key event signal type
+ using KeyEventGeneratedSignalType = Signal<bool(const Dali::KeyEvent&)>; ///< key event generated signal type
+ using TouchEventSignalType = Signal<void(const Dali::TouchEvent&)>; ///< Touch signal type
+ using WheelEventSignalType = Signal<void(const Dali::WheelEvent&)>; ///< WheelEvent signal type
- using FrameCallbackContainer = std::vector< std::pair< std::unique_ptr< CallbackBase >, int32_t > >;
+ using FrameCallbackContainer = std::vector<std::pair<std::unique_ptr<CallbackBase>, int32_t> >;
/**
* @brief Create an initialized Scene handle.
*
* @return a handle to a newly allocated Dali resource.
*/
- static Scene New( Size size );
+ static Scene New(Size size);
/**
* @brief Downcast an Object handle to Scene handle.
* @param[in] handle to An object
* @return handle to a Scene object or an uninitialized handle
*/
- static Scene DownCast( BaseHandle handle );
+ static Scene DownCast(BaseHandle handle);
/**
* @brief Create an uninitialized Scene handle.
* Sets horizontal and vertical pixels per inch value that is used by the display
* @param[in] dpi Horizontal and vertical dpi value
*/
- void SetDpi( Vector2 dpi );
+ void SetDpi(Vector2 dpi);
/**
* @brief Retrieves the DPI of the display device to which the scene is connected.
*
* @param[in] color The new background color
*/
- void SetBackgroundColor( const Vector4& color );
+ void SetBackgroundColor(const Vector4& color);
/**
* @brief Gets the background color of the render surface.
* @return The layer found at the given depth
* @pre Depth is less than layer count; see GetLayerCount().
*/
- Layer GetLayer( uint32_t depth ) const;
+ Layer GetLayer(uint32_t depth) const;
/**
* @brief Informs the scene that the set surface has been resized.
* @param[in] width The new width of the set surface
* @param[in] height The new height of the set surface
*/
- void SurfaceResized( float width, float height );
+ void SurfaceResized(float width, float height);
/**
* @brief Informs the scene that the surface has been replaced.
* @brief Retrieve the Scene that the given actor belongs to.
* @return The Scene.
*/
- static Integration::Scene Get( Actor actor );
+ static Integration::Scene Get(Actor actor);
/**
* This function is called when an event is queued.
* @param[in] event A event to queue.
*/
- void QueueEvent( const Integration::Event& event );
+ void QueueEvent(const Integration::Event& event);
/**
* This function is called by Core when events are processed.
*
* @note Ownership of the callback is passed onto this class.
*/
- void AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+ void AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId);
/**
* @brief Adds a callback that is called when the frame is displayed on the display.
*
* @note Ownership of the callback is passed onto this class.
*/
- void AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+ void AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId);
/**
* @brief Gets the callback list that is called when the frame rendering is done by the graphics driver.
*
* @note This is called in the update thread.
*/
- void GetFrameRenderedCallback( FrameCallbackContainer& callbacks );
+ void GetFrameRenderedCallback(FrameCallbackContainer& callbacks);
/**
* @brief Gets the callback list that is called when the frame is displayed on the display.
*
* @note This is called in the update thread.
*/
- void GetFramePresentedCallback( FrameCallbackContainer& callbacks );
+ void GetFramePresentedCallback(FrameCallbackContainer& callbacks);
/**
* @brief This signal is emitted just after the event processing is finished.
WheelEventSignalType& WheelEventSignal();
public: // Not intended for application developers
-
/**
* @brief This constructor is used by Dali::New() methods.
*
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/integration-api/trace.h>
// EXTERNAL INCLUDES
-#include <list>
#include <cstdarg>
+#include <list>
namespace Dali
{
-
namespace Integration
{
-
namespace Trace
{
-
thread_local LogContextFunction gThreadLocalLogContextFunction = nullptr;
-void InstallLogContextFunction( const LogContextFunction& logContextFunction )
+void InstallLogContextFunction(const LogContextFunction& logContextFunction)
{
gThreadLocalLogContextFunction = logContextFunction;
}
-void LogContext( bool start, const char* tag )
+void LogContext(bool start, const char* tag)
{
- if ( !gThreadLocalLogContextFunction )
+ if(!gThreadLocalLogContextFunction)
{
return;
}
- gThreadLocalLogContextFunction( start, tag );
+ gThreadLocalLogContextFunction(start, tag);
}
#ifdef TRACE_ENABLED
namespace
{
- static FilterList* GetActiveFilters()
- {
- static FilterList* activeFilters = new FilterList;
- return activeFilters;
- }
+static FilterList* GetActiveFilters()
+{
+ static FilterList* activeFilters = new FilterList;
+ return activeFilters;
}
+} // namespace
-Filter* Filter::New( bool trace, const char * environmentVariableName )
+Filter* Filter::New(bool trace, const char* environmentVariableName)
{
- char * environmentVariableValue = getenv( environmentVariableName );
- if ( environmentVariableValue )
+ char* environmentVariableValue = getenv(environmentVariableName);
+ if(environmentVariableValue)
{
- char envTraceString( 0 );
- sscanf( environmentVariableValue, "%c", &envTraceString );
+ char envTraceString(0);
+ sscanf(environmentVariableValue, "%c", &envTraceString);
// Just use 'f' and 't' as it's faster than doing full string comparisons
- if ( envTraceString == 't' )
+ if(envTraceString == 't')
{
trace = true;
}
- else if ( envTraceString == 'f' )
+ else if(envTraceString == 'f')
{
trace = false;
}
}
- Filter* filter = new Filter( trace );
- GetActiveFilters()->push_back( filter );
+ Filter* filter = new Filter(trace);
+ GetActiveFilters()->push_back(filter);
return filter;
}
*/
void Filter::EnableGlobalTrace()
{
- for( FilterIter iter = GetActiveFilters()->begin(); iter != GetActiveFilters()->end(); iter++ )
+ for(FilterIter iter = GetActiveFilters()->begin(); iter != GetActiveFilters()->end(); iter++)
{
(*iter)->EnableTrace();
}
*/
void Filter::DisableGlobalTrace()
{
- for( FilterIter iter = GetActiveFilters()->begin(); iter != GetActiveFilters()->end(); iter++ )
+ for(FilterIter iter = GetActiveFilters()->begin(); iter != GetActiveFilters()->end(); iter++)
{
(*iter)->DisableTrace();
}
/**
* Begin Trace
*/
-void Filter::BeginTrace( const char* tagName )
+void Filter::BeginTrace(const char* tagName)
{
- Dali::Integration::Trace::LogContext( true, tagName );
+ Dali::Integration::Trace::LogContext(true, tagName);
}
/**
* End Trace
*/
-void Filter::EndTrace( const char* tagName )
+void Filter::EndTrace(const char* tagName)
{
- Dali::Integration::Trace::LogContext( false, tagName );
+ Dali::Integration::Trace::LogContext(false, tagName);
}
/**
* Tracer Constructor
*/
-Tracer::Tracer( Filter* filter, const char* tag )
-: mTag( tag ),
- mFilter( filter )
+Tracer::Tracer(Filter* filter, const char* tag)
+: mTag(tag),
+ mFilter(filter)
{
- if( mFilter && mFilter->IsTraceEnabled() )
+ if(mFilter && mFilter->IsTraceEnabled())
{
- mFilter->BeginTrace( mTag );
+ mFilter->BeginTrace(mTag);
}
}
*/
Tracer::~Tracer()
{
- if( mFilter && mFilter->IsTraceEnabled() )
+ if(mFilter && mFilter->IsTraceEnabled())
{
- mFilter->EndTrace( mTag );
+ mFilter->EndTrace(mTag);
}
}
#endif //TRACE_ENABLED
-} // Trace
+} // namespace Trace
-} // Integration
+} // namespace Integration
-} // Dali
+} // namespace Dali
#define DALI_INTEGRATION_TRACE_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
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_CORE_API void LogContext( bool start, const char* tag );
+DALI_CORE_API void LogContext(bool start, const char* tag);
/**
* typedef for the LogContextFunction function.
*/
-using LogContextFunction = void ( * )( bool, const char* );
+using LogContextFunction = void (*)(bool, const char*);
/**
* A LogContextFunction function has to be installed for every thread that wants to use tracing.
* The LogContextFunction function can be different for each thread.
* @param LogContextFunction the Log Context function to install
*/
-DALI_CORE_API void InstallLogContextFunction( const LogContextFunction& logContextFunction );
+DALI_CORE_API void InstallLogContextFunction(const LogContextFunction& logContextFunction);
/********************************************************************************
* Filter *
class DALI_CORE_API Filter
{
public:
-
/**
* Test if trace is enabled for this filter.
* @return true if trace is enabled;
*/
- inline bool IsTraceEnabled() { return mTraceEnabled; }
+ inline bool IsTraceEnabled()
+ {
+ return mTraceEnabled;
+ }
/**
* Enable tracing on this filter.
*/
- inline void EnableTrace() { mTraceEnabled = true; }
+ inline void EnableTrace()
+ {
+ mTraceEnabled = true;
+ }
/**
* Disable tracing on this filter.
*/
- inline void DisableTrace() { mTraceEnabled = false; }
+ inline void DisableTrace()
+ {
+ mTraceEnabled = false;
+ }
/**
* Create a new filter whose trace can be modified through the use of an environment variable.
* TRACE_ENV=0 dali-demo // Trace OFF
* @endcode
*/
- static Filter* New( bool trace, const char * environmentVariableName );
+ static Filter* New(bool trace, const char* environmentVariableName);
/**
* Begin trace.
* @param[in] tagName - a unique event tag name.
*/
- void BeginTrace( const char* tagName );
+ void BeginTrace(const char* tagName);
/**
* End trace.
* @param[in] tagName - a unique event tag name.
*/
- void EndTrace( const char* tagName );
+ void EndTrace(const char* tagName);
/**
* Enable trace on all filters.
static void DisableGlobalTrace();
private:
-
/**
* Constructor.
* @param[in] trace - whether this filter allows tracing.
*/
- Filter( bool trace ) : mTraceEnabled( trace ) {}
+ Filter(bool trace)
+ : mTraceEnabled(trace)
+ {
+ }
private:
bool mTraceEnabled;
class DALI_CORE_API Tracer final
{
public:
- Tracer( Filter* filter, const char* tag );
+ Tracer(Filter* filter, const char* tag);
~Tracer();
public:
const char* mTag;
- Filter* mFilter;
+ Filter* mFilter;
};
/**
* 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 ); \
-}
+#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 ); }
+#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 ); }
+#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, ASSERT_LOCATION );
+#define DALI_TRACE_FUNCTION(filter) \
+ Dali::Integration::Trace::Tracer logTraceFunction(filter, ASSERT_LOCATION);
/**
* Used for scope tracing. It logs tracing around a scope.
*/
-#define DALI_TRACE_SCOPE( filter, tag ) \
- Dali::Integration::Trace::Tracer logTracerScope( filter, tag );
+#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 )
+#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
+} // namespace Trace
-} // Integration
+} // namespace Integration
-} // Dali
+} // namespace Dali
#endif // DALI_INTEGRATION_TRACE_H
#define DALI_ACTOR_ENUMERATIONS_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
namespace Dimension
{
-
/**
* @brief Enumeration for Dimension types.
* @SINCE_1_0.0
*/
enum Type
{
- WIDTH = 0x1, ///< Width dimension @SINCE_1_0.0
- HEIGHT = 0x2, ///< Height dimension @SINCE_1_0.0
+ WIDTH = 0x1, ///< Width dimension @SINCE_1_0.0
+ HEIGHT = 0x2, ///< Height dimension @SINCE_1_0.0
- ALL_DIMENSIONS = 0x3 ///< Mask to cover all flags @SINCE_1_0.0
+ ALL_DIMENSIONS = 0x3 ///< Mask to cover all flags @SINCE_1_0.0
};
/**
*/
enum Meta
{
- DIMENSION_COUNT = 2 ///< Number of dimensions - update this if adding new dimension @SINCE_1_0.0
+ DIMENSION_COUNT = 2 ///< Number of dimensions - update this if adding new dimension @SINCE_1_0.0
};
} // namespace Dimension
*/
namespace ResizePolicy
{
-
/**
* @brief Enumeration for ResizePolicy types.
* @SINCE_1_0.0
*/
enum Type
{
- FIXED, ///< Size is fixed as set by SetSize @SINCE_1_0.0
- USE_NATURAL_SIZE, ///< Size is to use the actor's natural size @SINCE_1_0.0 @see Actor::GetNaturalSize()
- FILL_TO_PARENT, ///< Size is to fill up to the actor's parent's bounds. Aspect ratio is not maintained. @SINCE_1_0.0
- SIZE_RELATIVE_TO_PARENT, ///< The actors size will be ( ParentSize * SizeRelativeToParentFactor ). @SINCE_1_0.0
- SIZE_FIXED_OFFSET_FROM_PARENT, ///< The actors size will be ( ParentSize + SizeRelativeToParentFactor ). @SINCE_1_0.0
- FIT_TO_CHILDREN, ///< Size will adjust to wrap around all children @SINCE_1_0.0
- DIMENSION_DEPENDENCY, ///< One dimension is dependent on the other @SINCE_1_0.0
- USE_ASSIGNED_SIZE ///< The size will be assigned to the actor @SINCE_1_0.0
+ FIXED, ///< Size is fixed as set by SetSize @SINCE_1_0.0
+ USE_NATURAL_SIZE, ///< Size is to use the actor's natural size @SINCE_1_0.0 @see Actor::GetNaturalSize()
+ FILL_TO_PARENT, ///< Size is to fill up to the actor's parent's bounds. Aspect ratio is not maintained. @SINCE_1_0.0
+ SIZE_RELATIVE_TO_PARENT, ///< The actors size will be ( ParentSize * SizeRelativeToParentFactor ). @SINCE_1_0.0
+ SIZE_FIXED_OFFSET_FROM_PARENT, ///< The actors size will be ( ParentSize + SizeRelativeToParentFactor ). @SINCE_1_0.0
+ FIT_TO_CHILDREN, ///< Size will adjust to wrap around all children @SINCE_1_0.0
+ DIMENSION_DEPENDENCY, ///< One dimension is dependent on the other @SINCE_1_0.0
+ USE_ASSIGNED_SIZE ///< The size will be assigned to the actor @SINCE_1_0.0
};
const Type DEFAULT = USE_NATURAL_SIZE; ///< Default resize policy
*/
namespace SizeScalePolicy
{
-
/**
* @brief Enumeration for SizeScalePolicy types.
* @SINCE_1_0.0
*/
enum Type
{
- USE_SIZE_SET, ///< Use the size that was set @SINCE_1_0.0
- FIT_WITH_ASPECT_RATIO, ///< Fit within the size set maintaining natural size aspect ratio @SINCE_1_0.0
- FILL_WITH_ASPECT_RATIO ///< Fill up the size set maintaining natural size aspect ratio. May exceed size bounds in one dimension. @SINCE_1_0.0
+ USE_SIZE_SET, ///< Use the size that was set @SINCE_1_0.0
+ FIT_WITH_ASPECT_RATIO, ///< Fit within the size set maintaining natural size aspect ratio @SINCE_1_0.0
+ FILL_WITH_ASPECT_RATIO ///< Fill up the size set maintaining natural size aspect ratio. May exceed size bounds in one dimension. @SINCE_1_0.0
};
} // namespace SizeScalePolicy
*/
namespace HorizontalAlignment
{
-
/**
* @brief Enumeration for HorizontalAlignment types.
* @SINCE_1_0.0
*/
enum Type
{
- LEFT, ///< Align horizontally left @SINCE_1_0.0
- CENTER, ///< Align horizontally center @SINCE_1_0.0
- RIGHT ///< Align horizontally right @SINCE_1_0.0
+ LEFT, ///< Align horizontally left @SINCE_1_0.0
+ CENTER, ///< Align horizontally center @SINCE_1_0.0
+ RIGHT ///< Align horizontally right @SINCE_1_0.0
};
} // namespace HorizontalAlignment
*/
namespace VerticalAlignment
{
-
/**
* @brief Enumeration for VerticalAlignment types.
* @SINCE_1_0.0
*/
enum Type
{
- TOP, ///< Align vertically top @SINCE_1_0.0
- CENTER, ///< Align vertically center @SINCE_1_0.0
- BOTTOM ///< Align vertically bottom @SINCE_1_0.0
+ TOP, ///< Align vertically top @SINCE_1_0.0
+ CENTER, ///< Align vertically center @SINCE_1_0.0
+ BOTTOM ///< Align vertically bottom @SINCE_1_0.0
};
} // namespace VerticalAlignment
*/
enum Type
{
- DISABLED, ///< This Actor will not clip its children. @SINCE_1_2_5
- CLIP_CHILDREN, ///< This Actor will clip itself and all children to within the pixel areas of this actors renderers. @SINCE_1_2_5
- CLIP_TO_BOUNDING_BOX ///< This Actor will clip itself and all children to within a screen-aligned rectangle encompassing its boundaries. @SINCE_1_2.61
+ DISABLED, ///< This Actor will not clip its children. @SINCE_1_2_5
+ CLIP_CHILDREN, ///< This Actor will clip itself and all children to within the pixel areas of this actors renderers. @SINCE_1_2_5
+ CLIP_TO_BOUNDING_BOX ///< This Actor will clip itself and all children to within a screen-aligned rectangle encompassing its boundaries. @SINCE_1_2.61
};
} // namespace ClippingMode
*/
namespace LayoutDirection
{
-
/**
* @brief Enumeration for the LayoutDirection types.
* @SINCE_1_2.60
*/
enum Type
{
- LEFT_TO_RIGHT, ///< Layout direction is from Left to Right direction. @SINCE_1_2.60
- RIGHT_TO_LEFT ///< Layout direction is from Right to Left direction. @SINCE_1_2.60
+ LEFT_TO_RIGHT, ///< Layout direction is from Left to Right direction. @SINCE_1_2.60
+ RIGHT_TO_LEFT ///< Layout direction is from Right to Left direction. @SINCE_1_2.60
};
} // namespace LayoutDirection
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/rendering/renderer-impl.h>
#include <dali/internal/event/animation/constraint-impl.h>
+#include <dali/internal/event/rendering/renderer-impl.h>
#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
namespace Dali
{
-
Actor::Actor()
{
}
return Actor(internal.Get());
}
-Actor Actor::DownCast( BaseHandle handle )
+Actor Actor::DownCast(BaseHandle handle)
{
- return Actor( dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()) );
+ return Actor(dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()));
}
Actor::~Actor()
Actor& Actor::operator=(const Actor& rhs) = default;
-Actor::Actor( Actor&& rhs ) = default;
+Actor::Actor(Actor&& rhs) = default;
-Actor& Actor::operator=( Actor&& rhs ) = default;
+Actor& Actor::operator=(Actor&& rhs) = default;
Layer Actor::GetLayer()
{
return GetImplementation(*this).GetChildCount();
}
-Actor Actor::GetChildAt( uint32_t index ) const
+Actor Actor::GetChildAt(uint32_t index) const
{
- Internal::ActorPtr child = GetImplementation(*this).GetChildAt( index );
- return Actor( child.Get() );
+ Internal::ActorPtr child = GetImplementation(*this).GetChildAt(index);
+ return Actor(child.Get());
}
Actor Actor::FindChildByName(const std::string& actorName)
{
- Internal::ActorPtr child = GetImplementation(*this).FindChildByName( actorName );
- return Actor( child.Get() );
+ Internal::ActorPtr child = GetImplementation(*this).FindChildByName(actorName);
+ return Actor(child.Get());
}
-Actor Actor::FindChildById( const uint32_t id )
+Actor Actor::FindChildById(const uint32_t id)
{
- Internal::ActorPtr child = GetImplementation(*this).FindChildById( id );
- return Actor( child.Get() );
+ Internal::ActorPtr child = GetImplementation(*this).FindChildById(id);
+ return Actor(child.Get());
}
Actor Actor::GetParent() const
void Actor::Raise()
{
- GetImplementation( *this ).Raise();
+ GetImplementation(*this).Raise();
}
void Actor::Lower()
{
- GetImplementation( *this ).Lower();
+ GetImplementation(*this).Lower();
}
void Actor::RaiseToTop()
{
- GetImplementation( *this ).RaiseToTop();
+ GetImplementation(*this).RaiseToTop();
}
void Actor::LowerToBottom()
{
- GetImplementation( *this ).LowerToBottom();
+ GetImplementation(*this).LowerToBottom();
}
-void Actor::RaiseAbove( Actor target )
+void Actor::RaiseAbove(Actor target)
{
- GetImplementation( *this ).RaiseAbove( GetImplementation( target ) );
+ GetImplementation(*this).RaiseAbove(GetImplementation(target));
}
-void Actor::LowerBelow( Actor target )
+void Actor::LowerBelow(Actor target)
{
- GetImplementation( *this ).LowerBelow( GetImplementation( target ) );
+ GetImplementation(*this).LowerBelow(GetImplementation(target));
}
-void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+void Actor::SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
{
- GetImplementation(*this).SetResizePolicy( policy, dimension );
+ GetImplementation(*this).SetResizePolicy(policy, dimension);
}
-ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
+ResizePolicy::Type Actor::GetResizePolicy(Dimension::Type dimension) const
{
- return GetImplementation(*this).GetResizePolicy( dimension );
+ return GetImplementation(*this).GetResizePolicy(dimension);
}
-float Actor::GetHeightForWidth( float width )
+float Actor::GetHeightForWidth(float width)
{
- return GetImplementation(*this).GetHeightForWidth( width );
+ return GetImplementation(*this).GetHeightForWidth(width);
}
-float Actor::GetWidthForHeight( float height )
+float Actor::GetWidthForHeight(float height)
{
- return GetImplementation(*this).GetWidthForHeight( height );
+ return GetImplementation(*this).GetWidthForHeight(height);
}
-float Actor::GetRelayoutSize( Dimension::Type dimension ) const
+float Actor::GetRelayoutSize(Dimension::Type dimension) const
{
- return GetImplementation(*this).GetRelayoutSize( dimension );
+ return GetImplementation(*this).GetRelayoutSize(dimension);
}
Actor::TouchEventSignalType& Actor::TouchedSignal()
{
- return GetImplementation( *this ).TouchedSignal();
+ return GetImplementation(*this).TouchedSignal();
}
Actor::HoverSignalType& Actor::HoveredSignal()
return GetImplementation(*this).OffSceneSignal();
}
-uint32_t Actor::AddRenderer( Renderer& renderer )
+uint32_t Actor::AddRenderer(Renderer& renderer)
{
- return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
+ return GetImplementation(*this).AddRenderer(GetImplementation(renderer));
}
uint32_t Actor::GetRendererCount() const
return GetImplementation(*this).GetRendererCount();
}
-Renderer Actor::GetRendererAt( uint32_t index )
+Renderer Actor::GetRendererAt(uint32_t index)
{
- Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
- return Renderer( renderer.Get() );
+ Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt(index);
+ return Renderer(renderer.Get());
}
-void Actor::RemoveRenderer( Renderer& renderer )
+void Actor::RemoveRenderer(Renderer& renderer)
{
- GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
+ GetImplementation(*this).RemoveRenderer(GetImplementation(renderer));
}
-void Actor::RemoveRenderer( uint32_t index )
+void Actor::RemoveRenderer(uint32_t index)
{
- GetImplementation(*this).RemoveRenderer( index );
+ GetImplementation(*this).RemoveRenderer(index);
}
Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
{
- return GetImplementation( *this ).LayoutDirectionChangedSignal();
+ return GetImplementation(*this).LayoutDirectionChangedSignal();
}
Actor::Actor(Internal::Actor* internal)
*/
// EXTERNAL INCLUDES
-#include <string>
#include <cstdint> // uint32_t
+#include <string>
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor-enumerations.h>
class DALI_CORE_API Actor : public Handle
{
public:
-
/**
* @brief Enumeration for the instance of properties belonging to the Actor class.
* @SINCE_1_0.0
// Typedefs
- using TouchEventSignalType = Signal<bool( Actor, const TouchEvent& )>; ///< Touch signal type @SINCE_1_1.37
- using HoverSignalType = Signal<bool( Actor, const HoverEvent& )>; ///< Hover signal type @SINCE_1_0.0
- using WheelEventSignalType = Signal<bool( Actor, const WheelEvent& )>; ///< Wheel signal type @SINCE_1_0.0
- using OnSceneSignalType = Signal<void( Actor )>; ///< Scene connection signal type @SINCE_1_9.24
- using OffSceneSignalType = Signal<void( Actor )>; ///< Scene disconnection signal type @SINCE_1_9.24
- using OnRelayoutSignalType = Signal<void( Actor )>; ///< Called when the actor is relaid out @SINCE_1_0.0
- using LayoutDirectionChangedSignalType = Signal<void( Actor, LayoutDirection::Type )>; ///< Layout direction changes signal type. @SINCE_1_2.60
+ using TouchEventSignalType = Signal<bool(Actor, const TouchEvent&)>; ///< Touch signal type @SINCE_1_1.37
+ using HoverSignalType = Signal<bool(Actor, const HoverEvent&)>; ///< Hover signal type @SINCE_1_0.0
+ using WheelEventSignalType = Signal<bool(Actor, const WheelEvent&)>; ///< Wheel signal type @SINCE_1_0.0
+ using OnSceneSignalType = Signal<void(Actor)>; ///< Scene connection signal type @SINCE_1_9.24
+ using OffSceneSignalType = Signal<void(Actor)>; ///< Scene disconnection signal type @SINCE_1_9.24
+ using OnRelayoutSignalType = Signal<void(Actor)>; ///< Called when the actor is relaid out @SINCE_1_0.0
+ using LayoutDirectionChangedSignalType = Signal<void(Actor, LayoutDirection::Type)>; ///< Layout direction changes signal type. @SINCE_1_2.60
// Creation
* @param[in] handle to An object
* @return handle to a Actor object or an uninitialized handle
*/
- static Actor DownCast( BaseHandle handle );
+ static Actor DownCast(BaseHandle handle);
/**
* @brief Dali::Actor is intended as a base class.
* @SINCE_1_9.22
* @param[in] rhs A reference to the actor to move
*/
- Actor( Actor&& rhs );
+ Actor(Actor&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the actor to move
* @return A reference to this
*/
- Actor& operator=( Actor&& rhs );
+ Actor& operator=(Actor&& rhs);
// Containment
* @return The actor for the given index or empty handle if children not initialized
* @pre The Actor has been initialized.
*/
- Actor GetChildAt( uint32_t index ) const;
+ Actor GetChildAt(uint32_t index) const;
/**
* @brief Search through this actor's hierarchy for an actor with the given name.
* @return A handle to the actor if found, or an empty handle if not
* @pre The Actor has been initialized.
*/
- Actor FindChildById( const uint32_t id );
+ Actor FindChildById(const uint32_t id);
/**
* @brief Retrieves the actor's parent.
* @param[in] axis The axis of the rotation to combine with the existing orientation
* @pre The actor has been initialized.
*/
- void RotateBy( const Degree& angle, const Vector3& axis )
+ void RotateBy(const Degree& angle, const Vector3& axis)
{
- RotateBy( Radian( angle ), axis );
+ RotateBy(Radian(angle), axis);
}
/**
* @pre The Actor has been parented.
* @pre The target actor is a sibling.
*/
- void RaiseAbove( Actor target );
+ void RaiseAbove(Actor target);
/**
* @brief Lower the actor to below the target actor.
* @pre The Actor has been parented.
* @pre The target actor is a sibling.
*/
- void LowerBelow( Actor target );
+ void LowerBelow(Actor target);
// SIZE NEGOTIATION
* @param[in] policy The resize policy to use
* @param[in] dimension The dimension(s) to set policy for. Can be a bitfield of multiple dimensions
*/
- void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
+ void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension);
/**
* @brief Returns the resize policy used for a single dimension.
* @param[in] dimension The dimension to get policy for
* @return Return the dimension resize policy. If more than one dimension is requested, just return the first one found
*/
- ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
+ ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
/**
* @brief Calculates the height of the actor given a width.
* @param[in] width Width to use
* @return Return the height based on the width
*/
- float GetHeightForWidth( float width );
+ float GetHeightForWidth(float width);
/**
* @brief Calculates the width of the actor given a height.
* @param[in] height Height to use
* @return Return the width based on the height
*/
- float GetWidthForHeight( float height );
+ float GetWidthForHeight(float height);
/**
* @brief Returns the value of negotiated dimension for the given dimension.
* @param[in] dimension The dimension to retrieve
* @return Return the value of the negotiated dimension. If more than one dimension is requested, just return the first one found
*/
- float GetRelayoutSize( Dimension::Type dimension ) const;
+ float GetRelayoutSize(Dimension::Type dimension) const;
public: // Renderer
-
/**
* @brief Adds a renderer to this actor.
*
* @pre The renderer must be initialized.
*
*/
- uint32_t AddRenderer( Renderer& renderer );
+ uint32_t AddRenderer(Renderer& renderer);
/**
* @brief Gets the number of renderers on this actor.
* @pre The index must be between 0 and GetRendererCount()-1
*
*/
- Renderer GetRendererAt( uint32_t index );
+ Renderer GetRendererAt(uint32_t index);
/**
* @brief Removes a renderer from the actor.
* @SINCE_1_0.0
* @param[in] renderer Handle to the renderer that is to be removed
*/
- void RemoveRenderer( Renderer& renderer );
+ void RemoveRenderer(Renderer& renderer);
/**
* @brief Removes a renderer from the actor by index.
* @pre The index must be between 0 and GetRendererCount()-1
*
*/
- void RemoveRenderer( uint32_t index );
+ void RemoveRenderer(uint32_t index);
public: // Signals
-
/**
* @brief This signal is emitted when touch input is received.
*
LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal();
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Actor::New() methods.
* @SINCE_1_0.0
* @param[in,out] actor A handle to an actor, or an empty handle
*/
-inline void UnparentAndReset( Actor& actor )
+inline void UnparentAndReset(Actor& actor)
{
- if( actor )
+ if(actor)
{
actor.Unparent();
actor.Reset();
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
CameraActor CameraActor::New()
{
- Internal::CameraActorPtr internal = Internal::CameraActor::New( Size::ZERO );
+ Internal::CameraActorPtr internal = Internal::CameraActor::New(Size::ZERO);
return CameraActor(internal.Get());
}
-
-CameraActor CameraActor::New( const Size& size )
+CameraActor CameraActor::New(const Size& size)
{
- Internal::CameraActorPtr internal = Internal::CameraActor::New( size );
+ Internal::CameraActorPtr internal = Internal::CameraActor::New(size);
return CameraActor(internal.Get());
}
{
}
-CameraActor CameraActor::DownCast( BaseHandle handle )
+CameraActor CameraActor::DownCast(BaseHandle handle)
{
- return CameraActor( dynamic_cast<Dali::Internal::CameraActor*>(handle.GetObjectPtr()) );
+ return CameraActor(dynamic_cast<Dali::Internal::CameraActor*>(handle.GetObjectPtr()));
}
CameraActor::CameraActor()
return *this;
}
-void CameraActor::SetType( Dali::Camera::Type type )
+void CameraActor::SetType(Dali::Camera::Type type)
{
GetImplementation(*this).SetType(type);
}
return GetImplementation(*this).GetType();
}
-void CameraActor::SetProjectionMode( Dali::Camera::ProjectionMode mode )
+void CameraActor::SetProjectionMode(Dali::Camera::ProjectionMode mode)
{
- GetImplementation(*this).SetProjectionMode( mode );
+ GetImplementation(*this).SetProjectionMode(mode);
}
Dali::Camera::ProjectionMode CameraActor::GetProjectionMode() const
return GetImplementation(*this).GetProjectionMode();
}
-void CameraActor::SetFieldOfView( float fieldOfView )
+void CameraActor::SetFieldOfView(float fieldOfView)
{
GetImplementation(*this).SetFieldOfView(fieldOfView);
}
-float CameraActor::GetFieldOfView( )
+float CameraActor::GetFieldOfView()
{
return GetImplementation(*this).GetFieldOfView();
}
-void CameraActor::SetAspectRatio( float aspectRatio )
+void CameraActor::SetAspectRatio(float aspectRatio)
{
GetImplementation(*this).SetAspectRatio(aspectRatio);
}
-float CameraActor::GetAspectRatio( )
+float CameraActor::GetAspectRatio()
{
return GetImplementation(*this).GetAspectRatio();
}
-void CameraActor::SetNearClippingPlane( float nearClippingPlane )
+void CameraActor::SetNearClippingPlane(float nearClippingPlane)
{
GetImplementation(*this).SetNearClippingPlane(nearClippingPlane);
}
-float CameraActor::GetNearClippingPlane( )
+float CameraActor::GetNearClippingPlane()
{
return GetImplementation(*this).GetNearClippingPlane();
}
-void CameraActor::SetFarClippingPlane( float farClippingPlane )
+void CameraActor::SetFarClippingPlane(float farClippingPlane)
{
GetImplementation(*this).SetFarClippingPlane(farClippingPlane);
}
-float CameraActor::GetFarClippingPlane( )
+float CameraActor::GetFarClippingPlane()
{
return GetImplementation(*this).GetFarClippingPlane();
}
-void CameraActor::SetTargetPosition( const Vector3& targetPosition )
+void CameraActor::SetTargetPosition(const Vector3& targetPosition)
{
GetImplementation(*this).SetTarget(targetPosition);
}
return GetImplementation(*this).GetInvertYAxis();
}
-void CameraActor::SetPerspectiveProjection( const Size& size )
+void CameraActor::SetPerspectiveProjection(const Size& size)
{
- GetImplementation(*this).SetPerspectiveProjection( size );
+ GetImplementation(*this).SetPerspectiveProjection(size);
}
-void CameraActor::SetOrthographicProjection( const Vector2& size )
+void CameraActor::SetOrthographicProjection(const Vector2& size)
{
- GetImplementation(*this).SetOrthographicProjection( size );
+ GetImplementation(*this).SetOrthographicProjection(size);
}
-void CameraActor::SetOrthographicProjection( float left, float right, float top, float bottom, float near, float far )
+void CameraActor::SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
{
- GetImplementation(*this).SetOrthographicProjection( left, right, top, bottom, near, far );
+ GetImplementation(*this).SetOrthographicProjection(left, right, top, bottom, near, far);
}
} // namespace Dali
#define DALI_CAMERA_ACTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
enum ProjectionMode
{
- PERSPECTIVE_PROJECTION, ///< Distance causes foreshortening; objects further from the camera appear smaller @SINCE_1_0.0
- ORTHOGRAPHIC_PROJECTION, ///< Relative distance from the camera does not affect the size of objects @SINCE_1_0.0
+ PERSPECTIVE_PROJECTION, ///< Distance causes foreshortening; objects further from the camera appear smaller @SINCE_1_0.0
+ ORTHOGRAPHIC_PROJECTION, ///< Relative distance from the camera does not affect the size of objects @SINCE_1_0.0
};
} // namespace Camera
class DALI_CORE_API CameraActor : public Actor
{
public:
-
/**
* @brief Enumeration for the instance of properties belonging to the CameraActor class.
*
* @param[in] size The canvas size
* @return The newly created camera actor
*/
- static CameraActor New( const Size& size );
+ static CameraActor New(const Size& size);
/**
* @brief Downcasts a handle to CameraActor handle.
* @param[in] handle to An object
* @return Handle to a CameraActor or an uninitialized handle
*/
- static CameraActor DownCast( BaseHandle handle );
+ static CameraActor DownCast(BaseHandle handle);
/**
* @brief Destructor.
* @SINCE_1_0.0
* @param[in] type The camera type
*/
- void SetType( Dali::Camera::Type type );
+ void SetType(Dali::Camera::Type type);
/**
* @brief Gets the type of the camera.
* @SINCE_1_0.0
* @param[in] mode One of PERSPECTIVE_PROJECTION or ORTHOGRAPHIC_PROJECTION
*/
- void SetProjectionMode( Dali::Camera::ProjectionMode mode );
+ void SetProjectionMode(Dali::Camera::ProjectionMode mode);
/**
* @brief Gets the projection mode.
* @SINCE_1_0.0
* @param[in] fieldOfView The field of view in radians
*/
- void SetFieldOfView( float fieldOfView );
+ void SetFieldOfView(float fieldOfView);
/**
* @brief Gets the field of view in Radians.
* @SINCE_1_0.0
* @return The field of view in radians
*/
- float GetFieldOfView( );
+ float GetFieldOfView();
/**
* @brief Sets the aspect ratio.
* @SINCE_1_0.0
* @param[in] aspectRatio The aspect ratio
*/
- void SetAspectRatio( float aspectRatio );
+ void SetAspectRatio(float aspectRatio);
/**
* @brief Gets the aspect ratio of the camera.
* @SINCE_1_0.0
* @return The aspect ratio
*/
- float GetAspectRatio( );
+ float GetAspectRatio();
/**
* @brief Sets the near clipping plane distance.
* @SINCE_1_0.0
* @param[in] nearClippingPlane Distance of the near clipping plane
*/
- void SetNearClippingPlane( float nearClippingPlane );
+ void SetNearClippingPlane(float nearClippingPlane);
/**
* @brief Gets the near clipping plane distance.
* @SINCE_1_0.0
* @return The near clipping plane value
*/
- float GetNearClippingPlane( );
+ float GetNearClippingPlane();
/**
* @brief Sets the far clipping plane distance.
* @SINCE_1_0.0
* @param[in] farClippingPlane Distance of the far clipping plane
*/
- void SetFarClippingPlane( float farClippingPlane );
+ void SetFarClippingPlane(float farClippingPlane);
/**
* @brief Gets the far clipping plane distance.
* @SINCE_1_0.0
* @return The far clipping plane value
*/
- float GetFarClippingPlane( );
+ float GetFarClippingPlane();
/**
* @brief Sets the target position of the camera.
* @param[in] targetPosition The position of the target to look at
* @pre Camera type is LOOK_AT_TARGET.
*/
- void SetTargetPosition( const Vector3& targetPosition );
+ void SetTargetPosition(const Vector3& targetPosition);
/**
* @brief Gets the Camera Target position.
* @note If either of the values of size is 0.0f, then we use the default perspective projection for the size of the scene this actor is added to.
* @note This modifies the Z position property of this actor as well.
*/
- void SetPerspectiveProjection( const Size& size );
+ void SetPerspectiveProjection(const Size& size);
/**
* @brief Sets the camera projection to use orthographic projection.
* @SINCE_1_0.0
* @param[in] size Size of XY plane (normal to camera axis)
*/
- void SetOrthographicProjection( const Size& size );
+ void SetOrthographicProjection(const Size& size);
/**
* @brief Sets the camera projection to use orthographic projection with the given clip planes.
* @param[in] near Distance to the near clip plane (along camera axis)
* @param[in] far Distance to the far clip plane (along camera axis)
*/
- void SetOrthographicProjection( float left, float right, float top, float bottom, float near, float far );
+ void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far);
public: // Not intended for use by Application developers
/// @cond internal
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/actors/custom-actor-impl.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/internal/event/actors/custom-actor-internal.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
CustomActor CustomActorImpl::Self() const
{
return CustomActor(mOwner);
}
-void CustomActorImpl::OnPropertySet( Property::Index index, const Property::Value& propertyValue )
+void CustomActorImpl::OnPropertySet(Property::Index index, const Property::Value& propertyValue)
{
}
-CustomActorImpl::CustomActorImpl( ActorFlags flags )
+CustomActorImpl::CustomActorImpl(ActorFlags flags)
: mOwner(nullptr),
- mFlags( flags )
+ mFlags(flags)
{
}
bool CustomActorImpl::IsRelayoutEnabled() const
{
- return ( mFlags & DISABLE_SIZE_NEGOTIATION ) == 0;
+ return (mFlags & DISABLE_SIZE_NEGOTIATION) == 0;
}
void CustomActorImpl::RelayoutRequest()
mOwner->RelayoutRequest();
}
-float CustomActorImpl::GetHeightForWidthBase( float width )
+float CustomActorImpl::GetHeightForWidthBase(float width)
{
- return mOwner->GetHeightForWidthBase( width );
+ return mOwner->GetHeightForWidthBase(width);
}
-float CustomActorImpl::GetWidthForHeightBase( float height )
+float CustomActorImpl::GetWidthForHeightBase(float height)
{
- return mOwner->GetWidthForHeightBase( height );
+ return mOwner->GetWidthForHeightBase(height);
}
-float CustomActorImpl::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
+float CustomActorImpl::CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension)
{
- return mOwner->CalculateChildSizeBase( child, dimension );
+ return mOwner->CalculateChildSizeBase(child, dimension);
}
-bool CustomActorImpl::RelayoutDependentOnChildrenBase( Dimension::Type dimension )
+bool CustomActorImpl::RelayoutDependentOnChildrenBase(Dimension::Type dimension)
{
- return mOwner->RelayoutDependentOnChildrenBase( dimension );
+ return mOwner->RelayoutDependentOnChildrenBase(dimension);
}
} // namespace Dali
#include <cstdint> // uint32_t
// INTERNAL INCLUDES
-#include <dali/public-api/object/property.h>
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/actors/actor-enumerations.h>
#include <dali/public-api/math/compile-time-math.h>
+#include <dali/public-api/object/property.h>
+#include <dali/public-api/object/ref-object.h>
namespace Dali
{
class DALI_CORE_API CustomActorImpl : public Dali::RefObject
{
public:
-
class Extension; ///< Forward declare future extension interface
protected:
* @endcode
* @param[in] depth The depth in the hierarchy for the actor
*/
- virtual void OnSceneConnection( int32_t depth ) = 0;
+ virtual void OnSceneConnection(int32_t depth) = 0;
/**
* @brief Called after the actor has been disconnected from the Scene.
* @param[in] index The Property index that was set
* @param[in] propertyValue The value to set
*/
- virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue );
+ virtual void OnPropertySet(Property::Index index, const Property::Value& propertyValue);
/**
* @brief Called when the owning actor's size is set e.g. using Actor::SetSize().
* @note As this function is called from inside the size negotiation algorithm, you cannot
* call RequestRelayout (the call would just be ignored).
*/
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) = 0;
+ virtual void OnRelayout(const Vector2& size, RelayoutContainer& container) = 0;
/**
* @brief Notification for deriving classes.
* @param[in] policy The policy being set
* @param[in] dimension The dimension the policy is being set for
*/
- virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) = 0;
+ virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) = 0;
/**
* @brief Returns the natural size of the actor.
* @param[in] dimension The dimension to calculate the size for. E.g. width or height
* @return Return the calculated size for the given dimension
*/
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) = 0;
+ virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) = 0;
/**
* @brief This method is called during size negotiation when a height is required for a given width.
* @param[in] width Width to use
* @return The height based on the width
*/
- virtual float GetHeightForWidth( float width ) = 0;
+ virtual float GetHeightForWidth(float width) = 0;
/**
* @brief This method is called during size negotiation when a width is required for a given height.
* @param[in] height Height to use
* @return The width based on the width
*/
- virtual float GetWidthForHeight( float height ) = 0;
+ virtual float GetWidthForHeight(float height) = 0;
/**
* @brief Determines if this actor is dependent on its children for relayout.
* @param[in] dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) = 0;
+ virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) = 0;
/**
* @brief Virtual method to notify deriving classes that relayout dependencies have been
* @SINCE_1_0.0
* @param[in] dimension The dimension that is about to be calculated
*/
- virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) = 0;
+ virtual void OnCalculateRelayoutSize(Dimension::Type dimension) = 0;
/**
* @brief Virtual method to notify deriving classes that the size for a dimension
* @param[in] size The new size for the given dimension
* @param[in] dimension The dimension that was just negotiated
*/
- virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) = 0;
+ virtual void OnLayoutNegotiated(float size, Dimension::Type dimension) = 0;
/**
* @brief Retrieves the extension for this control.
}
protected: // For derived classes
-
/**
* @brief Enumeration for the constructor flags.
* @SINCE_1_0.0
*/
enum ActorFlags
{
- ACTOR_BEHAVIOUR_DEFAULT = 0, ///< Use to provide default behaviour (size negotiation is on, event callbacks are not called). @SINCE_1_2_10
- DISABLE_SIZE_NEGOTIATION = 1 << 0, ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm @SINCE_1_0.0
+ ACTOR_BEHAVIOUR_DEFAULT = 0, ///< Use to provide default behaviour (size negotiation is on, event callbacks are not called). @SINCE_1_2_10
+ DISABLE_SIZE_NEGOTIATION = 1 << 0, ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm @SINCE_1_0.0
- LAST_ACTOR_FLAG ///< Special marker for last actor flag @SINCE_1_0.0
+ LAST_ACTOR_FLAG ///< Special marker for last actor flag @SINCE_1_0.0
};
- static constexpr int32_t ACTOR_FLAG_COUNT = Log< LAST_ACTOR_FLAG - 1 >::value + 1; ///< Value for deriving classes to continue on the flag enum
+ static constexpr int32_t ACTOR_FLAG_COUNT = Log<LAST_ACTOR_FLAG - 1>::value + 1; ///< Value for deriving classes to continue on the flag enum
/**
* @brief Creates a CustomActorImpl.
* @SINCE_1_0.0
* @param[in] flags Bitfield of ActorFlags to define behaviour
*/
- CustomActorImpl( ActorFlags flags );
+ CustomActorImpl(ActorFlags flags);
// Size negotiation helpers
* @param[in] width Width to use
* @return The height based on the width
*/
- float GetHeightForWidthBase( float width );
+ float GetHeightForWidthBase(float width);
/**
* @brief Provides the Actor implementation of GetWidthForHeight.
* @param[in] height Height to use
* @return The width based on the height
*/
- float GetWidthForHeightBase( float height );
+ float GetWidthForHeightBase(float height);
/**
* @brief Calculates the size for a child using the base actor object.
* @param[in] dimension The dimension to calculate the size for. E.g. width or height
* @return Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found
*/
- float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
+ float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension);
/**
* @brief Determines if this actor is dependent on its children for relayout from the base class.
* @param[in] dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
public: // Not intended for application developers
-
/**
* @brief Initializes a CustomActor.
* @SINCE_1_0.0
bool IsRelayoutEnabled() const;
private:
-
- Internal::CustomActor* mOwner; ///< Internal owner of this custom actor implementation
- ActorFlags mFlags; ///< ActorFlags flags to determine behaviour
+ Internal::CustomActor* mOwner; ///< Internal owner of this custom actor implementation
+ ActorFlags mFlags; ///< ActorFlags flags to determine behaviour
};
/**
namespace Dali
{
-
namespace
{
-
using namespace Dali;
BaseHandle Create()
return BaseHandle();
}
-TypeRegistration mType( typeid(Dali::CustomActor), typeid(Dali::Actor), Create );
+TypeRegistration mType(typeid(Dali::CustomActor), typeid(Dali::Actor), Create);
-}
+} // namespace
CustomActor::CustomActor()
{
}
-CustomActor CustomActor::DownCast( BaseHandle handle )
+CustomActor CustomActor::DownCast(BaseHandle handle)
{
- return CustomActor( dynamic_cast<Dali::Internal::CustomActor*>(handle.GetObjectPtr()) );
+ return CustomActor(dynamic_cast<Dali::Internal::CustomActor*>(handle.GetObjectPtr()));
}
CustomActor::~CustomActor()
CustomActor& CustomActor::operator=(const CustomActor& rhs) = default;
-CustomActor::CustomActor( CustomActor&& rhs ) = default;
+CustomActor::CustomActor(CustomActor&& rhs) = default;
-CustomActor& CustomActor::operator=( CustomActor&& rhs ) = default;
+CustomActor& CustomActor::operator=(CustomActor&& rhs) = default;
CustomActorImpl& CustomActor::GetImplementation()
{
// Without this check, the actor will be deleted a second time, when the handle is disposed of
// causing a crash.
- if (internal)
+ if(internal)
{
DALI_ASSERT_ALWAYS(internal->ReferenceCount() != 1 && "Are you trying to use CustomActorImpl::Self() inside a CustomActorImpl destructor?");
}
class DALI_CORE_API CustomActor : public Actor
{
public:
-
/**
* @brief Creates an uninitialized CustomActor handle.
*
* @param[in] handle Handle to an object
* @return Handle to a CustomActor or an uninitialized handle
*/
- static CustomActor DownCast( BaseHandle handle );
+ static CustomActor DownCast(BaseHandle handle);
/**
* @brief Destructor.
* @SINCE_1_9.22
* @param[in] rhs The actor to move
*/
- CustomActor( CustomActor&& rhs );
+ CustomActor(CustomActor&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs The actor to move
* @return A reference to this
*/
- CustomActor& operator=( CustomActor&& rhs );
+ CustomActor& operator=(CustomActor&& rhs);
public: // Not intended for application developers
-
/**
* @brief This constructor is used internally to create additional CustomActor handles.
*
#define DALI_DRAW_MODE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
namespace DrawMode
{
-
/**
* @brief Enumeration for the instance of how the actor and it's children will be drawn.
*
namespace Dali
{
-
using Dali::Layer;
Layer::Layer()
return Layer(internal.Get());
}
-Layer Layer::DownCast( BaseHandle handle )
+Layer Layer::DownCast(BaseHandle handle)
{
- return Layer( dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()) );
+ return Layer(dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()));
}
Layer::~Layer()
Layer& Layer::operator=(const Layer& rhs) = default;
-Layer::Layer( Layer&& rhs ) = default;
+Layer::Layer(Layer&& rhs) = default;
-Layer& Layer::operator=( Layer&& rhs ) = default;
+Layer& Layer::operator=(Layer&& rhs) = default;
void Layer::Raise()
{
GetImplementation(*this).Lower();
}
-void Layer::RaiseAbove( Layer target )
+void Layer::RaiseAbove(Layer target)
{
- GetImplementation(*this).RaiseAbove( GetImplementation( target ) );
+ GetImplementation(*this).RaiseAbove(GetImplementation(target));
}
-void Layer::LowerBelow( Layer target )
+void Layer::LowerBelow(Layer target)
{
- GetImplementation(*this).LowerBelow( GetImplementation( target ) );
+ GetImplementation(*this).LowerBelow(GetImplementation(target));
}
void Layer::RaiseToTop()
GetImplementation(*this).LowerToBottom();
}
-void Layer::MoveAbove( Layer target )
+void Layer::MoveAbove(Layer target)
{
- GetImplementation(*this).MoveAbove( GetImplementation( target ) );
+ GetImplementation(*this).MoveAbove(GetImplementation(target));
}
-void Layer::MoveBelow( Layer target )
+void Layer::MoveBelow(Layer target)
{
- GetImplementation(*this).MoveBelow( GetImplementation( target ) );
+ GetImplementation(*this).MoveBelow(GetImplementation(target));
}
void Layer::SetSortFunction(SortFunctionType function)
#include <cstdint> // uint32_t
// INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/vector3.h>
+#include <dali/public-api/object/ref-object.h>
namespace Dali
{
class DALI_CORE_API Layer : public Actor
{
public:
-
/**
* @brief Enumeration for the instance of properties belonging to the Layer class.
*
* @SINCE_1_0.0
* @param[in] position This is the actor translation from camera
*/
- using SortFunctionType = float ( * )( const Vector3& );
+ using SortFunctionType = float (*)(const Vector3&);
/**
* @brief Creates an empty Layer handle.
* @param[in] handle Handle to an object
* @return Handle to a Layer or an uninitialized handle
*/
- static Layer DownCast( BaseHandle handle );
+ static Layer DownCast(BaseHandle handle);
/**
* @brief Destructor.
* @SINCE_1_9.22
* @param[in] rhs The layer to move
*/
- Layer( Layer&& rhs );
+ Layer(Layer&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs The layer to move
* @return A reference to this
*/
- Layer& operator=( Layer&& rhs );
+ Layer& operator=(Layer&& rhs);
/**
* @brief Increments the depth of the layer.
* @pre Target layer is on the stage.
* @note All layers between this layer and target get new depth values.
*/
- void RaiseAbove( Layer target );
+ void RaiseAbove(Layer target);
/**
* @brief Ensures the layers depth is less than the target layer.
* @pre Target layer is on the stage.
* @note All layers between this layer and target get new depth values.
*/
- void LowerBelow( Layer target );
+ void LowerBelow(Layer target);
/**
* @brief Raises the layer to the top.
* @pre Target layer is on the stage.
* @note All layers between this layer and target get new depth values.
*/
- void MoveAbove( Layer target );
+ void MoveAbove(Layer target);
/**
* @brief Moves the layer directly below the given layer.
* @pre Target layer is on the stage.
* @note All layers between this layer and target get new depth values.
*/
- void MoveBelow( Layer target );
+ void MoveBelow(Layer target);
// Sorting
* layer, then the sort function used by the child layer will also be the same.
*
*/
- void SetSortFunction( SortFunctionType function );
+ void SetSortFunction(SortFunctionType function);
/**
* @brief Retrieves whether the layer consumes hover.
bool IsHoverConsumed() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Layer::New() methods.
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace
{
-constexpr uint32_t BitMaskOfN( uint32_t bits )
+constexpr uint32_t BitMaskOfN(uint32_t bits)
{
- return ( 1 << bits ) - 1;
+ return (1 << bits) - 1;
}
} // unnamed namespace
AlphaFunction::AlphaFunction()
-:mBezierControlPoints(Vector4::ZERO),
- mCustom(nullptr),
- mBuiltin(DEFAULT),
- mMode(BUILTIN_FUNCTION)
-{}
+: mBezierControlPoints(Vector4::ZERO),
+ mCustom(nullptr),
+ mBuiltin(DEFAULT),
+ mMode(BUILTIN_FUNCTION)
+{
+}
-AlphaFunction::AlphaFunction( BuiltinFunction function)
-:mBezierControlPoints(Vector4::ZERO),
- mCustom(nullptr),
- mBuiltin(function),
- mMode(BUILTIN_FUNCTION)
-{}
+AlphaFunction::AlphaFunction(BuiltinFunction function)
+: mBezierControlPoints(Vector4::ZERO),
+ mCustom(nullptr),
+ mBuiltin(function),
+ mMode(BUILTIN_FUNCTION)
+{
+}
-AlphaFunction::AlphaFunction( AlphaFunctionPrototype function)
-:mBezierControlPoints(Vector4::ZERO),
- mCustom(function),
- mBuiltin(DEFAULT),
- mMode(CUSTOM_FUNCTION)
-{}
+AlphaFunction::AlphaFunction(AlphaFunctionPrototype function)
+: mBezierControlPoints(Vector4::ZERO),
+ mCustom(function),
+ mBuiltin(DEFAULT),
+ mMode(CUSTOM_FUNCTION)
+{
+}
-AlphaFunction::AlphaFunction( const Vector2& controlPoint0, const Vector2& controlPoint1 )
-:mBezierControlPoints(Vector4(Clamp(controlPoint0.x,0.0f,1.0f),controlPoint0.y,
- Clamp(controlPoint1.x,0.0f,1.0f),controlPoint1.y)),
- mCustom(nullptr),
- mBuiltin(DEFAULT),
- mMode(BEZIER)
+AlphaFunction::AlphaFunction(const Vector2& controlPoint0, const Vector2& controlPoint1)
+: mBezierControlPoints(
+ Vector4(Clamp(controlPoint0.x, 0.0f, 1.0f),
+ controlPoint0.y,
+ Clamp(controlPoint1.x, 0.0f, 1.0f),
+ controlPoint1.y)),
+ mCustom(nullptr),
+ mBuiltin(DEFAULT),
+ mMode(BEZIER)
{
}
AlphaFunction::BuiltinFunction AlphaFunction::GetBuiltinFunction() const
{
- return static_cast<AlphaFunction::BuiltinFunction>( mBuiltin & BitMaskOfN( Log<COUNT>::value + 1 ) );
+ return static_cast<AlphaFunction::BuiltinFunction>(mBuiltin & BitMaskOfN(Log<COUNT>::value + 1));
}
AlphaFunction::Mode AlphaFunction::GetMode() const
{
- return static_cast<AlphaFunction::Mode>( mMode & BitMaskOfN( 2 ) );
+ return static_cast<AlphaFunction::Mode>(mMode & BitMaskOfN(2));
}
} // namespace Dali
#define DALI_ALPHA_FUNCTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/constants.h>
+#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/compile-time-math.h>
#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/vector2.h>
* @{
*/
-using AlphaFunctionPrototype = float ( * )( float ); ///< Prototype of an alpha function @SINCE_1_0.0
+using AlphaFunctionPrototype = float (*)(float); ///< Prototype of an alpha function @SINCE_1_0.0
/**
* @brief Alpha functions are used in animations to specify the rate of change of the animation parameter over time.
class DALI_CORE_API AlphaFunction
{
public:
-
/**
* @brief Enumeration for built-in alpha functions.
* @SINCE_1_0.0
*/
enum BuiltinFunction
{
- DEFAULT, ///< Linear @SINCE_1_0.0
- LINEAR, ///< No transformation @SINCE_1_0.0
- REVERSE, ///< Reverse linear @SINCE_1_0.0
-
- EASE_IN_SQUARE, ///< Speeds up and comes to a sudden stop (Square) @SINCE_1_0.0
- EASE_OUT_SQUARE, ///< Sudden start and slows to a gradual stop (Square) @SINCE_1_0.0
-
- EASE_IN, ///< Speeds up and comes to a sudden stop (Cubic) @SINCE_1_0.0
- EASE_OUT, ///< Sudden start and slows to a gradual stop (Cubic) @SINCE_1_0.0
- EASE_IN_OUT, ///< Speeds up and slows to a gradual stop (Cubic) @SINCE_1_0.0
-
- EASE_IN_SINE, ///< Speeds up and comes to a sudden stop (sinusoidal) @SINCE_1_0.0
- EASE_OUT_SINE, ///< Sudden start and slows to a gradual stop (sinusoidal) @SINCE_1_0.0
- EASE_IN_OUT_SINE, ///< Speeds up and slows to a gradual stop (sinusoidal) @SINCE_1_0.0
-
- BOUNCE, ///< Sudden start, loses momentum and returns to start position @SINCE_1_0.0
- SIN, ///< Single revolution @SINCE_1_0.0
- EASE_OUT_BACK, ///< Sudden start, exceed end position and return to a gradual stop @SINCE_1_0.0
-
+ DEFAULT, ///< Linear @SINCE_1_0.0
+ LINEAR, ///< No transformation @SINCE_1_0.0
+ REVERSE, ///< Reverse linear @SINCE_1_0.0
+ EASE_IN_SQUARE, ///< Speeds up and comes to a sudden stop (Square) @SINCE_1_0.0
+ EASE_OUT_SQUARE, ///< Sudden start and slows to a gradual stop (Square) @SINCE_1_0.0
+ EASE_IN, ///< Speeds up and comes to a sudden stop (Cubic) @SINCE_1_0.0
+ EASE_OUT, ///< Sudden start and slows to a gradual stop (Cubic) @SINCE_1_0.0
+ EASE_IN_OUT, ///< Speeds up and slows to a gradual stop (Cubic) @SINCE_1_0.0
+ EASE_IN_SINE, ///< Speeds up and comes to a sudden stop (sinusoidal) @SINCE_1_0.0
+ EASE_OUT_SINE, ///< Sudden start and slows to a gradual stop (sinusoidal) @SINCE_1_0.0
+ EASE_IN_OUT_SINE, ///< Speeds up and slows to a gradual stop (sinusoidal) @SINCE_1_0.0
+ BOUNCE, ///< Sudden start, loses momentum and returns to start position @SINCE_1_0.0
+ SIN, ///< Single revolution @SINCE_1_0.0
+ EASE_OUT_BACK, ///< Sudden start, exceed end position and return to a gradual stop @SINCE_1_0.0
COUNT
};
*/
enum Mode
{
- BUILTIN_FUNCTION, ///< The user has specified a built-in function @SINCE_1_0.0
- CUSTOM_FUNCTION, ///< The user has provided a custom function @SINCE_1_0.0
- BEZIER ///< The user has provided the control points of a bezier curve @SINCE_1_0.0
+ BUILTIN_FUNCTION, ///< The user has specified a built-in function @SINCE_1_0.0
+ CUSTOM_FUNCTION, ///< The user has provided a custom function @SINCE_1_0.0
+ BEZIER ///< The user has provided the control points of a bezier curve @SINCE_1_0.0
};
/**
* @param[in] function One of the built-in alpha functions
* @return The alpha function
*/
- AlphaFunction( BuiltinFunction function);
+ AlphaFunction(BuiltinFunction function);
/**
* @brief Constructor.
* @param[in] function A pointer to an alpha function
* @return The alpha function
*/
- AlphaFunction( AlphaFunctionPrototype function);
+ AlphaFunction(AlphaFunctionPrototype function);
/**
* @brief Constructor.
* @note The x components of the control points will be clamped to the range [0,1] to prevent
* non monotonic curves.
*/
- AlphaFunction( const Dali::Vector2& controlPoint0, const Dali::Vector2& controlPoint1 );
+ AlphaFunction(const Dali::Vector2& controlPoint0, const Dali::Vector2& controlPoint1);
/**
* @brief Returns the control points of the alpha function.
Mode GetMode() const;
private:
-
- Vector4 mBezierControlPoints; //< Control points for the bezier alpha function
- AlphaFunctionPrototype mCustom; //< Pointer to an alpha function
- BuiltinFunction mBuiltin : Log<COUNT>::value+1; //< Enum indicating the built-in alpha function
- Mode mMode : 2; //< Enum indicating the functioning mode of the AlphaFunction
+ Vector4 mBezierControlPoints; //< Control points for the bezier alpha function
+ AlphaFunctionPrototype mCustom; //< Pointer to an alpha function
+ BuiltinFunction mBuiltin : Log<COUNT>::value + 1; //< Enum indicating the built-in alpha function
+ Mode mMode : 2; //< Enum indicating the functioning mode of the AlphaFunction
};
/**
#include <dali/public-api/animation/animation.h>
// INTERNAL INCLUDES
-#include <dali/public-api/animation/alpha-function.h>
-#include <dali/public-api/animation/time-period.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/animation/animation-impl.h>
#include <dali/internal/event/animation/path-impl.h>
+#include <dali/public-api/animation/alpha-function.h>
+#include <dali/public-api/animation/time-period.h>
namespace Dali
{
-
Animation::Animation()
{
}
return Animation(internal.Get());
}
-Animation Animation::DownCast( BaseHandle handle )
+Animation Animation::DownCast(BaseHandle handle)
{
- return Animation( dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()) );
+ return Animation(dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()));
}
Animation::~Animation()
Animation& Animation::operator=(const Animation& rhs) = default;
-Animation::Animation( Animation&& rhs ) = default;
+Animation::Animation(Animation&& rhs) = default;
-Animation& Animation::operator=( Animation&& rhs ) = default;
+Animation& Animation::operator=(Animation&& rhs) = default;
void Animation::SetDuration(float durationSeconds)
{
return GetImplementation(*this).GetEndAction();
}
-void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
+void Animation::SetDisconnectAction(Animation::EndAction disconnectAction)
{
- GetImplementation(*this).SetDisconnectAction( disconnectAction );
+ GetImplementation(*this).SetDisconnectAction(disconnectAction);
}
Animation::EndAction Animation::GetDisconnectAction() const
GetImplementation(*this).PlayFrom(progress);
}
-void Animation::PlayAfter( float delaySeconds )
+void Animation::PlayAfter(float delaySeconds)
{
- GetImplementation( *this ).PlayAfter( delaySeconds );
+ GetImplementation(*this).PlayAfter(delaySeconds);
}
void Animation::Pause()
GetImplementation(*this).Clear();
}
-void Animation::SetLoopingMode( LoopingMode loopingMode )
+void Animation::SetLoopingMode(LoopingMode loopingMode)
{
- GetImplementation( *this ).SetLoopingMode( loopingMode );
+ GetImplementation(*this).SetLoopingMode(loopingMode);
}
Animation::LoopingMode Animation::GetLoopingMode() const
{
- return GetImplementation( *this ).GetLoopingMode();
+ return GetImplementation(*this).GetLoopingMode();
}
Animation::AnimationSignalType& Animation::FinishedSignal()
GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
}
-void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames)
{
- GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
+ GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames));
}
void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
{
- GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
+ GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation);
}
void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
{
- GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
+ GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation);
}
void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
}
-
void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
{
GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
}
-
// Actor specific animations
-void Animation::Animate( Actor actor, Path path, const Vector3& forward )
+void Animation::Animate(Actor actor, Path path, const Vector3& forward)
{
- GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
+ GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation(path), forward);
}
-void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
+void Animation::Animate(Actor actor, Path path, const Vector3& forward, AlphaFunction alpha)
{
- GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
+ GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation(path), forward, alpha);
}
-void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
+void Animation::Animate(Actor actor, Path path, const Vector3& forward, TimePeriod period)
{
- GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
+ GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation(path), forward, period);
}
-void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
+void Animation::Animate(Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
{
- GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
+ GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation(path), forward, alpha, period);
}
void Animation::Show(Actor actor, float delaySeconds)
GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
}
-void Animation::SetCurrentProgress( float progress )
+void Animation::SetCurrentProgress(float progress)
{
- return GetImplementation(*this).SetCurrentProgress( progress );
+ return GetImplementation(*this).SetCurrentProgress(progress);
}
float Animation::GetCurrentProgress()
return GetImplementation(*this).GetCurrentProgress();
}
-void Animation::SetSpeedFactor( float factor )
+void Animation::SetSpeedFactor(float factor)
{
- GetImplementation(*this).SetSpeedFactor( factor );
+ GetImplementation(*this).SetSpeedFactor(factor);
}
float Animation::GetSpeedFactor() const
return GetImplementation(*this).GetSpeedFactor();
}
-void Animation::SetPlayRange( const Vector2& range )
+void Animation::SetPlayRange(const Vector2& range)
{
GetImplementation(*this).SetPlayRange(range);
}
class DALI_CORE_API Animation : public BaseHandle
{
public:
- using AnimationSignalType = Signal<void( Animation& )>; ///< Animation finished signal type @SINCE_1_0.0
+ using AnimationSignalType = Signal<void(Animation&)>; ///< Animation finished signal type @SINCE_1_0.0
using AnyFunction = Any; ///< Interpolation function @SINCE_1_0.0
*/
enum EndAction
{
- BAKE, ///< When the animation ends, the animated property values are saved. @SINCE_1_0.0
- DISCARD, ///< When the animation ends, the animated property values are forgotten. @SINCE_1_0.0
+ BAKE, ///< When the animation ends, the animated property values are saved. @SINCE_1_0.0
+ DISCARD, ///< When the animation ends, the animated property values are forgotten. @SINCE_1_0.0
BAKE_FINAL ///< If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Bake. @SINCE_1_0.0
};
*/
enum Interpolation
{
- LINEAR, ///< Values in between key frames are interpolated using a linear polynomial. (Default) @SINCE_1_0.0
- CUBIC ///< Values in between key frames are interpolated using a cubic polynomial. @SINCE_1_0.0
+ LINEAR, ///< Values in between key frames are interpolated using a linear polynomial. (Default) @SINCE_1_0.0
+ CUBIC ///< Values in between key frames are interpolated using a cubic polynomial. @SINCE_1_0.0
};
/**
*/
enum State
{
- STOPPED, ///< Animation has stopped @SINCE_1_1.21
- PLAYING, ///< The animation is playing @SINCE_1_1.21
- PAUSED ///< The animation is paused @SINCE_1_1.21
+ STOPPED, ///< Animation has stopped @SINCE_1_1.21
+ PLAYING, ///< The animation is playing @SINCE_1_1.21
+ PAUSED ///< The animation is paused @SINCE_1_1.21
};
/**
*/
enum LoopingMode
{
- RESTART, ///< When the animation arrives at the end in looping mode, the animation restarts from the beginning. @SINCE_1_2.60
- AUTO_REVERSE ///< When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again. @SINCE_1_2.60
+ RESTART, ///< When the animation arrives at the end in looping mode, the animation restarts from the beginning. @SINCE_1_2.60
+ AUTO_REVERSE ///< When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again. @SINCE_1_2.60
};
/**
* @param[in] handle Handle to an object
* @return Handle to an Animation object or an uninitialized handle
*/
- static Animation DownCast( BaseHandle handle );
+ static Animation DownCast(BaseHandle handle);
/**
* @brief Destructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Animation( Animation&& rhs );
+ Animation(Animation&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- Animation& operator=( Animation&& rhs );
+ Animation& operator=(Animation&& rhs);
/**
* @brief Sets the duration of an animation.
* @SINCE_1_1.20
* @param[in] count The number of times to loop
*/
- void SetLoopCount(int32_t count);
+ void SetLoopCount(int32_t count);
/**
* @brief Gets the loop count.
* @SINCE_1_1.20
* @return The number of times to loop
*/
- int32_t GetLoopCount();
+ int32_t GetLoopCount();
/**
* @brief Gets the current loop count.
* @SINCE_1_1.20
* @return The current number of loops that have occured
*/
- int32_t GetCurrentLoop();
+ int32_t GetCurrentLoop();
/**
* @brief Queries whether the animation will loop.
* @SINCE_1_0.0
* @param[in] disconnectAction The disconnect action
*/
- void SetDisconnectAction( EndAction disconnectAction );
+ void SetDisconnectAction(EndAction disconnectAction);
/**
* @brief Returns the disconnect action.
* @param[in] progress The new progress as a normalized value between [0,1]
* or between the play range if specified
*/
- void SetCurrentProgress( float progress );
+ void SetCurrentProgress(float progress);
/**
* @brief Retrieves the current progress of the animation.
* @SINCE_1_0.0
* @param[in] factor A value which will multiply the velocity
*/
- void SetSpeedFactor( float factor );
+ void SetSpeedFactor(float factor);
/**
* @brief Retrieves the speed factor of the animation.
* @param[in] range Two values between [0,1] to specify minimum and maximum progress. The
* animation will play between those values
*/
- void SetPlayRange( const Vector2& range );
+ void SetPlayRange(const Vector2& range);
/**
* @brief Gets the playing range.
* @SINCE_1_0.0
* @param[in] progress A value between [0,1], or between the play range if specified, from where the animation should start playing
*/
- void PlayFrom( float progress );
+ void PlayFrom(float progress);
/**
* @brief Play the animation after a given delay time.
* @SINCE_1_2.60
* @param[in] delaySeconds The delay time
*/
- void PlayAfter( float delaySeconds );
+ void PlayAfter(float delaySeconds);
/**
* @brief Pauses the animation.
* @SINCE_1_2.60
* @param[in] loopingMode The looping mode is one of RESTART and AUTO_REVERSE
*/
- void SetLoopingMode( LoopingMode loopingMode );
+ void SetLoopingMode(LoopingMode loopingMode);
/**
* @brief Gets one of the current looping mode.
*/
void AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
- /**
+ /**
* @brief Animates a property between keyframes.
*
* @SINCE_1_0.0
*/
void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation);
-
// Actor-specific convenience methods
/**
* @param[in] path The path. It defines position and orientation
* @param[in] forward The vector (in local space coordinate system) that will be oriented with the path's tangent direction
*/
- void Animate( Actor actor, Path path, const Vector3& forward );
+ void Animate(Actor actor, Path path, const Vector3& forward);
/**
* @brief Animates an actor's position and orientation through a predefined path.
* @param[in] forward The vector (in local space coordinate system) that will be oriented with the path's tangent direction
* @param[in] alpha The alpha function to apply
*/
- void Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha );
+ void Animate(Actor actor, Path path, const Vector3& forward, AlphaFunction alpha);
/**
* @brief Animates an actor's position and orientation through a predefined path.
* @param[in] forward The vector (in local space coordinate system) that will be oriented with the path's tangent direction
* @param[in] period The effect will occur during this time period
*/
- void Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period );
+ void Animate(Actor actor, Path path, const Vector3& forward, TimePeriod period);
/**
* @brief Animates an actor's position and orientation through a predefined path.
* @param[in] alpha The alpha function to apply
* @param[in] period The effect will occur during this time period
*/
- void Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period);
+ void Animate(Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period);
/**
* @brief Shows an actor during the animation.
void Hide(Actor actor, float delaySeconds);
public: // Not intended for use by Application developers
-
/// @cond internal
/**
* @brief This constructor is used by Animation::New() methods.
*/
explicit DALI_INTERNAL Animation(Internal::Animation* animation);
/// @endcond
-
};
/**
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
-LocalSource::LocalSource( Property::Index index )
-: propertyIndex( index )
+LocalSource::LocalSource(Property::Index index)
+: propertyIndex(index)
{
}
-ParentSource::ParentSource( Property::Index index )
-: propertyIndex( index )
+ParentSource::ParentSource(Property::Index index)
+: propertyIndex(index)
{
}
-Source::Source( Handle& obj, Property::Index index )
-: propertyIndex( index ),
- object( obj )
+Source::Source(Handle& obj, Property::Index index)
+: propertyIndex(index),
+ object(obj)
{
}
-ConstraintSource::ConstraintSource( Source source )
-: sourceType( OBJECT_PROPERTY ),
- propertyIndex( source.propertyIndex ),
- object( source.object )
+ConstraintSource::ConstraintSource(Source source)
+: sourceType(OBJECT_PROPERTY),
+ propertyIndex(source.propertyIndex),
+ object(source.object)
{
}
-ConstraintSource::ConstraintSource( LocalSource local )
-: sourceType( LOCAL_PROPERTY ),
- propertyIndex( local.propertyIndex )
+ConstraintSource::ConstraintSource(LocalSource local)
+: sourceType(LOCAL_PROPERTY),
+ propertyIndex(local.propertyIndex)
{
}
-ConstraintSource::ConstraintSource( ParentSource parent )
-: sourceType( PARENT_PROPERTY ),
- propertyIndex( parent.propertyIndex )
+ConstraintSource::ConstraintSource(ParentSource parent)
+: sourceType(PARENT_PROPERTY),
+ propertyIndex(parent.propertyIndex)
{
}
#define DALI_CONSTRAINT_SOURCE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
PARENT_PROPERTY ///< The property comes from the parent of the object, which the constraint is applied to. @SINCE_1_0.0
};
-
/**
* @brief Identifies a property from an object.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] index The index of a property provided by the constrained object
*/
- LocalSource( Property::Index index );
+ LocalSource(Property::Index index);
Property::Index propertyIndex; ///< The index of a property provided by the constrained object.
};
* @SINCE_1_0.0
* @param[in] index The index of a property, provided by the parent of the constrained object
*/
- ParentSource( Property::Index index );
+ ParentSource(Property::Index index);
Property::Index propertyIndex; ///< The index of a property provided by the parent of the constrained object.
};
* @param[in] object The object providing the property
* @param[in] index The index of a property provided by object
*/
- Source( Handle& object, Property::Index index );
+ Source(Handle& object, Property::Index index);
Property::Index propertyIndex; ///< The index of a property provided by object.
* @SINCE_1_0.0
* @param[in] source A constraint source from an arbitrary object
*/
- ConstraintSource( Source source );
+ ConstraintSource(Source source);
/**
* @brief Creates a constraint source.
* @SINCE_1_0.0
* @param[in] local A local constraint source
*/
- ConstraintSource( LocalSource local );
+ ConstraintSource(LocalSource local);
/**
* @brief Creates a constraint source.
* @SINCE_1_0.0
* @param[in] parent A parent constraint source
*/
- ConstraintSource( ParentSource parent );
+ ConstraintSource(ParentSource parent);
SourceType sourceType; ///< The source type
namespace Dali
{
-
namespace // unnamed namespace
{
-
-template < class P >
-Internal::PropertyConstraint< P >* CreatePropertyConstraint( CallbackBase* func )
+template<class P>
+Internal::PropertyConstraint<P>* CreatePropertyConstraint(CallbackBase* func)
{
- return new Internal::PropertyConstraint< P >( reinterpret_cast< Dali::Constraint::Function< P >* >( func ) );
+ return new Internal::PropertyConstraint<P>(reinterpret_cast<Dali::Constraint::Function<P>*>(func));
}
} // unnamed namespace
{
}
-Constraint Constraint::Clone( Handle object )
+Constraint Constraint::Clone(Handle object)
{
- return Constraint( GetImplementation( *this ).Clone( GetImplementation( object ) ) );
+ return Constraint(GetImplementation(*this).Clone(GetImplementation(object)));
}
Constraint::~Constraint()
{
}
-Constraint::Constraint( const Constraint& constraint ) = default;
+Constraint::Constraint(const Constraint& constraint) = default;
-Constraint& Constraint::operator=( const Constraint& rhs ) = default;
+Constraint& Constraint::operator=(const Constraint& rhs) = default;
-Constraint::Constraint( Constraint&& rhs ) = default;
+Constraint::Constraint(Constraint&& rhs) = default;
-Constraint& Constraint::operator=( Constraint&& rhs ) = default;
+Constraint& Constraint::operator=(Constraint&& rhs) = default;
-Constraint Constraint::DownCast( BaseHandle baseHandle )
+Constraint Constraint::DownCast(BaseHandle baseHandle)
{
- return Constraint( dynamic_cast< Dali::Internal::ConstraintBase* >( baseHandle.GetObjectPtr() ) );
+ return Constraint(dynamic_cast<Dali::Internal::ConstraintBase*>(baseHandle.GetObjectPtr()));
}
-void Constraint::AddSource( ConstraintSource source )
+void Constraint::AddSource(ConstraintSource source)
{
- GetImplementation( *this ).AddSource( Internal::Source( source ) );
+ GetImplementation(*this).AddSource(Internal::Source(source));
}
void Constraint::Apply()
{
- GetImplementation( *this ).Apply();
+ GetImplementation(*this).Apply();
}
void Constraint::Remove()
{
- GetImplementation( *this ).Remove();
+ GetImplementation(*this).Remove();
}
Handle Constraint::GetTargetObject()
return GetImplementation(*this).GetRemoveAction();
}
-void Constraint::SetTag( const uint32_t tag )
+void Constraint::SetTag(const uint32_t tag)
{
- GetImplementation(*this).SetTag( tag );
+ GetImplementation(*this).SetTag(tag);
}
uint32_t Constraint::GetTag() const
return GetImplementation(*this).GetTag();
}
-Constraint::Constraint( Internal::ConstraintBase* constraint )
-: BaseHandle( constraint )
+Constraint::Constraint(Internal::ConstraintBase* constraint)
+: BaseHandle(constraint)
{
}
-Constraint Constraint::New( Handle handle, Property::Index targetIndex, Property::Type targetType, CallbackBase* function )
+Constraint Constraint::New(Handle handle, Property::Index targetIndex, Property::Type targetType, CallbackBase* function)
{
- Constraint constraint;
+ Constraint constraint;
Internal::SourceContainer sources;
- Internal::Object& object = GetImplementation( handle );
+ Internal::Object& object = GetImplementation(handle);
- switch ( targetType )
+ switch(targetType)
{
case Property::BOOLEAN:
{
- Internal::PropertyConstraintPtr< bool >::Type funcPtr( CreatePropertyConstraint< bool >( function ) );
+ Internal::PropertyConstraintPtr<bool>::Type funcPtr(CreatePropertyConstraint<bool>(function));
- constraint = Dali::Constraint( Internal::Constraint< bool >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<bool>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
case Property::FLOAT:
{
- Internal::PropertyConstraintPtr< float >::Type funcPtr( CreatePropertyConstraint< float >( function ) );
+ Internal::PropertyConstraintPtr<float>::Type funcPtr(CreatePropertyConstraint<float>(function));
- constraint = Dali::Constraint( Internal::Constraint< float >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<float>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
case Property::INTEGER:
{
- Internal::PropertyConstraintPtr< int >::Type funcPtr( CreatePropertyConstraint< int >( function ) );
+ Internal::PropertyConstraintPtr<int>::Type funcPtr(CreatePropertyConstraint<int>(function));
- constraint = Dali::Constraint( Internal::Constraint< int >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<int>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
case Property::VECTOR2:
{
- Internal::PropertyConstraintPtr< Vector2 >::Type funcPtr( CreatePropertyConstraint< Vector2 >( function ) );
+ Internal::PropertyConstraintPtr<Vector2>::Type funcPtr(CreatePropertyConstraint<Vector2>(function));
- constraint = Dali::Constraint( Internal::Constraint< Vector2 >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<Vector2>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
case Property::VECTOR3:
{
- Internal::PropertyConstraintPtr< Vector3 >::Type funcPtr( CreatePropertyConstraint< Vector3 >( function ) );
+ Internal::PropertyConstraintPtr<Vector3>::Type funcPtr(CreatePropertyConstraint<Vector3>(function));
- constraint = Dali::Constraint( Internal::Constraint< Vector3 >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<Vector3>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
case Property::VECTOR4:
{
- Internal::PropertyConstraintPtr< Vector4 >::Type funcPtr( CreatePropertyConstraint< Vector4 >( function ) );
+ Internal::PropertyConstraintPtr<Vector4>::Type funcPtr(CreatePropertyConstraint<Vector4>(function));
- constraint = Dali::Constraint( Internal::Constraint< Vector4 >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<Vector4>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
case Property::ROTATION:
{
- Internal::PropertyConstraintPtr< Quaternion >::Type funcPtr( CreatePropertyConstraint< Quaternion >( function ) );
+ Internal::PropertyConstraintPtr<Quaternion>::Type funcPtr(CreatePropertyConstraint<Quaternion>(function));
- constraint = Dali::Constraint( Internal::Constraint< Quaternion >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<Quaternion>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
case Property::MATRIX:
{
- Internal::PropertyConstraintPtr< Matrix >::Type funcPtr( CreatePropertyConstraint< Matrix >( function ) );
+ Internal::PropertyConstraintPtr<Matrix>::Type funcPtr(CreatePropertyConstraint<Matrix>(function));
- constraint = Dali::Constraint( Internal::Constraint< Matrix >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<Matrix>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
case Property::MATRIX3:
{
- Internal::PropertyConstraintPtr<Matrix3>::Type funcPtr( CreatePropertyConstraint<Matrix3>( function ) );
+ Internal::PropertyConstraintPtr<Matrix3>::Type funcPtr(CreatePropertyConstraint<Matrix3>(function));
- constraint = Dali::Constraint( Internal::Constraint< Matrix3 >::New( object,
- targetIndex,
- sources,
- funcPtr ) );
+ constraint = Dali::Constraint(Internal::Constraint<Matrix3>::New(object,
+ targetIndex,
+ sources,
+ funcPtr));
break;
}
default:
{
- DALI_ABORT( "Property not constrainable" );
+ DALI_ABORT("Property not constrainable");
break;
}
}
#include <dali/public-api/animation/constraint-source.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/object/property.h>
#include <dali/public-api/object/property-input.h>
+#include <dali/public-api/object/property.h>
#include <dali/public-api/signals/callback.h>
namespace Dali
class DALI_CORE_API Constraint : public BaseHandle
{
public:
-
/**
* @brief Template for the Function that is called by the Constraint system.
*
* @SINCE_1_0.0
* @tparam P The property type to constrain
*/
- template< typename P >
+ template<typename P>
class DALI_INTERNAL Function : public CallbackBase
{
public:
-
/**
* @brief Constructor which connects to the provided C function (or a static member function).
*
* @SINCE_1_0.0
* @param[in] function The function to call
*/
- Function( void( *function )( P&, const PropertyInputContainer& ) )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ),
- mCopyConstructorDispatcher( NULL )
+ Function(void (*function)(P&, const PropertyInputContainer&))
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function)),
+ mCopyConstructorDispatcher(NULL)
{
}
* @param[in] object The object to copy
* @tparam T The type of the object
*/
- template< class T >
- Function( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- nullptr, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher2< T, P&, const PropertyInputContainer& >::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer< T >::Delete ) ),
- mCopyConstructorDispatcher( reinterpret_cast< CopyConstructorDispatcher >( &ObjectCopyConstructorDispatcher< T >::Copy ) )
+ template<class T>
+ Function(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ nullptr, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcher2<T, P&, const PropertyInputContainer&>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete)),
+ mCopyConstructorDispatcher(reinterpret_cast<CopyConstructorDispatcher>(&ObjectCopyConstructorDispatcher<T>::Copy))
{
}
* @param[in] memberFunction The member function to call. This has to be a member of the same class
* @tparam T The type of the object
*/
- template< class T >
- Function( const T& object, void ( T::*memberFunction ) ( P&, const PropertyInputContainer& ) )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher2< T, P&, const PropertyInputContainer& >::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer< T >::Delete ) ),
- mCopyConstructorDispatcher( reinterpret_cast< CopyConstructorDispatcher >( &ObjectCopyConstructorDispatcher< T >::Copy ) )
+ template<class T>
+ Function(const T& object, void (T::*memberFunction)(P&, const PropertyInputContainer&))
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&Dispatcher2<T, P&, const PropertyInputContainer&>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete)),
+ mCopyConstructorDispatcher(reinterpret_cast<CopyConstructorDispatcher>(&ObjectCopyConstructorDispatcher<T>::Copy))
{
}
CallbackBase* Clone()
{
CallbackBase* callback = nullptr;
- if ( mImpl && mImpl->mObjectPointer && mCopyConstructorDispatcher )
+ if(mImpl && mImpl->mObjectPointer && mCopyConstructorDispatcher)
{
- callback = new Function( mCopyConstructorDispatcher( reinterpret_cast< UndefinedClass* >( mImpl->mObjectPointer ) ) /* Copy the object */,
- mMemberFunction,
- mImpl->mMemberFunctionDispatcher,
- mImpl->mDestructorDispatcher,
- mCopyConstructorDispatcher );
+ callback = new Function(mCopyConstructorDispatcher(reinterpret_cast<UndefinedClass*>(mImpl->mObjectPointer)) /* Copy the object */,
+ mMemberFunction,
+ mImpl->mMemberFunctionDispatcher,
+ mImpl->mDestructorDispatcher,
+ mCopyConstructorDispatcher);
}
else
{
- callback = new Function( mFunction );
+ callback = new Function(mFunction);
}
return callback;
}
private:
-
/**
* @brief Must not be declared.
*
* @brief Used to call the function to copy the stored object.
* @SINCE_1_0.0
*/
- using CopyConstructorDispatcher = UndefinedClass* (*)( UndefinedClass* );
+ using CopyConstructorDispatcher = UndefinedClass* (*)(UndefinedClass*);
/**
* @brief Copies the actual object in Constraint::Function.
* @SINCE_1_0.0
* @tparam T The type of the object
*/
- template< class T >
+ template<class T>
struct ObjectCopyConstructorDispatcher
{
/**
* @param[in] object The object to copy
* @return Newly allocated clone of the object
*/
- static UndefinedClass* Copy( const UndefinedClass* object )
+ static UndefinedClass* Copy(const UndefinedClass* object)
{
- T* copy = new T( *( reinterpret_cast< const T* >( object ) ) );
- return reinterpret_cast< UndefinedClass* >( copy );
+ T* copy = new T(*(reinterpret_cast<const T*>(object)));
+ return reinterpret_cast<UndefinedClass*>(copy);
}
};
- Function( const Function& ) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
- Function( Function&& ) = delete; ///< Deleted move constructor. @SINCE_1_9.25
- Function& operator=( const Function& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
- Function& operator=( Function&& ) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
+ Function(const Function&) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
+ Function(Function&&) = delete; ///< Deleted move constructor. @SINCE_1_9.25
+ Function& operator=(const Function&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
+ Function& operator=(Function&&) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
/**
* @brief Constructor used when copying the stored object.
* @param[in] destructor Used to delete the owned object
* @param[in] copyConstructorDispatcher Used to create a copy of the owned object
*/
- Function( void* object,
- CallbackBase::MemberFunction memberFunction,
- CallbackBase::Dispatcher dispatcher,
- CallbackBase::Destructor destructor,
- CopyConstructorDispatcher copyConstructorDispatcher )
- : CallbackBase( object, memberFunction, dispatcher, destructor ),
- mCopyConstructorDispatcher( copyConstructorDispatcher )
+ Function(void* object,
+ CallbackBase::MemberFunction memberFunction,
+ CallbackBase::Dispatcher dispatcher,
+ CallbackBase::Destructor destructor,
+ CopyConstructorDispatcher copyConstructorDispatcher)
+ : CallbackBase(object, memberFunction, dispatcher, destructor),
+ mCopyConstructorDispatcher(copyConstructorDispatcher)
{
}
* @SINCE_1_0.0
* @param[in] function The function to call
*/
- Function( CallbackBase::Function function )
- : CallbackBase( function ),
- mCopyConstructorDispatcher( nullptr )
+ Function(CallbackBase::Function function)
+ : CallbackBase(function),
+ mCopyConstructorDispatcher(nullptr)
{
}
DISCARD ///< When the constraint is removed, the constrained value is discarded. @SINCE_1_9.28
};
- static const RemoveAction DEFAULT_REMOVE_ACTION; ///< BAKE
+ static const RemoveAction DEFAULT_REMOVE_ACTION; ///< BAKE
/**
* @brief Creates an uninitialized Constraint; this can be initialized with Constraint::New().
* @tparam P The type of the property to constrain
* @return The new constraint
*/
- template< class P >
- static Constraint New( Handle handle, Property::Index targetIndex, void( *function )( P&, const PropertyInputContainer& ) )
+ template<class P>
+ static Constraint New(Handle handle, Property::Index targetIndex, void (*function)(P&, const PropertyInputContainer&))
{
- CallbackBase* callback = new Constraint::Function< P >( function );
- return New( handle, targetIndex, PropertyTypes::Get< P >(), callback );
+ CallbackBase* callback = new Constraint::Function<P>(function);
+ return New(handle, targetIndex, PropertyTypes::Get<P>(), callback);
}
/**
* @tparam T The type of the object
* @return The new constraint
*/
- template< class P, class T >
- static Constraint New( Handle handle, Property::Index targetIndex, const T& object )
+ template<class P, class T>
+ static Constraint New(Handle handle, Property::Index targetIndex, const T& object)
{
- CallbackBase* function = new Constraint::Function< P >( object );
- return New( handle, targetIndex, PropertyTypes::Get< P >(), function );
+ CallbackBase* function = new Constraint::Function<P>(object);
+ return New(handle, targetIndex, PropertyTypes::Get<P>(), function);
}
/**
* @tparam P The type of the property to constrain
* @tparam T The type of the object
*/
- template< class P, class T >
- static Constraint New( Handle handle, Property::Index targetIndex, const T& object, void ( T::*memberFunction ) ( P&, const PropertyInputContainer& ) )
+ template<class P, class T>
+ static Constraint New(Handle handle, Property::Index targetIndex, const T& object, void (T::*memberFunction)(P&, const PropertyInputContainer&))
{
- CallbackBase* function = new Constraint::Function< P >( object, memberFunction );
- return New( handle, targetIndex, PropertyTypes::Get< P >(), function );
+ CallbackBase* function = new Constraint::Function<P>(object, memberFunction);
+ return New(handle, targetIndex, PropertyTypes::Get<P>(), function);
}
/**
* @param[in] handle The handle to the property-owning object this constraint is to be cloned for
* @return The new constraint
*/
- Constraint Clone( Handle handle );
+ Constraint Clone(Handle handle);
/**
* @brief Destructor.
* @SINCE_1_0.0
* @param[in] constraint A reference to the copied handle
*/
- Constraint( const Constraint& constraint );
+ Constraint(const Constraint& constraint);
/**
* @brief This assignment operator is required for (smart) pointer semantics.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- Constraint& operator=( const Constraint& rhs );
+ Constraint& operator=(const Constraint& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Constraint( Constraint&& rhs );
+ Constraint(Constraint&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- Constraint& operator=( Constraint&& rhs );
+ Constraint& operator=(Constraint&& rhs);
/**
* @brief Downcasts a handle to Constraint handle.
* @param[in] baseHandle BaseHandle to an object
* @return Handle to a Constraint object or an uninitialized handle
*/
- static Constraint DownCast( BaseHandle baseHandle );
+ static Constraint DownCast(BaseHandle baseHandle);
/**
* @brief Adds a constraint source to the constraint.
* @SINCE_1_0.0
* @param[in] source The constraint source input to add
*/
- void AddSource( ConstraintSource source );
+ void AddSource(ConstraintSource source);
/**
* @brief Applies this constraint.
* @SINCE_1_0.0
* @param[in] action The remove-action
*/
- void SetRemoveAction( RemoveAction action );
+ void SetRemoveAction(RemoveAction action);
/**
* @brief Retrieves the remove action that will happen when the constraint is removed.
* @SINCE_1_0.0
* @param[in] tag An integer to identify the constraint
*/
- void SetTag( const uint32_t tag );
+ void SetTag(const uint32_t tag);
/**
* @brief Gets the tag.
uint32_t GetTag() const;
public: // Not intended for use by Application developers
-
/// @cond internal
/**
* @brief This constructor is used by Constraint::New() methods.
* @SINCE_1_0.0
* @param[in] constraint A pointer to a newly allocated Dali resource
*/
- explicit DALI_INTERNAL Constraint( Internal::ConstraintBase* constraint );
+ explicit DALI_INTERNAL Constraint(Internal::ConstraintBase* constraint);
/// @endcond
private: // Not intended for use by Application developers
-
/// @cond internal
/**
* @brief Constructs a new constraint which targets a property.
* @param[in] function The constraint function
* @return The new constraint
*/
- static Constraint New( Handle handle, Property::Index targetIndex, Property::Type targetType, CallbackBase* function );
+ static Constraint New(Handle handle, Property::Index targetIndex, Property::Type targetType, CallbackBase* function);
/// @endcond
};
#define DALI_CONSTRAINTS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// INTERNAL INCLUDES
#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/matrix3.h>
+#include <dali/public-api/math/quaternion.h>
+#include <dali/public-api/math/vector3.h>
+#include <dali/public-api/math/vector4.h>
#include <dali/public-api/object/property-input.h>
namespace Dali
* @SINCE_1_0.0
*/
EqualToConstraint()
- { }
+ {
+ }
/**
* @brief Overrides functor for float properties.
* @param[in,out] current The current property value, the constrained value is set
* @param[in] inputs Contains the property to copy
*/
- void operator()( float& current, const PropertyInputContainer& inputs )
+ void operator()(float& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetFloat();
}
* @param[in,out] current The current property value, the constrained value is set
* @param[in] inputs Contains the property to copy
*/
- void operator()( Vector2& current, const PropertyInputContainer& inputs )
+ void operator()(Vector2& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetVector2();
}
* @param[in,out] current The current property value, the constrained value is set
* @param[in] inputs Contains the property to copy
*/
- void operator()( Vector3& current, const PropertyInputContainer& inputs )
+ void operator()(Vector3& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetVector3();
}
* @param[in,out] current The current property value, the constrained value is set
* @param[in] inputs Contains the property to copy
*/
- void operator()( Vector4& current, const PropertyInputContainer& inputs )
+ void operator()(Vector4& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetVector4();
}
* @param[in,out] current The current property value, the constrained value is set
* @param[in] inputs Contains the property to copy
*/
- void operator()( Quaternion& current, const PropertyInputContainer& inputs )
+ void operator()(Quaternion& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetQuaternion();
}
* @param[in,out] current The current property value
* @param[in] inputs Contains the property to copy
*/
- void operator()( Matrix3& current, const PropertyInputContainer& inputs )
+ void operator()(Matrix3& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetMatrix3();
}
* @param[in,out] current The current property value, the constrained value is set
* @param[in] inputs Contains the property to copy
*/
- void operator()( Matrix& current, const PropertyInputContainer& inputs )
+ void operator()(Matrix& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetMatrix();
}
-
};
/**
* @SINCE_1_0.0
* @param[in] scale Scale factor
*/
- RelativeToConstraint( float scale )
- : mScale( scale, scale, scale ) { }
+ RelativeToConstraint(float scale)
+ : mScale(scale, scale, scale)
+ {
+ }
/**
* @brief Constructor.
* @SINCE_1_0.0
* @param[in] scale Scale factor
*/
- RelativeToConstraint( const Vector3& scale )
- : mScale( scale ) { }
+ RelativeToConstraint(const Vector3& scale)
+ : mScale(scale)
+ {
+ }
/**
* @brief Functor.
* @param[in,out] current The current property value (vector3 property * scale factor)
* @param[in] inputs Property container for current property calculation
*/
- void operator()( Vector3& current, const PropertyInputContainer& inputs )
+ void operator()(Vector3& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetVector3() * mScale;
}
* @SINCE_1_0.0
* @param[in] scale Scale factor
*/
- RelativeToConstraintFloat( float scale )
- : mScale( scale ) { }
+ RelativeToConstraintFloat(float scale)
+ : mScale(scale)
+ {
+ }
/**
* @brief Functor.
* @param[in,out] current The current property value (float property * scale factor)
* @param[in] inputs Property container for current property calculation
*/
- void operator()( float& current, const PropertyInputContainer& inputs )
+ void operator()(float& current, const PropertyInputContainer& inputs)
{
current = inputs[0]->GetFloat() * mScale;
}
* @param[in,out] current The current orientation property value, the constrained value is set
* @param[in] inputs Contains the world position of the target, the world position of the camera, and the world orientation of the target
*/
-inline void LookAt( Dali::Quaternion& current, const Dali::PropertyInputContainer& inputs )
+inline void LookAt(Dali::Quaternion& current, const Dali::PropertyInputContainer& inputs)
{
- const PropertyInput& targetPosition( *inputs[0] );
- const PropertyInput& cameraPosition( *inputs[1] );
- const PropertyInput& targetOrientation( *inputs[2] );
+ const PropertyInput& targetPosition(*inputs[0]);
+ const PropertyInput& cameraPosition(*inputs[1]);
+ const PropertyInput& targetOrientation(*inputs[2]);
Vector3 vForward = targetPosition.GetVector3() - cameraPosition.GetVector3();
vForward.Normalize();
Vector3 vY = vForward.Cross(vX);
vY.Normalize();
- current = Quaternion( vX, vY, vForward );
+ current = Quaternion(vX, vY, vForward);
}
/**
#include <dali/public-api/animation/key-frames.h>
// INTERNAL INCLUDES
+#include <dali/internal/event/animation/key-frames-impl.h>
#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/math/degree.h>
#include <dali/public-api/math/radian.h>
-#include <dali/internal/event/animation/key-frames-impl.h>
namespace Dali
{
-
KeyFrames KeyFrames::New()
{
Internal::KeyFrames* internal = Internal::KeyFrames::New();
return KeyFrames(internal);
}
-KeyFrames KeyFrames::DownCast( BaseHandle handle )
+KeyFrames KeyFrames::DownCast(BaseHandle handle)
{
- return KeyFrames( dynamic_cast<Dali::Internal::KeyFrames*>(handle.GetObjectPtr()) );
+ return KeyFrames(dynamic_cast<Dali::Internal::KeyFrames*>(handle.GetObjectPtr()));
}
KeyFrames::KeyFrames()
KeyFrames& KeyFrames::operator=(const KeyFrames& rhs) = default;
-KeyFrames::KeyFrames( KeyFrames&& rhs ) = default;
+KeyFrames::KeyFrames(KeyFrames&& rhs) = default;
-KeyFrames& KeyFrames::operator=( KeyFrames&& rhs ) = default;
+KeyFrames& KeyFrames::operator=(KeyFrames&& rhs) = default;
Property::Type KeyFrames::GetType() const
{
}
KeyFrames::KeyFrames(Internal::KeyFrames* internal)
- : BaseHandle(internal)
+: BaseHandle(internal)
{
}
-
-
-} // Dali
+} // namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/object/property-value.h>
#include <dali/public-api/object/property-types.h>
+#include <dali/public-api/object/property-value.h>
namespace Dali
{
* @param[in] handle Handle to an object
* @return Handle to a KeyFrames object or an uninitialized handle
*/
- static KeyFrames DownCast( BaseHandle handle );
+ static KeyFrames DownCast(BaseHandle handle);
/**
* @brief Creates an uninitialized KeyFrame handle.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- KeyFrames( KeyFrames&& rhs );
+ KeyFrames(KeyFrames&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- KeyFrames& operator=( KeyFrames&& rhs );
+ KeyFrames& operator=(KeyFrames&& rhs);
/**
* @brief Gets the type of the key frame.
*/
void Add(float progress, Property::Value value, AlphaFunction alpha);
-
public: // Not intended for application developers
/// @cond internal
/**
// INTERNAL INCLUDES
#include <dali/internal/event/animation/linear-constrainer-impl.h>
-
namespace Dali
{
-
LinearConstrainer LinearConstrainer::New()
{
Internal::LinearConstrainer* internal = Internal::LinearConstrainer::New();
return LinearConstrainer(internal);
}
-LinearConstrainer LinearConstrainer::DownCast( BaseHandle handle )
+LinearConstrainer LinearConstrainer::DownCast(BaseHandle handle)
{
- return LinearConstrainer( dynamic_cast<Dali::Internal::LinearConstrainer*>(handle.GetObjectPtr()) );
+ return LinearConstrainer(dynamic_cast<Dali::Internal::LinearConstrainer*>(handle.GetObjectPtr()));
}
LinearConstrainer::LinearConstrainer()
LinearConstrainer& LinearConstrainer::operator=(const LinearConstrainer& rhs) = default;
-LinearConstrainer::LinearConstrainer( LinearConstrainer&& rhs ) = default;
+LinearConstrainer::LinearConstrainer(LinearConstrainer&& rhs) = default;
-LinearConstrainer& LinearConstrainer::operator=( LinearConstrainer&& rhs ) = default;
+LinearConstrainer& LinearConstrainer::operator=(LinearConstrainer&& rhs) = default;
-void LinearConstrainer::Apply( Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap )
+void LinearConstrainer::Apply(Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap)
{
- GetImplementation(*this).Apply( target, source, range, wrap );
+ GetImplementation(*this).Apply(target, source, range, wrap);
}
-void LinearConstrainer::Remove( Dali::Handle& target )
+void LinearConstrainer::Remove(Dali::Handle& target)
{
- GetImplementation(*this).Remove( target );
+ GetImplementation(*this).Remove(target);
}
-
-} // Dali
+} // namespace Dali
namespace Internal DALI_INTERNAL
{
- class LinearConstrainer;
+class LinearConstrainer;
}
/**
class DALI_CORE_API LinearConstrainer : public Handle
{
public:
-
/**
* @brief Enumeration for the instance of properties belonging to the LinearConstrainer class.
* @SINCE_1_0.0
*/
enum
{
- VALUE = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "value" type Array of float @SINCE_1_0.0
- PROGRESS, ///< name "progress" type Array of float @SINCE_1_0.0
+ VALUE = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "value" type Array of float @SINCE_1_0.0
+ PROGRESS, ///< name "progress" type Array of float @SINCE_1_0.0
};
};
* @param[in] handle Handle to an object
* @return Handle to a LinearConstrainer object or an uninitialized handle
*/
- static LinearConstrainer DownCast( BaseHandle handle );
+ static LinearConstrainer DownCast(BaseHandle handle);
/**
* @brief Creates an uninitialized LinearConstrainer handle.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- LinearConstrainer( LinearConstrainer&& rhs );
+ LinearConstrainer(LinearConstrainer&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- LinearConstrainer& operator=( LinearConstrainer&& rhs );
+ LinearConstrainer& operator=(LinearConstrainer&& rhs);
/**
* @brief Applies the linear constraint to the target property.
* @param[in] range The range of values in the source property which will be mapped to [0,1]
* @param[in] wrap Wrapping domain. Source property will be wrapped in the domain [wrap.x,wrap.y] before mapping to [0,1]. See cfloat.h for FLT_MAX
*/
- void Apply( Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap = Vector2(-FLT_MAX, FLT_MAX) );
+ void Apply(Dali::Property target, Dali::Property source, const Vector2& range, const Vector2& wrap = Vector2(-FLT_MAX, FLT_MAX));
/**
* @brief Removes the linear constraint in the target object.
* @SINCE_1_0.0
* @param[in] target A handle to an object constrained by the LinearConstrainer
*/
- void Remove( Dali::Handle& target );
+ void Remove(Dali::Handle& target);
public: // Not intended for application developers
/// @cond internal
*/
// CLASS HEADER
-#include <dali/public-api/animation/path.h>
#include <dali/internal/event/animation/path-impl.h>
+#include <dali/public-api/animation/path.h>
// INTERNAL INCLUDES
namespace Dali
{
-
Path Path::New()
{
Internal::Path* internal = Internal::Path::New();
return Path(internal);
}
-Path Path::DownCast( BaseHandle handle )
+Path Path::DownCast(BaseHandle handle)
{
- return Path( dynamic_cast<Dali::Internal::Path*>(handle.GetObjectPtr()) );
+ return Path(dynamic_cast<Dali::Internal::Path*>(handle.GetObjectPtr()));
}
Path::Path()
Path& Path::operator=(const Path& rhs) = default;
-Path::Path( Path&& rhs ) = default;
+Path::Path(Path&& rhs) = default;
-Path& Path::operator=( Path&& rhs ) = default;
+Path& Path::operator=(Path&& rhs) = default;
-void Path::AddPoint(const Vector3& point )
+void Path::AddPoint(const Vector3& point)
{
- GetImplementation(*this).AddPoint( point );
+ GetImplementation(*this).AddPoint(point);
}
-void Path::AddControlPoint(const Vector3& point )
+void Path::AddControlPoint(const Vector3& point)
{
- GetImplementation(*this).AddControlPoint( point );
+ GetImplementation(*this).AddControlPoint(point);
}
-void Path::GenerateControlPoints( float curvature )
+void Path::GenerateControlPoints(float curvature)
{
- GetImplementation(*this).GenerateControlPoints( curvature );
+ GetImplementation(*this).GenerateControlPoints(curvature);
}
-
-void Path::Sample( float progress, Vector3& position, Vector3& tangent ) const
+void Path::Sample(float progress, Vector3& position, Vector3& tangent) const
{
- GetImplementation(*this).Sample( progress, position, tangent );
+ GetImplementation(*this).Sample(progress, position, tangent);
}
-Vector3& Path::GetPoint( size_t index )
+Vector3& Path::GetPoint(size_t index)
{
- return GetImplementation(*this).GetPoint( static_cast<uint32_t>( index ) );
+ return GetImplementation(*this).GetPoint(static_cast<uint32_t>(index));
}
-Vector3& Path::GetControlPoint( size_t index )
+Vector3& Path::GetControlPoint(size_t index)
{
- return GetImplementation(*this).GetControlPoint( static_cast<uint32_t>( index ) );
+ return GetImplementation(*this).GetControlPoint(static_cast<uint32_t>(index));
}
size_t Path::GetPointCount() const
return GetImplementation(*this).GetPointCount();
}
-} // Dali
+} // namespace Dali
class DALI_CORE_API Path : public Handle
{
public:
-
/**
* @brief Enumeration for the instance of properties belonging to the Path class.
* @SINCE_1_0.0
*/
enum
{
- POINTS = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "points", type Vector3 @SINCE_1_0.0
- CONTROL_POINTS, ///< name "controlPoints", type Vector3 @SINCE_1_0.0
+ POINTS = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "points", type Vector3 @SINCE_1_0.0
+ CONTROL_POINTS, ///< name "controlPoints", type Vector3 @SINCE_1_0.0
};
};
* @param[in] handle Handle to an object
* @return Handle to a Path object or an uninitialized handle
*/
- static Path DownCast( BaseHandle handle );
+ static Path DownCast(BaseHandle handle);
/**
* @brief Creates an uninitialized Path handle.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Path( Path&& rhs );
+ Path(Path&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- Path& operator=( Path&& rhs );
+ Path& operator=(Path&& rhs);
/**
* @brief Adds an interpolation point.
* @SINCE_1_0.0
* @param[in] point The new interpolation point to be added
*/
- void AddPoint(const Vector3& point );
+ void AddPoint(const Vector3& point);
/**
* @brief Adds a control point.
* @SINCE_1_0.0
* @param[in] point The new control point to be added
*/
- void AddControlPoint(const Vector3& point );
+ void AddControlPoint(const Vector3& point);
/**
* @brief Automatic generation of control points. Generated control points which result in a smooth join between the splines of each segment.
* @pre There are at least two points in the path ( one segment ).
*
*/
- void GenerateControlPoints( float curvature );
+ void GenerateControlPoints(float curvature);
/**
* @brief Sample path at a given progress. Calculates position and tangent at that point of the curve.
* @param[out] position The interpolated position at that progress
* @param[out] tangent The interpolated tangent at that progress
*/
- void Sample( float progress, Vector3& position, Vector3& tangent ) const;
+ void Sample(float progress, Vector3& position, Vector3& tangent) const;
/**
* @brief Accessor for the interpolation points.
* @param[in] index The index of the interpolation point
* @return A reference to the interpolation point
*/
- Vector3& GetPoint( size_t index );
+ Vector3& GetPoint(size_t index);
/**
* @brief Accessor for the control points.
* @param[in] index The index of the control point
* @return A reference to the control point
*/
- Vector3& GetControlPoint( size_t index );
+ Vector3& GetControlPoint(size_t index);
/**
* @brief Gets the number of interpolation points in the path.
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
TimePeriod::TimePeriod(float duration)
: delaySeconds(0.0f),
durationSeconds(duration)
*/
namespace ParentOrigin
{
-static constexpr float TOP = 0.0f;
-static constexpr float BOTTOM = 1.0f;
-static constexpr float LEFT = 0.0f;
-static constexpr float RIGHT = 1.0f;
-static constexpr float MIDDLE = 0.5f;
-static constexpr Vector3 TOP_LEFT (0.0f, 0.0f, 0.5f);
-static constexpr Vector3 TOP_CENTER (0.5f, 0.0f, 0.5f);
-static constexpr Vector3 TOP_RIGHT (1.0f, 0.0f, 0.5f);
-static constexpr Vector3 CENTER_LEFT (0.0f, 0.5f, 0.5f);
-static constexpr Vector3 CENTER (0.5f, 0.5f, 0.5f);
-static constexpr Vector3 CENTER_RIGHT (1.0f, 0.5f, 0.5f);
-static constexpr Vector3 BOTTOM_LEFT (0.0f, 1.0f, 0.5f);
+static constexpr float TOP = 0.0f;
+static constexpr float BOTTOM = 1.0f;
+static constexpr float LEFT = 0.0f;
+static constexpr float RIGHT = 1.0f;
+static constexpr float MIDDLE = 0.5f;
+static constexpr Vector3 TOP_LEFT(0.0f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_CENTER(0.5f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_RIGHT(1.0f, 0.0f, 0.5f);
+static constexpr Vector3 CENTER_LEFT(0.0f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER(0.5f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER_RIGHT(1.0f, 0.5f, 0.5f);
+static constexpr Vector3 BOTTOM_LEFT(0.0f, 1.0f, 0.5f);
static constexpr Vector3 BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
-static constexpr Vector3 BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
-static constexpr Vector3 DEFAULT( TOP_LEFT );
-}
+static constexpr Vector3 BOTTOM_RIGHT(1.0f, 1.0f, 0.5f);
+static constexpr Vector3 DEFAULT(TOP_LEFT);
+} // namespace ParentOrigin
/**
* @brief AnchorPoint constants.
*/
namespace AnchorPoint
{
-static constexpr float TOP = 0.0f;
-static constexpr float BOTTOM = 1.0f;
-static constexpr float LEFT = 0.0f;
-static constexpr float RIGHT = 1.0f;
-static constexpr float MIDDLE = 0.5f;
-static constexpr Vector3 TOP_LEFT (0.0f, 0.0f, 0.5f);
-static constexpr Vector3 TOP_CENTER (0.5f, 0.0f, 0.5f);
-static constexpr Vector3 TOP_RIGHT (1.0f, 0.0f, 0.5f);
-static constexpr Vector3 CENTER_LEFT (0.0f, 0.5f, 0.5f);
-static constexpr Vector3 CENTER (0.5f, 0.5f, 0.5f);
-static constexpr Vector3 CENTER_RIGHT (1.0f, 0.5f, 0.5f);
-static constexpr Vector3 BOTTOM_LEFT (0.0f, 1.0f, 0.5f);
+static constexpr float TOP = 0.0f;
+static constexpr float BOTTOM = 1.0f;
+static constexpr float LEFT = 0.0f;
+static constexpr float RIGHT = 1.0f;
+static constexpr float MIDDLE = 0.5f;
+static constexpr Vector3 TOP_LEFT(0.0f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_CENTER(0.5f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_RIGHT(1.0f, 0.0f, 0.5f);
+static constexpr Vector3 CENTER_LEFT(0.0f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER(0.5f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER_RIGHT(1.0f, 0.5f, 0.5f);
+static constexpr Vector3 BOTTOM_LEFT(0.0f, 1.0f, 0.5f);
static constexpr Vector3 BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
-static constexpr Vector3 BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
-static constexpr Vector3 DEFAULT( CENTER );
-}
-
+static constexpr Vector3 BOTTOM_RIGHT(1.0f, 1.0f, 0.5f);
+static constexpr Vector3 DEFAULT(CENTER);
+} // namespace AnchorPoint
/**
* @brief Color Constants.
*/
namespace Color
{
-static constexpr Vector4 BLACK( 0.0f, 0.0f, 0.0f, 1.0f );
-static constexpr Vector4 WHITE( 1.0f, 1.0f, 1.0f, 1.0f );
-static constexpr Vector4 RED( 1.0f, 0.0f, 0.0f, 1.0f );
-static constexpr Vector4 GREEN( 0.0f, 1.0f, 0.0f, 1.0f );
-static constexpr Vector4 BLUE( 0.0f, 0.0f, 1.0f, 1.0f );
-static constexpr Vector4 YELLOW( 1.0f, 1.0f, 0.0f, 1.0f );
-static constexpr Vector4 MAGENTA( 1.0f, 0.0f, 1.0f, 1.0f );
-static constexpr Vector4 CYAN( 0.0f, 1.0f, 1.0f, 1.0f );
-static constexpr Vector4 TRANSPARENT( 0.0f, 0.0f, 0.0f, 0.0f );
+static constexpr Vector4 BLACK(0.0f, 0.0f, 0.0f, 1.0f);
+static constexpr Vector4 WHITE(1.0f, 1.0f, 1.0f, 1.0f);
+static constexpr Vector4 RED(1.0f, 0.0f, 0.0f, 1.0f);
+static constexpr Vector4 GREEN(0.0f, 1.0f, 0.0f, 1.0f);
+static constexpr Vector4 BLUE(0.0f, 0.0f, 1.0f, 1.0f);
+static constexpr Vector4 YELLOW(1.0f, 1.0f, 0.0f, 1.0f);
+static constexpr Vector4 MAGENTA(1.0f, 0.0f, 1.0f, 1.0f);
+static constexpr Vector4 CYAN(0.0f, 1.0f, 1.0f, 1.0f);
+static constexpr Vector4 TRANSPARENT(0.0f, 0.0f, 0.0f, 0.0f);
} // namespace Color
static constexpr float MACHINE_EPSILON_10000 = Epsilon<10000>::value;
// float is preferred to double for performance on ARM targets
-static constexpr float PI = static_cast<float>(M_PI); ///< Pi
-static constexpr float PI_2 = static_cast<float>(M_PI_2); ///< Pi/2
-static constexpr float PI_4 = static_cast<float>(M_PI_4); ///< Pi/4
-static constexpr float PI_OVER_180 = Dali::Math::PI/180.0f; ///< Constant used to convert degree to radian
-static constexpr float ONE80_OVER_PI = 180.0f/Dali::Math::PI; ///< Constant used to convert radian to degree
+static constexpr float PI = static_cast<float>(M_PI); ///< Pi
+static constexpr float PI_2 = static_cast<float>(M_PI_2); ///< Pi/2
+static constexpr float PI_4 = static_cast<float>(M_PI_4); ///< Pi/4
+static constexpr float PI_OVER_180 = Dali::Math::PI / 180.0f; ///< Constant used to convert degree to radian
+static constexpr float ONE80_OVER_PI = 180.0f / Dali::Math::PI; ///< Constant used to convert radian to degree
} // namespace Math
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// EXTERNAL INCLUDES
#include <stdlib.h>
-#include <string>
#include <cstdio>
+#include <string>
#if defined(BACKTRACE_ENABLED)
#if defined(__GLIBC__)
namespace Dali
{
-
#if defined(BACKTRACE_ENABLED)
namespace
if(openParen != NULL)
{
const char* startOfToken = openParen + 1;
- const char* plus = strchr(startOfToken, '+');
- const char* closeParen = strchr(startOfToken, ')');
- const char* endOfToken = NULL;
+ const char* plus = strchr(startOfToken, '+');
+ const char* closeParen = strchr(startOfToken, ')');
+ const char* endOfToken = NULL;
if(plus != NULL)
{
endOfToken = plus;
size_t tokenLength = endOfToken - startOfToken;
// Allocate space for symbol
- char *mangledSymbol = reinterpret_cast< char* >( malloc( tokenLength + 1u ) );
+ char* mangledSymbol = reinterpret_cast<char*>(malloc(tokenLength + 1u));
if(mangledSymbol != NULL)
{
strncpy(mangledSymbol, startOfToken, tokenLength);
mangledSymbol[tokenLength] = '\0';
- size_t size;
- int32_t status;
- char* demangled=NULL;
- demangled = abi::__cxa_demangle( mangledSymbol, NULL, &size, &status );
- if( demangled != NULL )
+ size_t size;
+ int32_t status;
+ char* demangled = NULL;
+ demangled = abi::__cxa_demangle(mangledSymbol, NULL, &size, &status);
+ if(demangled != NULL)
{
result = demangled;
free(demangled); // demangle() allocates returned string, so free it
return result;
}
-DALI_CORE_API DaliException::DaliException( const char* location, const char* condition )
-: location( location ), condition( condition )
+DALI_CORE_API DaliException::DaliException(const char* location, const char* condition)
+: location(location),
+ condition(condition)
{
// Note, if a memory error has occured, then the backtrace won't work - backtrace_symbols relies on
// allocating memory.
#if defined(DEBUG_ENABLED)
fprintf(stderr, "Exception: \n%s\n thrown at %s\nSee dlog for backtrace\n", condition, location);
#else
- fprintf(stderr, "Exception: \n%s\n thrown\nSee dlog for backtrace\n", condition );
+ fprintf(stderr, "Exception: \n%s\n thrown\nSee dlog for backtrace\n", condition);
#endif
DALI_LOG_ERROR_NOFN("Backtrace:\n");
- void* frameArray[MAX_NUM_STACK_FRAMES];
- int32_t nSize = backtrace(frameArray, MAX_NUM_STACK_FRAMES);
- char** symbols = backtrace_symbols(frameArray, nSize);
- for(int32_t i=1; i< nSize; i++)
+ void* frameArray[MAX_NUM_STACK_FRAMES];
+ int32_t nSize = backtrace(frameArray, MAX_NUM_STACK_FRAMES);
+ char** symbols = backtrace_symbols(frameArray, nSize);
+ for(int32_t i = 1; i < nSize; i++)
{
std::string demangled_symbol = Demangle(symbols[i]);
- DALI_LOG_ERROR_NOFN("[%02d] %s\n", i, demangled_symbol.c_str() );
+ DALI_LOG_ERROR_NOFN("[%02d] %s\n", i, demangled_symbol.c_str());
}
free(symbols);
}
-
#else // BACKTRACE_ENABLED
-DALI_CORE_API DaliException::DaliException( const char* location, const char* condition )
-: location( location ), condition( condition )
+DALI_CORE_API DaliException::DaliException(const char* location, const char* condition)
+: location(location),
+ condition(condition)
{
#if defined(DEBUG_ENABLED)
- printf("Exception: \n%s\n thrown at %s\n", condition, location );
+ printf("Exception: \n%s\n thrown at %s\n", condition, location);
#else
- printf("Exception: \n%s\n thrown\n", condition );
+ printf("Exception: \n%s\n thrown\n", condition);
#endif
}
-
#endif // BACKTRACE_ENABLED
-DALI_CORE_API void DaliAssertMessage( const char* location, const char* condition )
+DALI_CORE_API void DaliAssertMessage(const char* location, const char* condition)
{
#if defined(DEBUG_ENABLED)
- DALI_LOG_ERROR_NOFN( "Assert (%s) failed in: %s\n", condition, location );
+ DALI_LOG_ERROR_NOFN("Assert (%s) failed in: %s\n", condition, location);
#else
- DALI_LOG_ERROR_NOFN( "Assert (%s) failed\n", condition );
+ DALI_LOG_ERROR_NOFN("Assert (%s) failed\n", condition);
#endif
}
-} // Dali
+} // namespace Dali
* When building a library that uses DALI, HIDE_DALI_INTERNALS.
*/
#if __GNUC__ >= 4
-# ifndef HIDE_DALI_INTERNALS
-# define DALI_EXPORT_API
-# define DALI_NO_EXPORT_API
-# define DALI_IMPORT_API
-# define DALI_CORE_API
-# define DALI_INTERNAL
-# else
-# define DALI_EXPORT_API __attribute__ ((visibility ("default")))
-# define DALI_NO_EXPORT_API __attribute__ ((visibility ("hidden")))
-# define DALI_IMPORT_API __attribute__ ((visibility ("default")))
-# define DALI_CORE_API __attribute__ ((visibility ("default")))
-# define DALI_INTERNAL __attribute__ ((visibility ("hidden")))
-# endif
+#ifndef HIDE_DALI_INTERNALS
+#define DALI_EXPORT_API
+#define DALI_NO_EXPORT_API
+#define DALI_IMPORT_API
+#define DALI_CORE_API
+#define DALI_INTERNAL
+#else
+#define DALI_EXPORT_API __attribute__((visibility("default")))
+#define DALI_NO_EXPORT_API __attribute__((visibility("hidden")))
+#define DALI_IMPORT_API __attribute__((visibility("default")))
+#define DALI_CORE_API __attribute__((visibility("default")))
+#define DALI_INTERNAL __attribute__((visibility("hidden")))
+#endif
#else
#ifdef WIN32
- /** Visibility attribute to show declarations */
-# define DALI_EXPORT_API __declspec(dllexport)
+/** Visibility attribute to show declarations */
+#define DALI_EXPORT_API __declspec(dllexport)
#ifdef BUILDING_DALI_CORE
- /** Visibility attribute to hide declarations */
-# define DALI_CORE_API __declspec(dllexport)
+/** Visibility attribute to hide declarations */
+#define DALI_CORE_API __declspec(dllexport)
#else
/** Visibility attribute to hide declarations */
-# define DALI_CORE_API __declspec(dllimport)
+#define DALI_CORE_API __declspec(dllimport)
#endif
#else
- /** Visibility attribute to show declarations */
-# define DALI_EXPORT_API
/** Visibility attribute to show declarations */
-# define DALI_IMPORT_API
+#define DALI_EXPORT_API
+/** Visibility attribute to show declarations */
+#define DALI_IMPORT_API
/** Visibility attribute to show declarations */
-# define DALI_CORE_API
+#define DALI_CORE_API
#endif
/** Visibility attribute to hide declarations */
-# define DALI_INTERNAL
-# define DALI_NO_EXPORT_API
+#define DALI_INTERNAL
+#define DALI_NO_EXPORT_API
#endif
#ifdef DEPRECATION_WARNING
#define DALI_DEPRECATED_API
#endif
-#if defined (__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
+#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
// C++0x support
#define _CPP11
#else
* @SINCE_1_0.0
*/
#ifdef __GNUC
-#define DALI_LIKELY(expression) __builtin_expect( !!(expression), 1 )
-#define DALI_UNLIKELY(expression) __builtin_expect( !!(expression), 0 )
+#define DALI_LIKELY(expression) __builtin_expect(!!(expression), 1)
+#define DALI_UNLIKELY(expression) __builtin_expect(!!(expression), 0)
#else
-#define DALI_LIKELY(expression) !!(expression)
+#define DALI_LIKELY(expression) !!(expression)
#define DALI_UNLIKELY(expression) !!(expression)
#endif
* @param[in] location Where the assertion occurred
* @param[in] condition The assertion condition
*/
-DALI_CORE_API void DaliAssertMessage( const char* location, const char* condition );
+DALI_CORE_API void DaliAssertMessage(const char* location, const char* condition);
/**
* @brief Exception class for Dali Core library - Raised by assertions in codebase.
* @param[in] location The location of the assertion
* @param[in] condition The assertion condition
*/
- DaliException( const char* location, const char* condition );
+ DaliException(const char* location, const char* condition);
const char* location;
const char* condition;
/**
* @}
*/
-}// Dali
+} // namespace Dali
/**
* @brief An invariant concurrent assertion to ensure its argument always evaluates TRUE.
#define ASSERT_LOCATION NULL
#endif
-#define DALI_ASSERT_ALWAYS(cond) \
- if(DALI_UNLIKELY(!(cond))) \
- { \
- Dali::DaliAssertMessage( ASSERT_LOCATION, #cond ); \
- throw Dali::DaliException( ASSERT_LOCATION, #cond ); \
+#define DALI_ASSERT_ALWAYS(cond) \
+ if(DALI_UNLIKELY(!(cond))) \
+ { \
+ Dali::DaliAssertMessage(ASSERT_LOCATION, #cond); \
+ throw Dali::DaliException(ASSERT_LOCATION, #cond); \
}
-#define DALI_ABORT(message) \
- { \
- Dali::DaliAssertMessage( ASSERT_LOCATION, message ); \
- throw Dali::DaliException( ASSERT_LOCATION, message ); \
+#define DALI_ABORT(message) \
+ { \
+ Dali::DaliAssertMessage(ASSERT_LOCATION, message); \
+ throw Dali::DaliException(ASSERT_LOCATION, message); \
}
/**
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
VectorBase::VectorBase()
- : mData( nullptr )
+: mData(nullptr)
{
}
VectorBase::SizeType VectorBase::Capacity() const
{
SizeType capacity = 0u;
- if( mData )
+ if(mData)
{
- SizeType* metadata = reinterpret_cast< SizeType* >( mData );
- capacity = *(metadata - 2u);
+ SizeType* metadata = reinterpret_cast<SizeType*>(mData);
+ capacity = *(metadata - 2u);
}
return capacity;
}
-
void VectorBase::Release()
{
- if( mData )
+ if(mData)
{
// adjust pointer to real beginning
- SizeType* metadata = reinterpret_cast< SizeType* >( mData );
+ SizeType* metadata = reinterpret_cast<SizeType*>(mData);
- delete [] ( metadata - 2u );
+ delete[](metadata - 2u);
mData = nullptr;
}
}
-void VectorBase::SetCount( SizeType count )
+void VectorBase::SetCount(SizeType count)
{
// someone can call Resize( 0u ) before ever populating the vector
- if( mData )
+ if(mData)
{
- SizeType* metadata = reinterpret_cast< SizeType* >( mData );
- *(metadata - 1u) = count;
+ SizeType* metadata = reinterpret_cast<SizeType*>(mData);
+ *(metadata - 1u) = count;
}
}
-void VectorBase::Reserve( SizeType capacity, SizeType elementSize )
+void VectorBase::Reserve(SizeType capacity, SizeType elementSize)
{
SizeType oldCapacity = Capacity();
- SizeType oldCount = Count();
- if( capacity > oldCapacity )
+ SizeType oldCount = Count();
+ if(capacity > oldCapacity)
{
const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize;
- void* wholeData = reinterpret_cast< void* >( new uint8_t[ wholeAllocation ] );
- DALI_ASSERT_ALWAYS( wholeData && "VectorBase::Reserve - Memory allocation failed" );
+ void* wholeData = reinterpret_cast<void*>(new uint8_t[wholeAllocation]);
+ DALI_ASSERT_ALWAYS(wholeData && "VectorBase::Reserve - Memory allocation failed");
-#if defined( DEBUG_ENABLED )
+#if defined(DEBUG_ENABLED)
// in debug build this will help identify a vector of uninitialized data
- memset( wholeData, 0xaa, wholeAllocation );
+ memset(wholeData, 0xaa, wholeAllocation);
#endif
- SizeType* metaData = reinterpret_cast< SizeType* >( wholeData );
- *metaData++ = capacity;
- *metaData++ = oldCount;
- if( mData )
+ SizeType* metaData = reinterpret_cast<SizeType*>(wholeData);
+ *metaData++ = capacity;
+ *metaData++ = oldCount;
+ if(mData)
{
// copy over the old data
- memcpy( metaData, mData, oldCount * elementSize );
+ memcpy(metaData, mData, oldCount * elementSize);
// release old buffer
Release();
}
}
}
-void VectorBase::Copy( const VectorBase& vector, SizeType elementSize )
+void VectorBase::Copy(const VectorBase& vector, SizeType elementSize)
{
// release old data
Release();
// reserve space based on source capacity
const SizeType capacity = vector.Capacity();
- Reserve( capacity, elementSize );
+ Reserve(capacity, elementSize);
// copy over whole data
const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize;
- SizeType* srcData = reinterpret_cast< SizeType* >( vector.mData );
- SizeType* dstData = reinterpret_cast< SizeType* >( mData );
- memcpy( dstData - 2u, srcData - 2u, wholeAllocation );
+ SizeType* srcData = reinterpret_cast<SizeType*>(vector.mData);
+ SizeType* dstData = reinterpret_cast<SizeType*>(mData);
+ memcpy(dstData - 2u, srcData - 2u, wholeAllocation);
}
-void VectorBase::Swap( VectorBase& vector )
+void VectorBase::Swap(VectorBase& vector)
{
// just swap the data pointers, metadata will swap as side effect
- std::swap( mData, vector.mData );
+ std::swap(mData, vector.mData);
}
-void VectorBase::Erase( char* address, SizeType elementSize )
+void VectorBase::Erase(char* address, SizeType elementSize)
{
// erase can be called on an unallocated vector
- if( mData )
+ if(mData)
{
- uint8_t* startAddress = reinterpret_cast< uint8_t* >( address ) + elementSize;
- const uint8_t* endAddress = reinterpret_cast< uint8_t* >( mData ) + Count() * elementSize;
- SizeType numberOfBytes = endAddress - startAddress;
+ uint8_t* startAddress = reinterpret_cast<uint8_t*>(address) + elementSize;
+ const uint8_t* endAddress = reinterpret_cast<uint8_t*>(mData) + Count() * elementSize;
+ SizeType numberOfBytes = endAddress - startAddress;
// addresses overlap so use memmove
- memmove( address, startAddress, numberOfBytes );
- SetCount( Count() - 1u );
+ memmove(address, startAddress, numberOfBytes);
+ SetCount(Count() - 1u);
}
}
-char* VectorBase::Erase( char* first, char* last, SizeType elementSize )
+char* VectorBase::Erase(char* first, char* last, SizeType elementSize)
{
char* next = nullptr;
- if( mData )
+ if(mData)
{
- uint8_t* startAddress = reinterpret_cast< uint8_t* >( last );
- const uint8_t* endAddress = reinterpret_cast< uint8_t* >( mData ) + Count() * elementSize;
- SizeType numberOfBytes = endAddress - startAddress;
+ uint8_t* startAddress = reinterpret_cast<uint8_t*>(last);
+ const uint8_t* endAddress = reinterpret_cast<uint8_t*>(mData) + Count() * elementSize;
+ SizeType numberOfBytes = endAddress - startAddress;
// addresses overlap so use memmove
- memmove( first, startAddress, numberOfBytes );
- SetCount( Count() - ( last - first ) / elementSize );
+ memmove(first, startAddress, numberOfBytes);
+ SetCount(Count() - (last - first) / elementSize);
next = first;
}
return next;
}
-void VectorBase::CopyMemory( char* destination, const char* source, size_t numberOfBytes )
+void VectorBase::CopyMemory(char* destination, const char* source, size_t numberOfBytes)
{
- if( ( ( source < destination ) && ( source + numberOfBytes > destination ) ) ||
- ( ( destination < source ) && ( destination + numberOfBytes > source ) ) )
+ if(((source < destination) && (source + numberOfBytes > destination)) ||
+ ((destination < source) && (destination + numberOfBytes > source)))
{
// If there is overlap, use memmove.
- memmove( destination, source, numberOfBytes );
+ memmove(destination, source, numberOfBytes);
}
else
{
// It's safe to use memcpy if there isn't overlap.
- memcpy( destination, source, numberOfBytes );
+ memcpy(destination, source, numberOfBytes);
}
}
} // namespace Dali
-
*/
// EXTERNAL INCLUDES
-#include <cstddef>
#include <algorithm>
+#include <cstddef>
#include <cstdint> // uint32_t
// INTERNAL INCLUDES
* For Application use, asserts can be enabled manually.
* @SINCE_1_0.0
*/
-#if defined( DEBUG_ENABLED )
+#if defined(DEBUG_ENABLED)
#define ENABLE_VECTOR_ASSERTS
#endif
-#if defined( ENABLE_VECTOR_ASSERTS )
+#if defined(ENABLE_VECTOR_ASSERTS)
#define DALI_ASSERT_VECTOR(cond) DALI_ASSERT_ALWAYS(cond)
#else
#define DALI_ASSERT_VECTOR(cond)
using SizeType = std::size_t;
protected: // Construction
-
/**
* @brief Default constructor. Does not allocate space.
* @SINCE_1_0.0
~VectorBase();
public: // API
-
/**
* @brief This method is inlined as it's needed frequently for Vector::End() iterator.
*
SizeType Count() const
{
SizeType items = 0u;
- if( mData )
+ if(mData)
{
- SizeType* metadata = reinterpret_cast< SizeType* >( mData );
- items = *(metadata - 1u);
+ SizeType* metadata = reinterpret_cast<SizeType*>(mData);
+ items = *(metadata - 1u);
}
return items;
}
void Release();
protected: // for Derived classes
-
/**
* @brief Helper to set the count.
*
* @SINCE_1_0.0
* @param[in] count Number of elements in the vector
*/
- void SetCount( SizeType count );
+ void SetCount(SizeType count);
/**
* @brief Reserves space in the vector.
* @param[in] count Count of elements to reserve
* @param[in] elementSize Size of a single element
*/
- void Reserve( SizeType count, SizeType elementSize );
+ void Reserve(SizeType count, SizeType elementSize);
/**
* @brief Copy a vector.
* @param[in] vector Vector to copy from
* @param[in] elementSize Size of a single element
*/
- void Copy( const VectorBase& vector, SizeType elementSize );
+ void Copy(const VectorBase& vector, SizeType elementSize);
/**
* @brief Swaps the contents of two vectors.
* @SINCE_1_0.0
* @param[in] vector Vector to swap with
*/
- void Swap( VectorBase& vector );
+ void Swap(VectorBase& vector);
/**
* @brief Erases an element.
* @param[in] elementSize Size to erase
* @pre Last element cannot be erased as there is nothing to move.
*/
- void Erase( char* address, SizeType elementSize );
+ void Erase(char* address, SizeType elementSize);
/**
* @brief Erases a range of elements.
* @param[in] elementSize Size of one of the elements to be erased
* @return Address pointing to the next element of the last one
*/
- char* Erase( char* first, char* last, SizeType elementSize );
+ char* Erase(char* first, char* last, SizeType elementSize);
/**
* @brief Copies a number of bytes from \e source to \e destination.
* @param[in] source Pointer to the source address
* @param[in] numberOfBytes The number of bytes to be copied
*/
- void CopyMemory( char* destination, const char* source, size_t numberOfBytes );
+ void CopyMemory(char* destination, const char* source, size_t numberOfBytes);
private:
-
// not copyable as it does not know the size of elements
- VectorBase( const VectorBase& ) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
- VectorBase& operator=( const VectorBase& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
+ VectorBase(const VectorBase&) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
+ VectorBase& operator=(const VectorBase&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
// not movable as this is handled by deriving classes
- VectorBase( VectorBase&& ) = delete; ///< Deleted move constructor. @SINCE_1_9.25
- VectorBase& operator=( VectorBase&& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_9.25
-
-protected: // Data
+ VectorBase(VectorBase&&) = delete; ///< Deleted move constructor. @SINCE_1_9.25
+ VectorBase& operator=(VectorBase&&) = delete; ///< Deleted copy assignment operator. @SINCE_1_9.25
+protected: // Data
void* mData; ///< Pointer to the data.
-
};
/// @cond internal
* Trivial types do not need destructor or copy constructor called.
* @SINCE_1_0.0
*/
-template< bool IsTrivial >
+template<bool IsTrivial>
class VectorAlgorithms : public VectorBase
{
protected: // API for deriving classes
* @SINCE_1_0.0
*/
VectorAlgorithms()
- { }
+ {
+ }
/**
* @brief Empty destructor.
* @SINCE_1_0.0
*/
~VectorAlgorithms()
- { }
+ {
+ }
/**
* @brief Copy vector contents.
* @param[in] rhs VectorBase object to copy from
* @param[in] elementSize Size of the content
*/
- void Copy( const VectorBase& rhs, SizeType elementSize )
+ void Copy(const VectorBase& rhs, SizeType elementSize)
{
- if( rhs.Capacity() > 0u )
+ if(rhs.Capacity() > 0u)
{
- VectorBase::Copy( rhs, elementSize );
+ VectorBase::Copy(rhs, elementSize);
}
else
{
* @param[in] count Count of elements to reserve
* @param[in] elementSize Size of a single element
*/
- void Reserve( SizeType count, SizeType elementSize )
+ void Reserve(SizeType count, SizeType elementSize)
{
- VectorBase::Reserve( count, elementSize );
+ VectorBase::Reserve(count, elementSize);
}
/**
* @param[in] count Count to resize to
* @param[in] elementSize Size of a single element
*/
- void Resize( SizeType count, SizeType elementSize )
+ void Resize(SizeType count, SizeType elementSize)
{
// reserve will copy old elements as well
- Reserve( count, elementSize );
+ Reserve(count, elementSize);
}
/**
*/
void Clear()
{
- if( mData )
+ if(mData)
{
- VectorBase::SetCount( 0u );
+ VectorBase::SetCount(0u);
}
}
* @param[in] address Address to erase from
* @param[in] elementSize Size to erase
*/
- void Erase( uint8_t* address, SizeType elementSize )
+ void Erase(uint8_t* address, SizeType elementSize)
{
- VectorBase::Erase( reinterpret_cast< char* >( address ), elementSize );
+ VectorBase::Erase(reinterpret_cast<char*>(address), elementSize);
}
/**
* @param[in] elementSize Size of one of the elements to be erased
* @return Address pointing to the next element of the last one
*/
- uint8_t* Erase( uint8_t* first, uint8_t* last, SizeType elementSize )
+ uint8_t* Erase(uint8_t* first, uint8_t* last, SizeType elementSize)
{
- return reinterpret_cast< uint8_t* >( VectorBase::Erase( reinterpret_cast< char* >( first ), reinterpret_cast< char *>( last ), elementSize ) );
+ return reinterpret_cast<uint8_t*>(VectorBase::Erase(reinterpret_cast<char*>(first), reinterpret_cast<char*>(last), elementSize));
}
/**
* @param[in] to Address to the last element to be inserted
* @param[in] elementSize Size of one of the elements to be inserted
*/
- void Insert( uint8_t* at, uint8_t* from, uint8_t* to, SizeType elementSize )
+ void Insert(uint8_t* at, uint8_t* from, uint8_t* to, SizeType elementSize)
{
- const SizeType size = to - from;
- const SizeType count = Count();
+ const SizeType size = to - from;
+ const SizeType count = Count();
const SizeType newCount = count + size / elementSize;
- if( newCount > Capacity() )
+ if(newCount > Capacity())
{
// Calculate the at offset as the pointer is invalid after the Reserve() call.
- std::size_t offset = at - reinterpret_cast<uint8_t*>( mData );
+ std::size_t offset = at - reinterpret_cast<uint8_t*>(mData);
// need more space
- Reserve( NextPowerOfTwo( static_cast<uint32_t>( newCount ) ), elementSize ); // reserve enough space to store at least the next power of two elements of the new required size.
+ Reserve(NextPowerOfTwo(static_cast<uint32_t>(newCount)), elementSize); // reserve enough space to store at least the next power of two elements of the new required size.
// Set the new at pointer.
- at = reinterpret_cast<uint8_t*>( mData ) + offset;
+ at = reinterpret_cast<uint8_t*>(mData) + offset;
}
// set new count first as otherwise the debug assert will hit us
- SetCount( newCount );
+ SetCount(newCount);
// Move current items to a new position inside the vector.
- CopyMemory( reinterpret_cast< char* >( at + size ),
- reinterpret_cast< const char* >( at ),
- ( reinterpret_cast<uint8_t*>( mData ) + count * elementSize ) - at );
+ CopyMemory(reinterpret_cast<char*>(at + size),
+ reinterpret_cast<const char*>(at),
+ (reinterpret_cast<uint8_t*>(mData) + count * elementSize) - at);
// Copy the given items.
- CopyMemory( reinterpret_cast< char* >( at ), reinterpret_cast< const char* >( from ), size );
+ CopyMemory(reinterpret_cast<char*>(at), reinterpret_cast<const char*>(from), size);
}
};
/// @endcond
* @SINCE_1_0.0
*/
template<>
-class VectorAlgorithms< false > : public VectorBase
+class VectorAlgorithms<false> : public VectorBase
{
private:
VectorAlgorithms()
- { }
+ {
+ }
~VectorAlgorithms()
- { }
+ {
+ }
};
/// @endcond
* @SINCE_1_0.0
* @param type The type of the data that the vector holds
*/
-template< class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true >
-class Vector : public VectorAlgorithms< IsTrivialType >
+template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
+class Vector : public VectorAlgorithms<IsTrivialType>
{
public: // API
-
/**
* @brief Type definitions.
* @SINCE_1_0.0
* @SINCE_1_0.0
*/
Vector()
- { }
+ {
+ }
/**
* @brief Destructor. Releases the allocated space.
* @SINCE_1_0.0
* @param[in] vector Vector to copy from
*/
- Vector( const Vector& vector )
+ Vector(const Vector& vector)
{
// reuse copy assignment
- operator=( vector );
+ operator=(vector);
}
/**
* @SINCE_1_9.25
* @param[in] vector Vector to move
*/
- Vector( Vector&& vector )
+ Vector(Vector&& vector)
{
// reuse move assignment
- operator=( std::move( vector ) );
+ operator=(std::move(vector));
}
/**
* @param[in] vector Vector to assign from
* @return Reference to self for chaining
*/
- Vector& operator=( const Vector& vector )
+ Vector& operator=(const Vector& vector)
{
- if( this != &vector )
+ if(this != &vector)
{
- VectorAlgorithms<BaseType>::Copy( vector, sizeof( ItemType ) );
+ VectorAlgorithms<BaseType>::Copy(vector, sizeof(ItemType));
}
return *this;
}
* @SINCE_1_9.25
* @param[in] vector Vector to move
*/
- Vector& operator=( Vector&& vector )
+ Vector& operator=(Vector&& vector)
{
- if( this != &vector )
+ if(this != &vector)
{
- if( VectorBase::mData )
+ if(VectorBase::mData)
{
Release();
}
VectorBase::mData = vector.mData;
- vector.mData = nullptr;
+ vector.mData = nullptr;
}
return *this;
}
*/
Iterator Begin() const
{
- ItemType* address = reinterpret_cast<ItemType*>( VectorBase::mData );
+ ItemType* address = reinterpret_cast<ItemType*>(VectorBase::mData);
return address;
}
*/
Iterator End() const
{
- ItemType* address = reinterpret_cast<ItemType*>( VectorBase::mData );
+ ItemType* address = reinterpret_cast<ItemType*>(VectorBase::mData);
address += VectorBase::Count();
return address;
}
* @return Reference to the element for given index
* @pre Index must be in the vector's range.
*/
- ItemType& operator[]( SizeType index )
+ ItemType& operator[](SizeType index)
{
// reuse the const version
- return const_cast< ItemType& >( const_cast< const Vector< ItemType >& >( *this )[ index ] );
+ return const_cast<ItemType&>(const_cast<const Vector<ItemType>&>(*this)[index]);
}
/**
* @return Reference to the element for given index
* @pre Index must be in the vector's range.
*/
- const ItemType& operator[]( SizeType index ) const
+ const ItemType& operator[](SizeType index) const
{
- DALI_ASSERT_VECTOR( VectorBase::mData && "Vector is empty" );
- DALI_ASSERT_VECTOR( index < VectorBase::Count() && "Index out of bounds" );
- ItemType* address = reinterpret_cast<ItemType*>( VectorBase::mData );
+ DALI_ASSERT_VECTOR(VectorBase::mData && "Vector is empty");
+ DALI_ASSERT_VECTOR(index < VectorBase::Count() && "Index out of bounds");
+ ItemType* address = reinterpret_cast<ItemType*>(VectorBase::mData);
address += index;
return *address;
}
* @SINCE_1_0.0
* @param[in] element Element to be added
*/
- void PushBack( const ItemType& element )
+ void PushBack(const ItemType& element)
{
- const SizeType count = VectorBase::Count();
+ const SizeType count = VectorBase::Count();
const SizeType newCount = count + 1u;
const SizeType capacity = VectorBase::Capacity();
- if( newCount > capacity )
+ if(newCount > capacity)
{
// need more space
- Reserve( newCount << 1u ); // reserve double the current count
+ Reserve(newCount << 1u); // reserve double the current count
}
// set new count first as otherwise the debug assert will hit us
- VectorBase::SetCount( newCount );
- operator[]( count ) = element;
+ VectorBase::SetCount(newCount);
+ operator[](count) = element;
}
/**
* @param[in] element An element to be added
* @pre Iterator at must be in the vector's range ( Vector::Begin(), Vector::End() ).
*/
- void Insert( Iterator at, const ItemType& element )
+ void Insert(Iterator at, const ItemType& element)
{
- DALI_ASSERT_VECTOR( ( at <= End() ) && ( at >= Begin() ) && "Iterator not inside vector" );
- const SizeType size = sizeof( ItemType );
- uint8_t* address = const_cast<uint8_t*>( reinterpret_cast<const uint8_t*>( &element ) );
- VectorAlgorithms<BaseType>::Insert( reinterpret_cast< uint8_t* >( at ),
- address,
- address + size,
- size );
+ DALI_ASSERT_VECTOR((at <= End()) && (at >= Begin()) && "Iterator not inside vector");
+ const SizeType size = sizeof(ItemType);
+ uint8_t* address = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(&element));
+ VectorAlgorithms<BaseType>::Insert(reinterpret_cast<uint8_t*>(at),
+ address,
+ address + size,
+ size);
}
/**
* @pre Iterator \e from must not be grater than Iterator \e to.
*
*/
- void Insert( Iterator at, Iterator from, Iterator to )
+ void Insert(Iterator at, Iterator from, Iterator to)
{
- DALI_ASSERT_VECTOR( ( at <= End() ) && ( at >= Begin() ) && "Iterator not inside vector" );
- DALI_ASSERT_VECTOR( ( from <= to ) && "from address can't be greater than to" );
+ DALI_ASSERT_VECTOR((at <= End()) && (at >= Begin()) && "Iterator not inside vector");
+ DALI_ASSERT_VECTOR((from <= to) && "from address can't be greater than to");
- if( from == to )
+ if(from == to)
{
// nothing to copy.
return;
}
- VectorAlgorithms<BaseType>::Insert( reinterpret_cast< uint8_t* >( at ),
- reinterpret_cast< uint8_t* >( from ),
- reinterpret_cast< uint8_t* >( to ),
- sizeof( ItemType ) );
+ VectorAlgorithms<BaseType>::Insert(reinterpret_cast<uint8_t*>(at),
+ reinterpret_cast<uint8_t*>(from),
+ reinterpret_cast<uint8_t*>(to),
+ sizeof(ItemType));
}
/**
* @SINCE_1_0.0
* @param[in] count Count of elements to reserve
*/
- void Reserve( SizeType count )
+ void Reserve(SizeType count)
{
- VectorAlgorithms<BaseType>::Reserve( count, sizeof( ItemType ) );
+ VectorAlgorithms<BaseType>::Reserve(count, sizeof(ItemType));
}
/**
* @SINCE_1_0.0
* @param[in] count Count to resize to
*/
- void Resize( SizeType count )
+ void Resize(SizeType count)
{
ItemType item = ItemType();
Resize(count, item);
* @SINCE_1_9.27
* @param[in] count Count to resize to
*/
- void ResizeUninitialized( SizeType count )
+ void ResizeUninitialized(SizeType count)
{
- Reserve( count );
- VectorBase::SetCount( count );
+ Reserve(count);
+ VectorBase::SetCount(count);
}
/**
* @param[in] count Count to resize to
* @param[in] item An item to insert to the new indices
*/
- void Resize( SizeType count, const ItemType& item )
+ void Resize(SizeType count, const ItemType& item)
{
const SizeType oldCount = VectorBase::Count();
- if( count <= oldCount )
+ if(count <= oldCount)
{
// getting smaller so just set count
- VectorBase::SetCount( count );
+ VectorBase::SetCount(count);
}
else
{
// remember how many new items get added
SizeType newItems = count - oldCount;
- Reserve( count );
- for( ; newItems > 0u; --newItems )
+ Reserve(count);
+ for(; newItems > 0u; --newItems)
{
- PushBack( item );
+ PushBack(item);
}
}
}
* @pre Iterator \e iterator must be within the vector's range ( Vector::Begin(), Vector::End() - 1 ).
*
*/
- Iterator Erase( Iterator iterator )
+ Iterator Erase(Iterator iterator)
{
- DALI_ASSERT_VECTOR( (iterator < End()) && (iterator >= Begin()) && "Iterator not inside vector" );
- if( iterator < ( End() - 1u ) )
+ DALI_ASSERT_VECTOR((iterator < End()) && (iterator >= Begin()) && "Iterator not inside vector");
+ if(iterator < (End() - 1u))
{
- VectorAlgorithms<BaseType>::Erase( reinterpret_cast< uint8_t* >( iterator ), sizeof( ItemType ) );
+ VectorAlgorithms<BaseType>::Erase(reinterpret_cast<uint8_t*>(iterator), sizeof(ItemType));
}
else
{
// just remove the element
- Remove( iterator );
+ Remove(iterator);
}
return iterator;
}
* @pre Iterator \e first must not be grater than Iterator \e last.
*
*/
- Iterator Erase( Iterator first, Iterator last )
+ Iterator Erase(Iterator first, Iterator last)
{
- DALI_ASSERT_VECTOR( ( first <= End() ) && ( first >= Begin() ) && "Iterator not inside vector" );
- DALI_ASSERT_VECTOR( ( last <= End() ) && ( last >= Begin() ) && "Iterator not inside vector" );
- DALI_ASSERT_VECTOR( ( first <= last ) && "first iterator greater than last" );
+ DALI_ASSERT_VECTOR((first <= End()) && (first >= Begin()) && "Iterator not inside vector");
+ DALI_ASSERT_VECTOR((last <= End()) && (last >= Begin()) && "Iterator not inside vector");
+ DALI_ASSERT_VECTOR((first <= last) && "first iterator greater than last");
Iterator nextElement;
- if( last == End() )
+ if(last == End())
{
// Erase up to the end.
- VectorBase::SetCount( VectorBase::Count() - ( last - first ) );
+ VectorBase::SetCount(VectorBase::Count() - (last - first));
nextElement = End();
}
else
{
- nextElement = reinterpret_cast<Iterator>( VectorAlgorithms<BaseType>::Erase( reinterpret_cast< uint8_t* >( first ),
- reinterpret_cast< uint8_t* >( last ),
- sizeof( ItemType ) ) );
+ nextElement = reinterpret_cast<Iterator>(VectorAlgorithms<BaseType>::Erase(reinterpret_cast<uint8_t*>(first),
+ reinterpret_cast<uint8_t*>(last),
+ sizeof(ItemType)));
}
return nextElement;
* @pre Iterator \e iterator must be in the vector's range ( Vector::Begin(), Vector::End() - 1 ).
*
*/
- void Remove( Iterator iterator )
+ void Remove(Iterator iterator)
{
- DALI_ASSERT_VECTOR( (iterator < End()) && (iterator >= Begin()) && "Iterator not inside vector" );
+ DALI_ASSERT_VECTOR((iterator < End()) && (iterator >= Begin()) && "Iterator not inside vector");
Iterator last = End() - 1u;
- if( last > iterator )
+ if(last > iterator)
{
- std::swap( *iterator, *last );
+ std::swap(*iterator, *last);
}
- VectorBase::SetCount( VectorBase::Count() - 1u );
+ VectorBase::SetCount(VectorBase::Count() - 1u);
}
/**
* @SINCE_1_0.0
* @param[in] vector Vector to swap with
*/
- void Swap( Vector& vector )
+ void Swap(Vector& vector)
{
- VectorBase::Swap( vector );
+ VectorBase::Swap(vector);
}
/**
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
Extents::Extents()
: start(0),
end(0),
top(0),
bottom(0)
- {
- }
+{
+}
-Extents::Extents( uint16_t start, uint16_t end, uint16_t top, uint16_t bottom )
-: start( start ),
- end( end ),
- top( top ),
- bottom( bottom )
- {
- }
+Extents::Extents(uint16_t start, uint16_t end, uint16_t top, uint16_t bottom)
+: start(start),
+ end(end),
+ top(top),
+ bottom(bottom)
+{
+}
-Extents& Extents::operator=( const uint16_t* array )
+Extents& Extents::operator=(const uint16_t* array)
{
- start = array[0];
- end = array[1];
- top = array[2];
+ start = array[0];
+ end = array[1];
+ top = array[2];
bottom = array[3];
return *this;
}
-bool Extents::operator==( const Extents &rhs ) const
+bool Extents::operator==(const Extents& rhs) const
{
- return ( start == rhs.start )&&
- ( end == rhs.end )&&
- ( top == rhs.top )&&
- ( bottom == rhs.bottom );
+ return (start == rhs.start) &&
+ (end == rhs.end) &&
+ (top == rhs.top) &&
+ (bottom == rhs.bottom);
}
-bool Extents::operator!=( const Extents &rhs ) const
+bool Extents::operator!=(const Extents& rhs) const
{
- return !( *this == rhs );
+ return !(*this == rhs);
}
-std::ostream& operator<<( std::ostream& stream, const Extents& extents )
+std::ostream& operator<<(std::ostream& stream, const Extents& extents)
{
return stream << "[" << extents.start << ", " << extents.end << ", " << extents.top << ", " << extents.bottom << "]";
}
-} // Dali
+} // namespace Dali
#define DALI_EXTENTS_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
* @SINCE_1_2.62
* @param[in] copy A reference to the copied Extents
*/
- Extents( const Extents& copy ) = default;
+ Extents(const Extents& copy) = default;
/**
* @brief Constructor.
* @param[in] top Top extent
* @param[in] bottom Bottom extent
*/
- Extents( uint16_t start, uint16_t end, uint16_t top, uint16_t bottom );
+ Extents(uint16_t start, uint16_t end, uint16_t top, uint16_t bottom);
/**
* @brief Copy Assignment operator.
* @param[in] copy A reference to the copied Extents
* @return Itself
*/
- Extents& operator=( const Extents& copy ) = default;
+ Extents& operator=(const Extents& copy) = default;
/**
* @brief Assignment operator.
* @param[in] array Array of uint16_t
* @return Itself
*/
- Extents& operator=( const uint16_t* array );
+ Extents& operator=(const uint16_t* array);
/**
* @brief Equality operator.
* @param[in] rhs The Extents to test against
* @return True if the extents are equal
*/
- bool operator==( const Extents &rhs ) const;
+ bool operator==(const Extents& rhs) const;
/**
* @brief Inequality operator.
* @param[in] rhs The Extents to test against
* @return True if the extents are not equal
*/
- bool operator!=( const Extents &rhs ) const;
+ bool operator!=(const Extents& rhs) const;
public:
- uint16_t start; ///< The start extent. @SINCE_1_2.62
- uint16_t end; ///< The end extent. @SINCE_1_2.62
- uint16_t top; ///< The top extent. @SINCE_1_2.62
- uint16_t bottom; ///< The bottom extent. @SINCE_1_2.62
-
+ uint16_t start; ///< The start extent. @SINCE_1_2.62
+ uint16_t end; ///< The end extent. @SINCE_1_2.62
+ uint16_t top; ///< The top extent. @SINCE_1_2.62
+ uint16_t bottom; ///< The bottom extent. @SINCE_1_2.62
};
/**
* @param[in] extents The Extents to output
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Extents& extents );
+DALI_CORE_API std::ostream& operator<<(std::ostream& stream, const Extents& extents);
/**
* @}
template<typename T>
class IntrusivePtr
{
-
public:
-
/**
* @brief Standard constructor to unassigned object.
* @SINCE_1_0.0
*/
- IntrusivePtr() : mPtr( nullptr ) {}
+ IntrusivePtr()
+ : mPtr(nullptr)
+ {
+ }
/**
* @brief Constructor to attach existing object.
* @SINCE_1_0.0
* @param[in] p Pointer to object
*/
- IntrusivePtr( T* p ) : mPtr( p )
+ IntrusivePtr(T* p)
+ : mPtr(p)
{
- if( mPtr )
+ if(mPtr)
{
mPtr->Reference();
}
* @tparam U Reference counter object type
*/
template<typename U>
- IntrusivePtr( IntrusivePtr<U> const& rhs ) : mPtr( rhs.Get() )
+ IntrusivePtr(IntrusivePtr<U> const& rhs)
+ : mPtr(rhs.Get())
{
- if( mPtr )
+ if(mPtr)
{
mPtr->Reference();
}
* @SINCE_1_0.0
* @param[in] rhs Const reference to an IntrusivePtr
*/
- IntrusivePtr( IntrusivePtr const& rhs ) : mPtr( rhs.mPtr )
+ IntrusivePtr(IntrusivePtr const& rhs)
+ : mPtr(rhs.mPtr)
{
- if( mPtr )
+ if(mPtr)
{
mPtr->Reference();
}
* @param[in] rhs Reference to an IntrusivePtr
*/
template<typename U>
- IntrusivePtr( IntrusivePtr<U>&& rhs )
- : mPtr( rhs.Detach() )
+ IntrusivePtr(IntrusivePtr<U>&& rhs)
+ : mPtr(rhs.Detach())
{
}
* @SINCE_1_9.23
* @param[in] rhs Reference to an IntrusivePtr
*/
- IntrusivePtr( IntrusivePtr&& rhs )
- : mPtr( rhs.Detach() )
+ IntrusivePtr(IntrusivePtr&& rhs)
+ : mPtr(rhs.Detach())
{
}
*/
~IntrusivePtr()
{
- if( mPtr )
+ if(mPtr)
{
mPtr->Unreference();
}
* @param rhs Const reference to intrusive pointer
* @return Reference to reference counted object
*/
- IntrusivePtr& operator=( IntrusivePtr const& rhs )
+ IntrusivePtr& operator=(IntrusivePtr const& rhs)
{
- IntrusivePtr( rhs ).Swap( *this );
+ IntrusivePtr(rhs).Swap(*this);
return *this;
}
* @param rhs Pointer to object to wrap
* @return A Reference to this object
*/
- IntrusivePtr& operator=( T* rhs )
+ IntrusivePtr& operator=(T* rhs)
{
- IntrusivePtr( rhs ).Swap( *this );
+ IntrusivePtr(rhs).Swap(*this);
return *this;
}
* @param rhs Reference to intrusive pointer
* @return Reference to moved intrusive pointer
*/
- IntrusivePtr& operator=( IntrusivePtr&& rhs )
+ IntrusivePtr& operator=(IntrusivePtr&& rhs)
{
- if ( this != &rhs )
+ if(this != &rhs)
{
- if (mPtr)
+ if(mPtr)
{
mPtr->Unreference();
}
* @return Reference to moved intrusive pointer
*/
template<typename U>
- IntrusivePtr& operator=( IntrusivePtr<U>&& rhs )
+ IntrusivePtr& operator=(IntrusivePtr<U>&& rhs)
{
- if ( this != reinterpret_cast<IntrusivePtr<T>*>( &rhs ) )
+ if(this != reinterpret_cast<IntrusivePtr<T>*>(&rhs))
{
- if (mPtr)
+ if(mPtr)
{
mPtr->Unreference();
}
*/
void Reset()
{
- IntrusivePtr().Swap( *this );
+ IntrusivePtr().Swap(*this);
}
/**
* @SINCE_1_0.0
* @param[in] rhs Pointer to object
*/
- void Reset( T* rhs )
+ void Reset(T* rhs)
{
- IntrusivePtr( rhs ).Swap( *this );
+ IntrusivePtr(rhs).Swap(*this);
}
// IntrusivePtr comparisons - This is a variation of the safe bool idiom
*
* Objects can be implicitly converted to this for validity checks.
*/
- using BooleanType = void ( IntrusivePtr<T>::* )() const;
+ using BooleanType = void (IntrusivePtr<T>::*)() const;
/**
* @brief Converts an object handle to a BooleanType.
T* Detach()
{
T* ptr = mPtr;
- mPtr = nullptr;
+ mPtr = nullptr;
return ptr;
}
private:
-
/**
* @brief Used by the safe bool idiom.
* @SINCE_1_0.0
*/
- void ThisIsSaferThanReturningVoidStar() const {}
+ void ThisIsSaferThanReturningVoidStar() const
+ {
+ }
/**
* @brief Internal swap function.
* @SINCE_1_0.0
*/
- void Swap( IntrusivePtr& rhs )
+ void Swap(IntrusivePtr& rhs)
{
- T* tmp = mPtr;
- mPtr = rhs.mPtr;
+ T* tmp = mPtr;
+ mPtr = rhs.mPtr;
rhs.mPtr = tmp;
}
- T* mPtr; ///< pointer to RefObject
+ T* mPtr; ///< pointer to RefObject
};
/**
* @return True if the pointers point at the same object
*/
template<typename T, typename U>
-inline bool operator==( IntrusivePtr<T>const& lhs, IntrusivePtr<U>const& rhs )
+inline bool operator==(IntrusivePtr<T> const& lhs, IntrusivePtr<U> const& rhs)
{
return lhs.Get() == rhs.Get();
}
* @return True if the pointers point at different objects
*/
template<typename T, typename U>
-inline bool operator!=( IntrusivePtr<T>const& lhs, IntrusivePtr<U>const &rhs)
+inline bool operator!=(IntrusivePtr<T> const& lhs, IntrusivePtr<U> const& rhs)
{
return lhs.Get() != rhs.Get();
}
* @return True if the intrusive pointer points at the specified object
*/
template<typename T, typename U>
-inline bool operator==( IntrusivePtr<T>const& lhs, U* rhs )
+inline bool operator==(IntrusivePtr<T> const& lhs, U* rhs)
{
return lhs.Get() == rhs;
}
* @return True if the intrusive pointer doesn't point at the specified object
*/
template<typename T, typename U>
-inline bool operator!=( IntrusivePtr<T>const& lhs, U* rhs )
+inline bool operator!=(IntrusivePtr<T> const& lhs, U* rhs)
{
return lhs.Get() != rhs;
}
* @return True if the intrusive pointer points at the specified object
*/
template<typename T, typename U>
-inline bool operator==( T* lhs, IntrusivePtr<U>const& rhs )
+inline bool operator==(T* lhs, IntrusivePtr<U> const& rhs)
{
return lhs == rhs.Get();
}
* @return True if the intrusive pointer doesn't point at the specified object
*/
template<typename T, typename U>
-inline bool operator!=( T* lhs, IntrusivePtr<U>const& rhs )
+inline bool operator!=(T* lhs, IntrusivePtr<U> const& rhs)
{
return lhs != rhs.Get();
}
#include <list>
#undef _LIBCPP_INLINE_VISIBILITY
-#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
+#define _LIBCPP_INLINE_VISIBILITY __attribute__((__visibility__("hidden"), __always_inline__))
#undef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#include <bits/stl_list.h>
#undef _GLIBCXX_VISIBILITY_ATTR
#undef _GLIBCXX_VISIBILITY
-#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ ("hidden")))
-#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ ("hidden")))
+#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__((__visibility__("hidden")))
+#define _GLIBCXX_VISIBILITY(V) __attribute__((__visibility__("hidden")))
#include <list>
#undef _GLIBCXX_VISIBILITY_ATTR
#undef _GLIBCXX_VISIBILITY
-#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY_ATTR`
-#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY`
+#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__((__visibility__(#V))) // restore `_GLIBCXX_VISIBILITY_ATTR`
+#define _GLIBCXX_VISIBILITY(V) __attribute__((__visibility__(#V))) // restore `_GLIBCXX_VISIBILITY`
#endif // #ifdef __clang__
#define DALI_TYPE_TRAITS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
* This allows specializations to not have to repeat all flags.
* @SINCE_1_0.0
*/
-template <typename Type>
+template<typename Type>
struct BasicTypes
{
/**
* and cannot be copied by using memcpy etc.
* @SINCE_1_0.0
*/
- enum { IS_TRIVIAL_TYPE = __has_trivial_destructor(Type) && __has_trivial_copy(Type) };
+ enum
+ {
+ IS_TRIVIAL_TYPE = __has_trivial_destructor(Type) && __has_trivial_copy(Type)
+ };
};
/**
*
* @SINCE_1_0.0
*/
-template <typename Type>
-struct TypeTraits : public BasicTypes< Type >
+template<typename Type>
+struct TypeTraits : public BasicTypes<Type>
{
};
#define DALI_VECTOR_WRAPPER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <vector>
#undef _LIBCPP_INLINE_VISIBILITY
-#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
+#define _LIBCPP_INLINE_VISIBILITY __attribute__((__visibility__("hidden"), __always_inline__))
#undef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#include <bits/c++config.h>
#undef _GLIBCXX_VISIBILITY_ATTR
#undef _GLIBCXX_VISIBILITY
-#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ ("hidden")))
-#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ ("hidden")))
+#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__((__visibility__("hidden")))
+#define _GLIBCXX_VISIBILITY(V) __attribute__((__visibility__("hidden")))
#include <vector>
#undef _GLIBCXX_VISIBILITY_ATTR
#undef _GLIBCXX_VISIBILITY
-#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY_ATTR`
-#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) // restore `_GLIBCXX_VISIBILITY`
+#define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__((__visibility__(#V))) // restore `_GLIBCXX_VISIBILITY_ATTR`
+#define _GLIBCXX_VISIBILITY(V) __attribute__((__visibility__(#V))) // restore `_GLIBCXX_VISIBILITY`
#endif // #ifdef __clang__
namespace Dali
{
-
-const uint32_t CORE_MAJOR_VERSION = 1;
-const uint32_t CORE_MINOR_VERSION = 9;
-const uint32_t CORE_MICRO_VERSION = 28;
-const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__;
+const uint32_t CORE_MAJOR_VERSION = 1;
+const uint32_t CORE_MINOR_VERSION = 9;
+const uint32_t CORE_MICRO_VERSION = 28;
+const char* const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
namespace
#define DALI_CORE_VERSION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-DALI_CORE_API extern const uint32_t CORE_MAJOR_VERSION; ///< The major version number of the Core library.
-DALI_CORE_API extern const uint32_t CORE_MINOR_VERSION; ///< The minor version number of the Core library.
-DALI_CORE_API extern const uint32_t CORE_MICRO_VERSION; ///< The micro version number of the Core library.
-DALI_CORE_API extern const char * const CORE_BUILD_DATE; ///< The date/time the Core library was built.
+DALI_CORE_API extern const uint32_t CORE_MAJOR_VERSION; ///< The major version number of the Core library.
+DALI_CORE_API extern const uint32_t CORE_MINOR_VERSION; ///< The minor version number of the Core library.
+DALI_CORE_API extern const uint32_t CORE_MICRO_VERSION; ///< The micro version number of the Core library.
+DALI_CORE_API extern const char* const CORE_BUILD_DATE; ///< The date/time the Core library was built.
} // namespace Dali
#endif // DALI_CORE_VERSION_H
*
*/
-#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/actor-enumerations.h>
+#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/actors/custom-actor-impl.h>
#include <dali/public-api/actors/custom-actor.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/events/long-press-gesture-detector.h>
#include <dali/public-api/events/long-press-gesture.h>
-#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/pan-gesture-detector.h>
#include <dali/public-api/events/pan-gesture.h>
#include <dali/public-api/events/pinch-gesture-detector.h>
#include <dali/public-api/events/tap-gesture-detector.h>
#include <dali/public-api/events/tap-gesture.h>
#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/images/native-image-interface.h>
-#include <dali/public-api/images/pixel.h>
#include <dali/public-api/images/pixel-data.h>
+#include <dali/public-api/images/pixel.h>
#include <dali/public-api/math/angle-axis.h>
#include <dali/public-api/math/compile-time-math.h>
#include <dali/public-api/object/property.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/type-info.h>
-#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/weak-handle.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/rendering/renderer.h>
#include <dali/public-api/rendering/sampler.h>
#include <dali/public-api/rendering/shader.h>
-#include <dali/public-api/rendering/texture.h>
#include <dali/public-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/texture.h>
#include <dali/public-api/rendering/vertex-buffer.h>
#include <dali/public-api/signals/base-signal.h>
#define DALI_DEVICE_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
namespace Device
{
-
/**
* @brief Categorization type about input Device
* @SINCE_1_2.60
*/
namespace Class
{
-
/**
* @brief An enum of Device Class types.
* @SINCE_1_2.60
*/
enum Type
{
- NONE, ///< Not a device. @SINCE_1_2.60
- USER, ///< The user/seat (the user themselves). @SINCE_1_2.60
- KEYBOARD, ///< A regular keyboard, numberpad or attached buttons. @SINCE_1_2.60
- MOUSE, ///< A mouse, trackball or touchpad relative motion device. @SINCE_1_2.60
- TOUCH, ///< A touchscreen with fingers or stylus. @SINCE_1_2.60
- PEN, ///< A special pen device. @SINCE_1_2.60
- POINTER, ///< A pointing device based on laser, infrared or similar technology. @SINCE_1_2.60
- GAMEPAD ///< A gamepad controller or joystick. @SINCE_1_2.60
+ NONE, ///< Not a device. @SINCE_1_2.60
+ USER, ///< The user/seat (the user themselves). @SINCE_1_2.60
+ KEYBOARD, ///< A regular keyboard, numberpad or attached buttons. @SINCE_1_2.60
+ MOUSE, ///< A mouse, trackball or touchpad relative motion device. @SINCE_1_2.60
+ TOUCH, ///< A touchscreen with fingers or stylus. @SINCE_1_2.60
+ PEN, ///< A special pen device. @SINCE_1_2.60
+ POINTER, ///< A pointing device based on laser, infrared or similar technology. @SINCE_1_2.60
+ GAMEPAD ///< A gamepad controller or joystick. @SINCE_1_2.60
};
} // namespace Class
*/
namespace Subclass
{
-
/**
* @brief An enum of Device Subclass types.
* @SINCE_1_2.60
*/
enum Type
{
- NONE, ///< Not a device. @SINCE_1_2.60
- FINGER, ///< The normal flat of your finger. @SINCE_1_2.60
- FINGERNAIL, ///< A fingernail. @SINCE_1_2.60
- KNUCKLE, ///< A Knuckle. @SINCE_1_2.60
- PALM, ///< The palm of a users hand. @SINCE_1_2.60
- HAND_SIDE, ///< The side of your hand. @SINCE_1_2.60
- HAND_FLAT, ///< The flat of your hand. @SINCE_1_2.60
- PEN_TIP, ///< The tip of a pen. @SINCE_1_2.60
- TRACKPAD, ///< A trackpad style mouse. @SINCE_1_2.60
- TRACKPOINT, ///< A trackpoint style mouse. @SINCE_1_2.60
- TRACKBALL, ///< A trackball style mouse. @SINCE_1_2.60
- REMOCON, ///< A remote controller. @SINCE_1_2.61
- VIRTUAL_KEYBOARD, ///< A virtual keyboard. @SINCE_1_2.61
+ NONE, ///< Not a device. @SINCE_1_2.60
+ FINGER, ///< The normal flat of your finger. @SINCE_1_2.60
+ FINGERNAIL, ///< A fingernail. @SINCE_1_2.60
+ KNUCKLE, ///< A Knuckle. @SINCE_1_2.60
+ PALM, ///< The palm of a users hand. @SINCE_1_2.60
+ HAND_SIDE, ///< The side of your hand. @SINCE_1_2.60
+ HAND_FLAT, ///< The flat of your hand. @SINCE_1_2.60
+ PEN_TIP, ///< The tip of a pen. @SINCE_1_2.60
+ TRACKPAD, ///< A trackpad style mouse. @SINCE_1_2.60
+ TRACKPOINT, ///< A trackpoint style mouse. @SINCE_1_2.60
+ TRACKBALL, ///< A trackball style mouse. @SINCE_1_2.60
+ REMOCON, ///< A remote controller. @SINCE_1_2.61
+ VIRTUAL_KEYBOARD, ///< A virtual keyboard. @SINCE_1_2.61
};
} // namespace Subclass
*/
} // namespace Dali
-#endif //DALI_KEY_EVENT_DEVEL_H
+#endif //DALI_KEY_EVENT_DEVEL_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
GestureDetector::GestureDetector(Internal::GestureDetector* internal)
: Handle(internal)
{
{
}
-GestureDetector GestureDetector::DownCast( BaseHandle handle )
+GestureDetector GestureDetector::DownCast(BaseHandle handle)
{
- return GestureDetector( dynamic_cast<Dali::Internal::GestureDetector*>(handle.GetObjectPtr()) );
+ return GestureDetector(dynamic_cast<Dali::Internal::GestureDetector*>(handle.GetObjectPtr()));
}
GestureDetector::~GestureDetector()
#define DALI_GESTURE_DETECTOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
class DALI_CORE_API GestureDetector : public Handle
{
public: // Creation & Destruction
-
/**
* @brief Creates an uninitialized GestureDetector.
*
* @param[in] handle Handle to an object
* @return Handle to a GestureDetector object or an uninitialized handle
*/
- static GestureDetector DownCast( BaseHandle handle );
+ static GestureDetector DownCast(BaseHandle handle);
/**
* @brief Dali::GestureDetector is intended as a base class.
GestureDetector& operator=(const GestureDetector& rhs);
public: // Actor related
-
/**
* @brief Attaches an actor to the gesture.
*
Actor GetAttachedActor(size_t index) const;
protected:
-
/// @cond internal
/**
* @brief This constructor is used by New() methods of derived classes (For example, PanGestureDetector::New()).
namespace Dali
{
-
/**
* @brief Enumeration for type of gesture.
* @SINCE_1_9.28
namespace Dali
{
-
Gesture::Gesture()
{
}
{
}
-Gesture::Gesture( const Gesture& rhs ) = default;
+Gesture::Gesture(const Gesture& rhs) = default;
-Gesture::Gesture( Gesture&& rhs ) = default;
+Gesture::Gesture(Gesture&& rhs) = default;
-Gesture& Gesture::operator=( const Gesture& rhs ) = default;
+Gesture& Gesture::operator=(const Gesture& rhs) = default;
-Gesture& Gesture::operator=( Gesture&& rhs ) = default;
+Gesture& Gesture::operator=(Gesture&& rhs) = default;
Gesture::~Gesture()
{
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/events/gesture-enumerations.h>
+#include <dali/public-api/object/base-handle.h>
namespace Dali
{
class DALI_CORE_API Gesture : public BaseHandle
{
public:
-
/**
* @brief Creates an uninitialized Gesture handle.
*
* @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
- Gesture( const Gesture& rhs );
+ Gesture(const Gesture& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.28
* @param[in] rhs A reference to the handle to move
*/
- Gesture( Gesture&& rhs );
+ Gesture(Gesture&& rhs);
/**
* @brief Assignment operator.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- Gesture& operator=( const Gesture& rhs );
+ Gesture& operator=(const Gesture& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the handle to move
* @return A reference to this
*/
- Gesture& operator=( Gesture&& rhs );
+ Gesture& operator=(Gesture&& rhs);
/**
* @brief Non virtual destructor.
uint32_t GetTime() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief Internal constructor.
#include <dali/public-api/events/hover-event.h>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
#include <dali/internal/event/events/hover-event-impl.h>
+#include <dali/public-api/actors/actor.h>
namespace Dali
{
-
HoverEvent::HoverEvent()
: BaseHandle()
{
}
-HoverEvent::HoverEvent( const HoverEvent& rhs ) = default;
+HoverEvent::HoverEvent(const HoverEvent& rhs) = default;
-HoverEvent::HoverEvent( HoverEvent&& rhs ) = default;
+HoverEvent::HoverEvent(HoverEvent&& rhs) = default;
HoverEvent::~HoverEvent()
{
}
-HoverEvent& HoverEvent::operator=( const HoverEvent& rhs ) = default;
+HoverEvent& HoverEvent::operator=(const HoverEvent& rhs) = default;
-HoverEvent& HoverEvent::operator=( HoverEvent&& rhs ) = default;
+HoverEvent& HoverEvent::operator=(HoverEvent&& rhs) = default;
unsigned long HoverEvent::GetTime() const
{
- return GetImplementation( *this ).GetTime();
+ return GetImplementation(*this).GetTime();
}
std::size_t HoverEvent::GetPointCount() const
{
- return GetImplementation( *this ).GetPointCount();
+ return GetImplementation(*this).GetPointCount();
}
-int32_t HoverEvent::GetDeviceId( std::size_t point ) const
+int32_t HoverEvent::GetDeviceId(std::size_t point) const
{
- return GetImplementation( *this ).GetDeviceId( point );
+ return GetImplementation(*this).GetDeviceId(point);
}
-PointState::Type HoverEvent::GetState( std::size_t point ) const
+PointState::Type HoverEvent::GetState(std::size_t point) const
{
- return GetImplementation( *this ).GetState( point );
+ return GetImplementation(*this).GetState(point);
}
-Actor HoverEvent::GetHitActor( std::size_t point ) const
+Actor HoverEvent::GetHitActor(std::size_t point) const
{
- return GetImplementation( *this ).GetHitActor( point );
+ return GetImplementation(*this).GetHitActor(point);
}
-const Vector2& HoverEvent::GetLocalPosition( std::size_t point ) const
+const Vector2& HoverEvent::GetLocalPosition(std::size_t point) const
{
- return GetImplementation( *this ).GetLocalPosition( point );
+ return GetImplementation(*this).GetLocalPosition(point);
}
-const Vector2& HoverEvent::GetScreenPosition( std::size_t point ) const
+const Vector2& HoverEvent::GetScreenPosition(std::size_t point) const
{
- return GetImplementation( *this ).GetScreenPosition( point );
+ return GetImplementation(*this).GetScreenPosition(point);
}
-HoverEvent::HoverEvent( Internal::HoverEvent* internal )
-: BaseHandle( internal )
+HoverEvent::HoverEvent(Internal::HoverEvent* internal)
+: BaseHandle(internal)
{
}
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/events/point-state.h>
+#include <dali/public-api/object/base-handle.h>
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class HoverEvent;
*/
class DALI_CORE_API HoverEvent : public BaseHandle
{
-
public:
-
// Construction & Destruction
/**
* @SINCE_1_9.25
* @param[in] rhs The HoverEvent to copy from
*/
- HoverEvent( const HoverEvent& rhs );
+ HoverEvent(const HoverEvent& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.25
* @param[in] rhs A reference to the moved HoverEvent
*/
- HoverEvent( HoverEvent&& rhs );
+ HoverEvent(HoverEvent&& rhs);
/**
* @brief Destructor.
* @param[in] rhs The HoverEvent to copy from
* @return A reference to this
*/
- HoverEvent& operator=( const HoverEvent& rhs );
+ HoverEvent& operator=(const HoverEvent& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved HoverEvent
* @return A reference to this
*/
- HoverEvent& operator=( HoverEvent&& rhs );
+ HoverEvent& operator=(HoverEvent&& rhs);
// Getters
* @return The Device ID of this point
* @note If point is greater than GetPointCount() then this method will return -1.
*/
- int32_t GetDeviceId( std::size_t point ) const;
+ int32_t GetDeviceId(std::size_t point) const;
/**
* @brief Retrieves the State of the point specified.
* @note If point is greater than GetPointCount() then this method will return PointState::FINISHED.
* @see State
*/
- PointState::Type GetState( std::size_t point ) const;
+ PointState::Type GetState(std::size_t point) const;
/**
* @brief Retrieves the actor that was underneath the point specified.
* @return The actor that was underneath the point specified
* @note If point is greater than GetPointCount() then this method will return an empty handle.
*/
- Actor GetHitActor( std::size_t point ) const;
+ Actor GetHitActor(std::size_t point) const;
/**
* @brief Retrieves the co-ordinates relative to the top-left of the hit-actor at the point specified.
* then you should use Actor::ScreenToLocal().
* @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
*/
- const Vector2& GetLocalPosition( std::size_t point ) const;
+ const Vector2& GetLocalPosition(std::size_t point) const;
/**
* @brief Retrieves the co-ordinates relative to the top-left of the screen of the point specified.
* @return The co-ordinates relative to the top-left of the screen of the point specified
* @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
*/
- const Vector2& GetScreenPosition( std::size_t point ) const;
+ const Vector2& GetScreenPosition(std::size_t point) const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized HoverEvent handle.
* @SINCE_1_9.25
* @param[in] hoverEvent A pointer to a newly allocated Dali resource
*/
- explicit DALI_INTERNAL HoverEvent( Internal::HoverEvent* hoverEvent );
+ explicit DALI_INTERNAL HoverEvent(Internal::HoverEvent* hoverEvent);
/// @endcond
};
namespace Dali
{
-
KeyEvent::KeyEvent()
: BaseHandle()
{
}
-KeyEvent::KeyEvent( const KeyEvent& rhs ) = default;
+KeyEvent::KeyEvent(const KeyEvent& rhs) = default;
-KeyEvent::KeyEvent( KeyEvent&& rhs ) = default;
+KeyEvent::KeyEvent(KeyEvent&& rhs) = default;
KeyEvent::~KeyEvent()
{
}
-KeyEvent& KeyEvent::operator=( const KeyEvent& rhs ) = default;
+KeyEvent& KeyEvent::operator=(const KeyEvent& rhs) = default;
-KeyEvent& KeyEvent::operator=( KeyEvent&& rhs ) = default;
+KeyEvent& KeyEvent::operator=(KeyEvent&& rhs) = default;
bool KeyEvent::IsShiftModifier() const
{
- return GetImplementation( *this ).IsShiftModifier();
+ return GetImplementation(*this).IsShiftModifier();
}
bool KeyEvent::IsCtrlModifier() const
{
- return GetImplementation( *this ).IsCtrlModifier();
+ return GetImplementation(*this).IsCtrlModifier();
}
bool KeyEvent::IsAltModifier() const
{
- return GetImplementation( *this ).IsAltModifier();
+ return GetImplementation(*this).IsAltModifier();
}
const std::string& KeyEvent::GetCompose() const
{
- return GetImplementation( *this ).GetCompose();
+ return GetImplementation(*this).GetCompose();
}
const std::string& KeyEvent::GetDeviceName() const
{
- return GetImplementation( *this ).GetDeviceName();
+ return GetImplementation(*this).GetDeviceName();
}
Device::Class::Type KeyEvent::GetDeviceClass() const
{
- return GetImplementation( *this ).GetDeviceClass();
+ return GetImplementation(*this).GetDeviceClass();
}
Device::Subclass::Type KeyEvent::GetDeviceSubclass() const
{
- return GetImplementation( *this ).GetDeviceSubclass();
+ return GetImplementation(*this).GetDeviceSubclass();
}
const std::string& KeyEvent::GetKeyName() const
{
- return GetImplementation( *this ).GetKeyName();
+ return GetImplementation(*this).GetKeyName();
}
const std::string& KeyEvent::GetKeyString() const
{
- return GetImplementation( *this ).GetKeyString();
+ return GetImplementation(*this).GetKeyString();
}
const std::string& KeyEvent::GetLogicalKey() const
{
- return GetImplementation( *this ).GetLogicalKey();
+ return GetImplementation(*this).GetLogicalKey();
}
int32_t KeyEvent::GetKeyCode() const
{
- return GetImplementation( *this ).GetKeyCode();
+ return GetImplementation(*this).GetKeyCode();
}
int32_t KeyEvent::GetKeyModifier() const
{
- return GetImplementation( *this ).GetKeyModifier();
+ return GetImplementation(*this).GetKeyModifier();
}
unsigned long KeyEvent::GetTime() const
{
- return GetImplementation( *this ).GetTime();
+ return GetImplementation(*this).GetTime();
}
KeyEvent::State KeyEvent::GetState() const
{
- return GetImplementation( *this ).GetState();
+ return GetImplementation(*this).GetState();
}
-KeyEvent::KeyEvent( Internal::KeyEvent* internal )
-: BaseHandle( internal )
+KeyEvent::KeyEvent(Internal::KeyEvent* internal)
+: BaseHandle(internal)
{
}
*/
// EXTERNAL INCLUDES
-#include <string>
#include <cstdint> // int32_t
+#include <string>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/events/device.h>
+#include <dali/public-api/object/base-handle.h>
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class KeyEvent;
*/
class DALI_CORE_API KeyEvent : public BaseHandle
{
-
public:
-
// Enumerations
/**
*/
enum State
{
- DOWN, ///< Key down @SINCE_1_9.27
- UP, ///< Key up @SINCE_1_9.27
+ DOWN, ///< Key down @SINCE_1_9.27
+ UP, ///< Key up @SINCE_1_9.27
};
/**
* @SINCE_1_2.36
* @param[in] rhs A reference to the copied handle
*/
- KeyEvent( const KeyEvent& rhs );
+ KeyEvent(const KeyEvent& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.27
* @param[in] rhs A reference to the moved handle
*/
- KeyEvent( KeyEvent&& rhs );
+ KeyEvent(KeyEvent&& rhs);
/**
* @brief Copy assignment operator.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- KeyEvent& operator=( const KeyEvent& rhs );
+ KeyEvent& operator=(const KeyEvent& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- KeyEvent& operator=( KeyEvent&& rhs );
+ KeyEvent& operator=(KeyEvent&& rhs);
/**
* @brief Destructor.
State GetState() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized KeyEvent handle.
* @SINCE_1_9.27
* @param[in] keyEvent A pointer to a newly allocated Dali resource
*/
- explicit DALI_INTERNAL KeyEvent( Internal::KeyEvent* keyEvent );
+ explicit DALI_INTERNAL KeyEvent(Internal::KeyEvent* keyEvent);
/// @endcond
};
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
LongPressGestureDetector::LongPressGestureDetector(Internal::LongPressGestureDetector* internal)
: GestureDetector(internal)
{
return LongPressGestureDetector(internal.Get());
}
-LongPressGestureDetector LongPressGestureDetector::DownCast( BaseHandle handle )
+LongPressGestureDetector LongPressGestureDetector::DownCast(BaseHandle handle)
{
- return LongPressGestureDetector( dynamic_cast<Dali::Internal::LongPressGestureDetector*>(handle.GetObjectPtr()) );
+ return LongPressGestureDetector(dynamic_cast<Dali::Internal::LongPressGestureDetector*>(handle.GetObjectPtr()));
}
LongPressGestureDetector::~LongPressGestureDetector()
*/
class DALI_CORE_API LongPressGestureDetector : public GestureDetector
{
-public: // Typedefs
- using DetectedSignalType = Signal<void( Actor, const LongPressGesture& )>; ///< Gesture detected signal type @SINCE_1_0.0
+public: // Typedefs
+ using DetectedSignalType = Signal<void(Actor, const LongPressGesture&)>; ///< Gesture detected signal type @SINCE_1_0.0
public: // Creation & Destruction
-
/**
* @brief Creates an uninitialized LongPressGestureDetector; this can be initialized with LongPressGestureDetector::New().
*
* @param[in] handle Handle to an object
* @return Handle to a LongPressGestureDetector object or an uninitialized handle
*/
- static LongPressGestureDetector DownCast( BaseHandle handle );
+ static LongPressGestureDetector DownCast(BaseHandle handle);
/**
* @brief Destructor.
LongPressGestureDetector& operator=(const LongPressGestureDetector& rhs);
public: // Setters
-
/**
* @brief Sets the number of touches required.
*
void SetTouchesRequired(uint32_t minTouches, uint32_t maxTouches);
public: // Getters
-
/**
* @brief Retrieves the minimum number of touches required.
*
uint32_t GetMaximumTouchesRequired() const;
public: // Signals
-
/**
* @brief This signal is emitted when the specified long press is detected on the attached actor.
*
DetectedSignalType& DetectedSignal();
public: // Not intended for Application developers
-
/// @cond internal
/**
* @brief This constructor is used by LongPressGestureDetector::New() methods.
*/
explicit DALI_INTERNAL LongPressGestureDetector(Internal::LongPressGestureDetector* internal);
/// @endcond
-
};
/**
namespace Dali
{
-
-LongPressGesture::LongPressGesture( Internal::LongPressGesture* internal )
-: Gesture( internal )
+LongPressGesture::LongPressGesture(Internal::LongPressGesture* internal)
+: Gesture(internal)
{
}
LongPressGesture::LongPressGesture() = default;
-LongPressGesture::LongPressGesture( const LongPressGesture& rhs ) = default;
+LongPressGesture::LongPressGesture(const LongPressGesture& rhs) = default;
-LongPressGesture::LongPressGesture( LongPressGesture&& rhs ) = default;
+LongPressGesture::LongPressGesture(LongPressGesture&& rhs) = default;
-LongPressGesture& LongPressGesture::operator=( const LongPressGesture& rhs ) = default;
+LongPressGesture& LongPressGesture::operator=(const LongPressGesture& rhs) = default;
-LongPressGesture& LongPressGesture::operator=( LongPressGesture&& rhs ) = default;
+LongPressGesture& LongPressGesture::operator=(LongPressGesture&& rhs) = default;
LongPressGesture::~LongPressGesture() = default;
uint32_t LongPressGesture::GetNumberOfTouches() const
{
- return GetImplementation( *this ).GetNumberOfTouches();
+ return GetImplementation(*this).GetNumberOfTouches();
}
const Vector2& LongPressGesture::GetScreenPoint() const
{
- return GetImplementation( *this ).GetScreenPoint();
+ return GetImplementation(*this).GetScreenPoint();
}
const Vector2& LongPressGesture::GetLocalPoint() const
{
- return GetImplementation( *this ).GetLocalPoint();
+ return GetImplementation(*this).GetLocalPoint();
}
} // namespace Dali
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class LongPressGesture;
class DALI_CORE_API LongPressGesture : public Gesture
{
public:
-
/**
* @brief Creates an uninitialized LongPressGesture handle.
*
* @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
- LongPressGesture( const LongPressGesture& rhs );
+ LongPressGesture(const LongPressGesture& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.28
* @param[in] rhs A reference to the handle to move
*/
- LongPressGesture( LongPressGesture&& rhs );
+ LongPressGesture(LongPressGesture&& rhs);
/**
* @brief Assignment operator.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- LongPressGesture& operator=( const LongPressGesture& rhs );
+ LongPressGesture& operator=(const LongPressGesture& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- LongPressGesture& operator=( LongPressGesture&& rhs );
+ LongPressGesture& operator=(LongPressGesture&& rhs);
/**
* @brief Non virtual destructor.
const Vector2& GetLocalPoint() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized LongPressGesture handle.
* @param[in] longPressGesture A pointer to a newly allocated Dali resource
* @SINCE_1_9.28
*/
- explicit DALI_INTERNAL LongPressGesture( Internal::LongPressGesture* longPressGesture );
+ explicit DALI_INTERNAL LongPressGesture(Internal::LongPressGesture* longPressGesture);
/// @endcond
-
};
/**
#define DALI_MOUSE_BUTTON_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
namespace MouseButton
{
-
/**
* @brief Enumeration for mouse button type.
* @SINCE_1_3_31
*/
enum Type
{
- INVALID = -1, /**< No mouse button event or invalid data */
- PRIMARY = 1, /**< Primary(Left) mouse button */
- SECONDARY = 3, /**< Secondary(Right) mouse button */
- TERTIARY = 2, /**< Center(Wheel) mouse button */
+ INVALID = -1, /**< No mouse button event or invalid data */
+ PRIMARY = 1, /**< Primary(Left) mouse button */
+ SECONDARY = 3, /**< Secondary(Right) mouse button */
+ TERTIARY = 2, /**< Center(Wheel) mouse button */
};
-}
+} // namespace MouseButton
/**
* @}
namespace Dali
{
-
-const Radian PanGestureDetector::DIRECTION_LEFT( -Math::PI );
-const Radian PanGestureDetector::DIRECTION_RIGHT( 0.0f );
-const Radian PanGestureDetector::DIRECTION_UP( -0.5f * Math::PI );
-const Radian PanGestureDetector::DIRECTION_DOWN( 0.5f * Math::PI );
-const Radian PanGestureDetector::DIRECTION_HORIZONTAL( Math::PI );
-const Radian PanGestureDetector::DIRECTION_VERTICAL( -0.5f * Math::PI );
-const Radian PanGestureDetector::DEFAULT_THRESHOLD( 0.25f * Math::PI );
+const Radian PanGestureDetector::DIRECTION_LEFT(-Math::PI);
+const Radian PanGestureDetector::DIRECTION_RIGHT(0.0f);
+const Radian PanGestureDetector::DIRECTION_UP(-0.5f * Math::PI);
+const Radian PanGestureDetector::DIRECTION_DOWN(0.5f * Math::PI);
+const Radian PanGestureDetector::DIRECTION_HORIZONTAL(Math::PI);
+const Radian PanGestureDetector::DIRECTION_VERTICAL(-0.5f * Math::PI);
+const Radian PanGestureDetector::DEFAULT_THRESHOLD(0.25f * Math::PI);
PanGestureDetector::PanGestureDetector(Internal::PanGestureDetector* internal)
: GestureDetector(internal)
return PanGestureDetector(internal.Get());
}
-PanGestureDetector PanGestureDetector::DownCast( BaseHandle handle )
+PanGestureDetector PanGestureDetector::DownCast(BaseHandle handle)
{
- return PanGestureDetector( dynamic_cast<Dali::Internal::PanGestureDetector*>(handle.GetObjectPtr()) );
+ return PanGestureDetector(dynamic_cast<Dali::Internal::PanGestureDetector*>(handle.GetObjectPtr()));
}
PanGestureDetector::~PanGestureDetector()
return GetImplementation(*this).GetMaximumTouchesRequired();
}
-void PanGestureDetector::AddAngle( Radian angle, Radian threshold )
+void PanGestureDetector::AddAngle(Radian angle, Radian threshold)
{
- GetImplementation(*this).AddAngle( angle, threshold );
+ GetImplementation(*this).AddAngle(angle, threshold);
}
-void PanGestureDetector::AddDirection( Radian direction, Radian threshold )
+void PanGestureDetector::AddDirection(Radian direction, Radian threshold)
{
- GetImplementation(*this).AddDirection( direction, threshold );
+ GetImplementation(*this).AddDirection(direction, threshold);
}
size_t PanGestureDetector::GetAngleCount() const
PanGestureDetector::AngleThresholdPair PanGestureDetector::GetAngle(size_t index) const
{
- return GetImplementation(*this).GetAngle( static_cast<uint32_t>( index ) );
+ return GetImplementation(*this).GetAngle(static_cast<uint32_t>(index));
}
void PanGestureDetector::ClearAngles()
GetImplementation(*this).ClearAngles();
}
-void PanGestureDetector::RemoveAngle( Radian angle )
+void PanGestureDetector::RemoveAngle(Radian angle)
{
- GetImplementation(*this).RemoveAngle( angle );
+ GetImplementation(*this).RemoveAngle(angle);
}
-void PanGestureDetector::RemoveDirection( Radian direction )
+void PanGestureDetector::RemoveDirection(Radian direction)
{
- GetImplementation(*this).RemoveDirection( direction );
+ GetImplementation(*this).RemoveDirection(direction);
}
PanGestureDetector::DetectedSignalType& PanGestureDetector::DetectedSignal()
return GetImplementation(*this).DetectedSignal();
}
-void PanGestureDetector::SetPanGestureProperties( const Dali::PanGesture& pan )
+void PanGestureDetector::SetPanGestureProperties(const Dali::PanGesture& pan)
{
- Internal::PanGestureDetector::SetPanGestureProperties( pan );
+ Internal::PanGestureDetector::SetPanGestureProperties(pan);
}
} // namespace Dali
namespace Dali
{
-
struct Radian;
namespace Internal DALI_INTERNAL
class DALI_CORE_API PanGestureDetector : public GestureDetector
{
public:
-
/**
* @brief Enumeration for the instance of properties belonging to the PanGestureDetector class.
* @SINCE_1_0.0
};
// Typedefs
- using DetectedSignalType = Signal<void( Actor, const PanGesture& )>; ///< Pan gesture detected signal type @SINCE_1_0.0
+ using DetectedSignalType = Signal<void(Actor, const PanGesture&)>; ///< Pan gesture detected signal type @SINCE_1_0.0
// Directional Pan
using AngleThresholdPair = std::pair<Radian, Radian>; ///< Range of angles for a direction @SINCE_1_0.0
static const Radian DIRECTION_HORIZONTAL; ///< For a left and right pan (PI Radians). Useful for AddDirection().
static const Radian DIRECTION_VERTICAL; ///< For an up and down pan (-0.5 * PI Radians). Useful for AddDirection().
- static const Radian DEFAULT_THRESHOLD; ///< The default threshold is PI * 0.25 radians (or 45 degrees).
+ static const Radian DEFAULT_THRESHOLD; ///< The default threshold is PI * 0.25 radians (or 45 degrees).
public: // Creation & Destruction
-
/**
* @brief Creates an uninitialized PanGestureDetector; this can be initialized with PanGestureDetector::New().
*
* @param[in] handle Handle to an object
* @return Handle to a PanGestureDetector object or an uninitialized handle
*/
- static PanGestureDetector DownCast( BaseHandle handle );
+ static PanGestureDetector DownCast(BaseHandle handle);
/**
* @brief Destructor.
PanGestureDetector& operator=(const PanGestureDetector& rhs);
public: // Setters
-
/**
* @brief This is the minimum number of touches required for the pan gesture to be detected.
*
void SetMaximumTouchesRequired(uint32_t maximum);
public: // Getters
-
/**
* @brief Retrieves the minimum number of touches required for the pan gesture to be detected.
*
uint32_t GetMaximumTouchesRequired() const;
public: // Directional Panning
-
/**
* @brief The pan gesture is only emitted if the pan occurs in the direction specified by this method with a +/- threshold allowance.
*
* @note If the threshold is greater than PI, then PI will be used as the threshold.
*
*/
- void AddAngle( Radian angle, Radian threshold = DEFAULT_THRESHOLD );
+ void AddAngle(Radian angle, Radian threshold = DEFAULT_THRESHOLD);
/**
* @brief A helper method for adding bi-directional angles where the pan should take place.
*
* @see AddAngle
*/
- void AddDirection( Radian direction, Radian threshold = DEFAULT_THRESHOLD );
+ void AddDirection(Radian direction, Radian threshold = DEFAULT_THRESHOLD);
/**
* @brief Returns the count of angles that this pan gesture detector emits a signal.
* @note If an angle outside the range in AddAngle() is given, then the value is wrapped within
* the range and that is removed.
*/
- void RemoveAngle( Radian angle );
+ void RemoveAngle(Radian angle);
/**
* @brief Removes the two angles that make up the direction from the container.
* @note If a direction outside the range in AddAngle() is given, then the value is wrapped within
* the range and that is removed.
*/
- void RemoveDirection( Radian direction );
+ void RemoveDirection(Radian direction);
public: // Signals
-
/**
* @brief This signal is emitted when the pan gesture is detected on the attached actor.
*
DetectedSignalType& DetectedSignal();
public: // Pan Properties Setters
-
/**
* @brief Allows setting of the pan properties that are returned in constraints.
*
* @param[in] pan The pan gesture to set
* @note If a normal pan is taking place, then any value set is ignored.
*/
- static void SetPanGestureProperties( const PanGesture& pan );
+ static void SetPanGestureProperties(const PanGesture& pan);
public: // Not intended for Application developers
-
/// @cond internal
/**
* @brief This constructor is used by PanGestureDetector::New() methods.
*/
explicit DALI_INTERNAL PanGestureDetector(Internal::PanGestureDetector* internal);
/// @endcond
-
};
/**
#include <dali/public-api/events/pan-gesture.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
-PanGesture::PanGesture( Internal::PanGesture* internal )
-: Gesture( internal )
+PanGesture::PanGesture(Internal::PanGesture* internal)
+: Gesture(internal)
{
}
PanGesture::PanGesture() = default;
-PanGesture::PanGesture( const PanGesture& rhs ) = default;
+PanGesture::PanGesture(const PanGesture& rhs) = default;
-PanGesture::PanGesture( PanGesture&& rhs ) = default;
+PanGesture::PanGesture(PanGesture&& rhs) = default;
-PanGesture& PanGesture::operator=( const PanGesture& rhs ) = default;
+PanGesture& PanGesture::operator=(const PanGesture& rhs) = default;
-PanGesture& PanGesture::operator=( PanGesture&& rhs ) = default;
+PanGesture& PanGesture::operator=(PanGesture&& rhs) = default;
PanGesture::~PanGesture() = default;
const Vector2& PanGesture::GetVelocity() const
{
- return GetImplementation( *this ).GetVelocity();
+ return GetImplementation(*this).GetVelocity();
}
const Vector2& PanGesture::GetDisplacement() const
{
- return GetImplementation( *this ).GetDisplacement();
+ return GetImplementation(*this).GetDisplacement();
}
const Vector2& PanGesture::GetPosition() const
{
- return GetImplementation( *this ).GetPosition();
+ return GetImplementation(*this).GetPosition();
}
const Vector2& PanGesture::GetScreenVelocity() const
{
- return GetImplementation( *this ).GetScreenVelocity();
+ return GetImplementation(*this).GetScreenVelocity();
}
const Vector2& PanGesture::GetScreenDisplacement() const
{
- return GetImplementation( *this ).GetScreenDisplacement();
+ return GetImplementation(*this).GetScreenDisplacement();
}
const Vector2& PanGesture::GetScreenPosition() const
{
- return GetImplementation( *this ).GetScreenPosition();
+ return GetImplementation(*this).GetScreenPosition();
}
uint32_t PanGesture::GetNumberOfTouches() const
{
- return GetImplementation( *this ).GetNumberOfTouches();
+ return GetImplementation(*this).GetNumberOfTouches();
}
float PanGesture::GetSpeed() const
{
- return GetImplementation( *this ).GetSpeed();
+ return GetImplementation(*this).GetSpeed();
}
float PanGesture::GetDistance() const
{
- return GetImplementation( *this ).GetDistance();
+ return GetImplementation(*this).GetDistance();
}
float PanGesture::GetScreenSpeed() const
{
- return GetImplementation( *this ).GetScreenSpeed();
+ return GetImplementation(*this).GetScreenSpeed();
}
float PanGesture::GetScreenDistance() const
{
- return GetImplementation( *this ).GetScreenDistance();
+ return GetImplementation(*this).GetScreenDistance();
}
} // namespace Dali
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class PanGesture;
* A pan gesture will continue to be sent to the actor under than initial pan until it ends.
* @SINCE_1_9.28
*/
-class DALI_CORE_API PanGesture: public Gesture
+class DALI_CORE_API PanGesture : public Gesture
{
public:
-
/**
* @brief Creates an uninitialized PanGesture handle.
*
* @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
- PanGesture( const PanGesture& rhs );
+ PanGesture(const PanGesture& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.28
* @param[in] rhs A reference to the moved handle
*/
- PanGesture( PanGesture&& rhs );
+ PanGesture(PanGesture&& rhs);
/**
* @brief Assignment operator.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- PanGesture& operator=( const PanGesture& rhs );
+ PanGesture& operator=(const PanGesture& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- PanGesture& operator=( PanGesture&& rhs );
+ PanGesture& operator=(PanGesture&& rhs);
/**
* @brief Non virtual destructor.
float GetScreenDistance() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized PanGesture handle.
* @param[in] panGesture A pointer to a newly allocated Dali resource
* @SINCE_1_9.28
*/
- explicit DALI_INTERNAL PanGesture( Internal::PanGesture* panGesture );
+ explicit DALI_INTERNAL PanGesture(Internal::PanGesture* panGesture);
/// @endcond
-
};
/**
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
return PinchGestureDetector(internal.Get());
}
-PinchGestureDetector PinchGestureDetector::DownCast( BaseHandle handle )
+PinchGestureDetector PinchGestureDetector::DownCast(BaseHandle handle)
{
- return PinchGestureDetector( dynamic_cast<Dali::Internal::PinchGestureDetector*>(handle.GetObjectPtr()) );
+ return PinchGestureDetector(dynamic_cast<Dali::Internal::PinchGestureDetector*>(handle.GetObjectPtr()));
}
PinchGestureDetector::~PinchGestureDetector()
class DALI_CORE_API PinchGestureDetector : public GestureDetector
{
public: // Typedefs
-
/**
* @brief Signal type.
* @SINCE_1_0.0
*/
- using DetectedSignalType = Signal<void( Actor, const PinchGesture& )>;
+ using DetectedSignalType = Signal<void(Actor, const PinchGesture&)>;
public: // Creation & Destruction
-
/**
* @brief Creates an uninitialized PinchGestureDetector; this can be initialized with PinchGestureDetector::New().
*
* @param[in] handle Handle to an object
* @return Handle to a PinchGestureDetector object or an uninitialized handle
*/
- static PinchGestureDetector DownCast( BaseHandle handle );
+ static PinchGestureDetector DownCast(BaseHandle handle);
/**
* @brief Destructor.
PinchGestureDetector& operator=(const PinchGestureDetector& rhs);
public: // Signals
-
/**
* @brief This signal is emitted when the pinch gesture is detected on the attached actor.
*
DetectedSignalType& DetectedSignal();
public: // Not intended for Application developers
-
/// @cond internal
/**
* @brief This constructor is used by PinchGestureDetector::New() methods.
*/
explicit DALI_INTERNAL PinchGestureDetector(Internal::PinchGestureDetector* internal);
/// @endcond
-
};
/**
#include <dali/public-api/events/pinch-gesture.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
-PinchGesture::PinchGesture( Internal::PinchGesture* internal )
-: Gesture( internal )
+PinchGesture::PinchGesture(Internal::PinchGesture* internal)
+: Gesture(internal)
{
}
PinchGesture::PinchGesture() = default;
-PinchGesture::PinchGesture( const PinchGesture& rhs ) = default;
+PinchGesture::PinchGesture(const PinchGesture& rhs) = default;
-PinchGesture::PinchGesture( PinchGesture&& rhs ) = default;
+PinchGesture::PinchGesture(PinchGesture&& rhs) = default;
-PinchGesture& PinchGesture::operator=( const PinchGesture& rhs ) = default;
+PinchGesture& PinchGesture::operator=(const PinchGesture& rhs) = default;
-PinchGesture& PinchGesture::operator=( PinchGesture&& rhs ) = default;
+PinchGesture& PinchGesture::operator=(PinchGesture&& rhs) = default;
PinchGesture::~PinchGesture() = default;
float PinchGesture::GetScale() const
{
- return GetImplementation( *this ).GetScale();
+ return GetImplementation(*this).GetScale();
}
float PinchGesture::GetSpeed() const
{
- return GetImplementation( *this ).GetSpeed();
+ return GetImplementation(*this).GetSpeed();
}
const Vector2& PinchGesture::GetScreenCenterPoint() const
{
- return GetImplementation( *this ).GetScreenCenterPoint();
+ return GetImplementation(*this).GetScreenCenterPoint();
}
const Vector2& PinchGesture::GetLocalCenterPoint() const
{
- return GetImplementation( *this ).GetLocalCenterPoint();
+ return GetImplementation(*this).GetLocalCenterPoint();
}
} // namespace Dali
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class PinchGesture;
* until the pinch ends.
* @SINCE_1_9.28
*/
-class DALI_CORE_API PinchGesture: public Gesture
+class DALI_CORE_API PinchGesture : public Gesture
{
public:
-
/**
* @brief Creates an uninitialized PinchGesture handle.
*
* @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
- PinchGesture( const PinchGesture& rhs );
+ PinchGesture(const PinchGesture& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.28
* @param[in] rhs A reference to the moved handle
*/
- PinchGesture( PinchGesture&& rhs );
+ PinchGesture(PinchGesture&& rhs);
/**
* @brief Assignment operator.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- PinchGesture& operator=( const PinchGesture& rhs );
+ PinchGesture& operator=(const PinchGesture& rhs);
/**
* @brief Assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- PinchGesture& operator=( PinchGesture&& rhs );
+ PinchGesture& operator=(PinchGesture&& rhs);
/**
* @brief Non virtual destructor.
const Vector2& GetLocalCenterPoint() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized PinchGesture handle.
* @param[in] PinchGesture A pointer to a newly allocated Dali resource
* @SINCE_1_9.28
*/
- explicit DALI_INTERNAL PinchGesture( Internal::PinchGesture* pinchGesture );
+ explicit DALI_INTERNAL PinchGesture(Internal::PinchGesture* pinchGesture);
/// @endcond
-
};
/**
#define DALI_POINT_STATE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
namespace PointState
{
-
/**
* @brief Enumeration for point state type.
* @SINCE_1_1.37
*/
enum Type
{
- STARTED, /**< Touch or hover started */
- FINISHED, /**< Touch or hover finished */
- DOWN = STARTED, /**< Screen touched */
- UP = FINISHED, /**< Touch stopped */
- MOTION, /**< Finger dragged or hovered */
- LEAVE, /**< Leave the boundary of an actor */
- STATIONARY, /**< No change from last event. Useful when a multi-point event occurs where
+ STARTED, /**< Touch or hover started */
+ FINISHED, /**< Touch or hover finished */
+ DOWN = STARTED, /**< Screen touched */
+ UP = FINISHED, /**< Touch stopped */
+ MOTION, /**< Finger dragged or hovered */
+ LEAVE, /**< Leave the boundary of an actor */
+ STATIONARY, /**< No change from last event. Useful when a multi-point event occurs where
all points are sent but indicates that this particular point has not changed
since the last time */
- INTERRUPTED, /**< A system event has occurred which has interrupted the touch or hover event sequence. */
+ INTERRUPTED, /**< A system event has occurred which has interrupted the touch or hover event sequence. */
};
-}
+} // namespace PointState
/**
* @}
namespace Dali
{
-
-RotationGestureDetector::RotationGestureDetector( Internal::RotationGestureDetector* internal )
-: GestureDetector( internal )
+RotationGestureDetector::RotationGestureDetector(Internal::RotationGestureDetector* internal)
+: GestureDetector(internal)
{
}
{
Internal::RotationGestureDetectorPtr internal = Internal::RotationGestureDetector::New();
- return RotationGestureDetector( internal.Get() );
+ return RotationGestureDetector(internal.Get());
}
-RotationGestureDetector RotationGestureDetector::DownCast( BaseHandle handle )
+RotationGestureDetector RotationGestureDetector::DownCast(BaseHandle handle)
{
- return RotationGestureDetector( dynamic_cast<Dali::Internal::RotationGestureDetector*>( handle.GetObjectPtr() ) );
+ return RotationGestureDetector(dynamic_cast<Dali::Internal::RotationGestureDetector*>(handle.GetObjectPtr()));
}
RotationGestureDetector::~RotationGestureDetector()
{
}
-RotationGestureDetector::RotationGestureDetector( const RotationGestureDetector& handle )
-: GestureDetector( handle )
+RotationGestureDetector::RotationGestureDetector(const RotationGestureDetector& handle)
+: GestureDetector(handle)
{
}
-RotationGestureDetector& RotationGestureDetector::operator=( const RotationGestureDetector& rhs )
+RotationGestureDetector& RotationGestureDetector::operator=(const RotationGestureDetector& rhs)
{
- BaseHandle::operator=( rhs );
+ BaseHandle::operator=(rhs);
return *this;
}
RotationGestureDetector::DetectedSignalType& RotationGestureDetector::DetectedSignal()
{
- return GetImplementation( *this ).DetectedSignal();
+ return GetImplementation(*this).DetectedSignal();
}
} // namespace Dali
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class RotationGestureDetector;
class DALI_CORE_API RotationGestureDetector : public GestureDetector
{
public: // Typedefs
-
/**
* @brief Signal type.
*/
- using DetectedSignalType = Signal<void( Actor, const RotationGesture& )>;
+ using DetectedSignalType = Signal<void(Actor, const RotationGesture&)>;
public: // Creation & Destruction
-
/**
* @brief Creates an uninitialized RotationGestureDetector; this can be initialized with RotationGestureDetector::New().
*
* @param[in] handle Handle to an object
* @return Handle to a RotationGestureDetector object or an uninitialized handle
*/
- static RotationGestureDetector DownCast( BaseHandle handle );
+ static RotationGestureDetector DownCast(BaseHandle handle);
/**
* @brief Destructor.
RotationGestureDetector& operator=(const RotationGestureDetector& rhs);
public: // Signals
-
/**
* @brief This signal is emitted when the rotation gesture is detected on the attached actor.
*
DetectedSignalType& DetectedSignal();
public: // Not intended for Application developers
-
/// @cond internal
/**
* @brief This constructor is used by RotationGestureDetector::New() methods.
*/
explicit DALI_INTERNAL RotationGestureDetector(Internal::RotationGestureDetector* internal);
/// @endcond
-
};
} // namespace Dali
#include <dali/public-api/events/rotation-gesture.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
-RotationGesture::RotationGesture( Internal::RotationGesture* internal )
-: Gesture( internal )
+RotationGesture::RotationGesture(Internal::RotationGesture* internal)
+: Gesture(internal)
{
}
RotationGesture::RotationGesture() = default;
-RotationGesture::RotationGesture( const RotationGesture& rhs ) = default;
+RotationGesture::RotationGesture(const RotationGesture& rhs) = default;
-RotationGesture::RotationGesture( RotationGesture&& rhs ) = default;
+RotationGesture::RotationGesture(RotationGesture&& rhs) = default;
-RotationGesture& RotationGesture::operator=( const RotationGesture& rhs ) = default;
+RotationGesture& RotationGesture::operator=(const RotationGesture& rhs) = default;
-RotationGesture& RotationGesture::operator=( RotationGesture&& rhs ) = default;
+RotationGesture& RotationGesture::operator=(RotationGesture&& rhs) = default;
RotationGesture::~RotationGesture() = default;
const Radian& RotationGesture::GetRotation() const
{
- return GetImplementation( *this ).GetRotation();
+ return GetImplementation(*this).GetRotation();
}
const Vector2& RotationGesture::GetScreenCenterPoint() const
{
- return GetImplementation( *this ).GetScreenCenterPoint();
+ return GetImplementation(*this).GetScreenCenterPoint();
}
const Vector2& RotationGesture::GetLocalCenterPoint() const
{
- return GetImplementation( *this ).GetLocalCenterPoint();
+ return GetImplementation(*this).GetLocalCenterPoint();
}
} // namespace Dali
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class RotationGesture;
* until the rotation ends.
* @SINCE_1_9.28
*/
-class DALI_CORE_API RotationGesture: public Gesture
+class DALI_CORE_API RotationGesture : public Gesture
{
public:
-
/**
* @brief Creates an uninitialized RotationGesture handle.
*
* @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
- RotationGesture( const RotationGesture& rhs );
+ RotationGesture(const RotationGesture& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.28
* @param[in] rhs A reference to the moved handle
*/
- RotationGesture( RotationGesture&& rhs );
+ RotationGesture(RotationGesture&& rhs);
/**
* @brief Assignment operator.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- RotationGesture& operator=( const RotationGesture& rhs );
+ RotationGesture& operator=(const RotationGesture& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- RotationGesture& operator=( RotationGesture&& rhs );
+ RotationGesture& operator=(RotationGesture&& rhs);
/**
* @brief Non virtual destructor.
const Vector2& GetLocalCenterPoint() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized RotationGesture handle.
* @param[in] rotationGesture A pointer to a newly allocated Dali resource
* @SINCE_1_9.28
*/
- explicit DALI_INTERNAL RotationGesture( Internal::RotationGesture* rotationGesture );
+ explicit DALI_INTERNAL RotationGesture(Internal::RotationGesture* rotationGesture);
/// @endcond
};
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
return TapGestureDetector(internal.Get());
}
-TapGestureDetector TapGestureDetector::New(uint32_t tapsRequired )
+TapGestureDetector TapGestureDetector::New(uint32_t tapsRequired)
{
- Internal::TapGestureDetectorPtr internal = Internal::TapGestureDetector::New( tapsRequired );
+ Internal::TapGestureDetectorPtr internal = Internal::TapGestureDetector::New(tapsRequired);
return TapGestureDetector(internal.Get());
}
-TapGestureDetector TapGestureDetector::DownCast( BaseHandle handle )
+TapGestureDetector TapGestureDetector::DownCast(BaseHandle handle)
{
- return TapGestureDetector( dynamic_cast<Dali::Internal::TapGestureDetector*>(handle.GetObjectPtr()) );
+ return TapGestureDetector(dynamic_cast<Dali::Internal::TapGestureDetector*>(handle.GetObjectPtr()));
}
TapGestureDetector::~TapGestureDetector()
class DALI_CORE_API TapGestureDetector : public GestureDetector
{
public: // Typedefs
-
/**
* @brief Signal type for detected signal.
* @SINCE_1_0.0
*/
- using DetectedSignalType = Signal<void( Actor, const TapGesture& )>;
+ using DetectedSignalType = Signal<void(Actor, const TapGesture&)>;
public: // Creation & Destruction
-
/**
* @brief Creates an uninitialized TapGestureDetector; this can be initialized with TapGestureDetector::New().
*
* @param[in] tapsRequired The minimum & maximum number of taps required
* @return A handle to a newly allocated Dali resource
*/
- static TapGestureDetector New( uint32_t tapsRequired );
+ static TapGestureDetector New(uint32_t tapsRequired);
/**
* @brief Downcasts a handle to TapGestureDetector handle.
* @param[in] handle Handle to an object
* @return Handle to a TapGestureDetector object or an uninitialized handle
*/
- static TapGestureDetector DownCast( BaseHandle handle );
+ static TapGestureDetector DownCast(BaseHandle handle);
/**
* @brief Destructor.
TapGestureDetector& operator=(const TapGestureDetector& rhs);
public: // Setters
-
/**
* @brief Sets the minimum number of taps required.
*
* @pre The gesture detector has been initialized.
* @note The default is '1', the maximum is 2.
*/
- void SetMinimumTapsRequired( uint32_t minimumTaps );
+ void SetMinimumTapsRequired(uint32_t minimumTaps);
/**
* @brief Sets the maximum number of taps required.
* @pre The gesture detector has been initialized.
* @note The default is '1', the maximum is 2.
*/
- void SetMaximumTapsRequired( uint32_t maximumTaps );
+ void SetMaximumTapsRequired(uint32_t maximumTaps);
public: // Getters
-
/**
* @brief Retrieves the minimum number of taps required.
*
uint32_t GetMaximumTapsRequired() const;
public: // Signals
-
/**
* @brief This signal is emitted when the specified tap is detected on the attached actor.
*
DetectedSignalType& DetectedSignal();
public: // Not intended for Application developers
-
/// @cond internal
/**
* @brief This constructor is used by TapGestureDetector::New() methods.
#include <dali/public-api/events/tap-gesture.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/internal/event/events/tap-gesture/tap-gesture-impl.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
-TapGesture::TapGesture( Internal::TapGesture* internal )
-: Gesture( internal )
+TapGesture::TapGesture(Internal::TapGesture* internal)
+: Gesture(internal)
{
}
TapGesture::TapGesture() = default;
-TapGesture::TapGesture( const TapGesture& rhs ) = default;
+TapGesture::TapGesture(const TapGesture& rhs) = default;
-TapGesture::TapGesture( TapGesture&& rhs ) = default;
+TapGesture::TapGesture(TapGesture&& rhs) = default;
-TapGesture& TapGesture::operator=( const TapGesture& rhs ) = default;
+TapGesture& TapGesture::operator=(const TapGesture& rhs) = default;
-TapGesture& TapGesture::operator=( TapGesture&& rhs ) = default;
+TapGesture& TapGesture::operator=(TapGesture&& rhs) = default;
TapGesture::~TapGesture() = default;
uint32_t TapGesture::GetNumberOfTaps() const
{
- return GetImplementation( *this ).GetNumberOfTaps();
+ return GetImplementation(*this).GetNumberOfTaps();
}
uint32_t TapGesture::GetNumberOfTouches() const
{
- return GetImplementation( *this ).GetNumberOfTouches();
+ return GetImplementation(*this).GetNumberOfTouches();
}
const Vector2& TapGesture::GetScreenPoint() const
{
- return GetImplementation( *this ).GetScreenPoint();
+ return GetImplementation(*this).GetScreenPoint();
}
const Vector2& TapGesture::GetLocalPoint() const
{
- return GetImplementation( *this ).GetLocalPoint();
+ return GetImplementation(*this).GetLocalPoint();
}
} // namespace Dali
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class TapGesture;
class DALI_CORE_API TapGesture : public Gesture
{
public:
-
/**
* @brief Creates an uninitialized TapGesture handle.
*
* @SINCE_1_9.28
* @param rhs A reference to the copied handle
*/
- TapGesture( const TapGesture& rhs );
+ TapGesture(const TapGesture& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.28
* @param rhs The handle to move.
*/
- TapGesture( TapGesture&& rhs );
+ TapGesture(TapGesture&& rhs);
/**
* @brief Assignment operator.
* @param rhs A reference to the copied handle
* @return A reference to this
*/
- TapGesture& operator=( const TapGesture& rhs );
+ TapGesture& operator=(const TapGesture& rhs);
/**
* @brief Move assignment operator.
* @SINCE_1_9.28
* @param rhs The handle to move.
*/
- TapGesture& operator=( TapGesture&& rhs );
+ TapGesture& operator=(TapGesture&& rhs);
/**
* @brief Non virtual destructor.
const Vector2& GetLocalPoint() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized TapGesture handle.
* @param[in] tapGesture A pointer to a newly allocated Dali resource
* @SINCE_1_9.28
*/
- explicit DALI_INTERNAL TapGesture( Internal::TapGesture* tapGesture );
+ explicit DALI_INTERNAL TapGesture(Internal::TapGesture* tapGesture);
/// @endcond
};
#include <dali/public-api/events/touch-event.h>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
#include <dali/internal/event/events/touch-event-impl.h>
+#include <dali/public-api/actors/actor.h>
#include <cstdio>
namespace Dali
{
-
TouchEvent::TouchEvent() = default;
-TouchEvent::TouchEvent( const TouchEvent& other ) = default;
+TouchEvent::TouchEvent(const TouchEvent& other) = default;
-TouchEvent::TouchEvent( TouchEvent&& other ) = default;
+TouchEvent::TouchEvent(TouchEvent&& other) = default;
TouchEvent::~TouchEvent() = default;
-TouchEvent& TouchEvent::operator=( const TouchEvent& other ) = default;
+TouchEvent& TouchEvent::operator=(const TouchEvent& other) = default;
-TouchEvent& TouchEvent::operator=( TouchEvent&& other ) = default;
+TouchEvent& TouchEvent::operator=(TouchEvent&& other) = default;
unsigned long TouchEvent::GetTime() const
{
- return GetImplementation( *this ).GetTime();
+ return GetImplementation(*this).GetTime();
}
std::size_t TouchEvent::GetPointCount() const
{
- return GetImplementation( *this ).GetPointCount();
+ return GetImplementation(*this).GetPointCount();
}
-int32_t TouchEvent::GetDeviceId( std::size_t point ) const
+int32_t TouchEvent::GetDeviceId(std::size_t point) const
{
- return GetImplementation( *this ).GetDeviceId( point );
+ return GetImplementation(*this).GetDeviceId(point);
}
-PointState::Type TouchEvent::GetState( std::size_t point ) const
+PointState::Type TouchEvent::GetState(std::size_t point) const
{
- return GetImplementation( *this ).GetState( point );
+ return GetImplementation(*this).GetState(point);
}
-Actor TouchEvent::GetHitActor( std::size_t point ) const
+Actor TouchEvent::GetHitActor(std::size_t point) const
{
- return GetImplementation( *this ).GetHitActor( point );
+ return GetImplementation(*this).GetHitActor(point);
}
-const Vector2& TouchEvent::GetLocalPosition( std::size_t point ) const
+const Vector2& TouchEvent::GetLocalPosition(std::size_t point) const
{
- return GetImplementation( *this ).GetLocalPosition( point );
+ return GetImplementation(*this).GetLocalPosition(point);
}
-const Vector2& TouchEvent::GetScreenPosition( std::size_t point ) const
+const Vector2& TouchEvent::GetScreenPosition(std::size_t point) const
{
- return GetImplementation( *this ).GetScreenPosition( point );
+ return GetImplementation(*this).GetScreenPosition(point);
}
-float TouchEvent::GetRadius( std::size_t point ) const
+float TouchEvent::GetRadius(std::size_t point) const
{
- return GetImplementation( *this ).GetRadius( point );
+ return GetImplementation(*this).GetRadius(point);
}
-const Vector2& TouchEvent::GetEllipseRadius( std::size_t point ) const
+const Vector2& TouchEvent::GetEllipseRadius(std::size_t point) const
{
- return GetImplementation( *this ).GetEllipseRadius( point );
+ return GetImplementation(*this).GetEllipseRadius(point);
}
-float TouchEvent::GetPressure( std::size_t point ) const
+float TouchEvent::GetPressure(std::size_t point) const
{
- return GetImplementation( *this ).GetPressure( point );
+ return GetImplementation(*this).GetPressure(point);
}
-Degree TouchEvent::GetAngle( std::size_t point ) const
+Degree TouchEvent::GetAngle(std::size_t point) const
{
- return GetImplementation( *this ).GetAngle( point );
+ return GetImplementation(*this).GetAngle(point);
}
-Device::Class::Type TouchEvent::GetDeviceClass( std::size_t point ) const
+Device::Class::Type TouchEvent::GetDeviceClass(std::size_t point) const
{
- return GetImplementation( *this ).GetDeviceClass( point );
+ return GetImplementation(*this).GetDeviceClass(point);
}
-Device::Subclass::Type TouchEvent::GetDeviceSubclass( std::size_t point ) const
+Device::Subclass::Type TouchEvent::GetDeviceSubclass(std::size_t point) const
{
- return GetImplementation( *this ).GetDeviceSubclass( point );
+ return GetImplementation(*this).GetDeviceSubclass(point);
}
-MouseButton::Type TouchEvent::GetMouseButton( std::size_t point ) const
+MouseButton::Type TouchEvent::GetMouseButton(std::size_t point) const
{
- return GetImplementation( *this ).GetMouseButton( point );
+ return GetImplementation(*this).GetMouseButton(point);
}
-TouchEvent::TouchEvent( Internal::TouchEvent* internal )
-: BaseHandle( internal )
+TouchEvent::TouchEvent(Internal::TouchEvent* internal)
+: BaseHandle(internal)
{
}
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/events/device.h>
+#include <dali/public-api/events/mouse-button.h>
#include <dali/public-api/events/point-state.h>
-#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/math/degree.h>
-#include <dali/public-api/events/mouse-button.h>
+#include <dali/public-api/object/base-handle.h>
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class TouchEvent;
class DALI_CORE_API TouchEvent : public BaseHandle
{
public:
-
// Construction & Destruction
/**
* @SINCE_1_9.26
* @param[in] other The TouchEvent to copy from
*/
- TouchEvent( const TouchEvent& other );
+ TouchEvent(const TouchEvent& other);
/**
* @brief Move constructor.
* @SINCE_1_9.28
* @param[in] other The TouchEvent to move
*/
- TouchEvent( TouchEvent&& other );
+ TouchEvent(TouchEvent&& other);
/**
* @brief Destructor.
* @param[in] other The TouchEvent to copy from
* @return A reference to this
*/
- TouchEvent& operator=( const TouchEvent& other );
+ TouchEvent& operator=(const TouchEvent& other);
/**
* @brief Move assignment Operator.
* @param[in] other The TouchEvent to move
* @return A reference to this
*/
- TouchEvent& operator=( TouchEvent&& other );
+ TouchEvent& operator=(TouchEvent&& other);
// Getters
* @return The Device ID of this point
* @note If point is greater than GetPointCount() then this method will return -1.
*/
- int32_t GetDeviceId( std::size_t point ) const;
+ int32_t GetDeviceId(std::size_t point) const;
/**
* @brief Retrieves the State of the point specified.
* @note If point is greater than GetPointCount() then this method will return PointState::FINISHED.
* @see State
*/
- PointState::Type GetState( std::size_t point ) const;
+ PointState::Type GetState(std::size_t point) const;
/**
* @brief Retrieves the actor that was underneath the point specified.
* @return The actor that was underneath the point specified
* @note If point is greater than GetPointCount() then this method will return an empty handle.
*/
- Actor GetHitActor( std::size_t point ) const;
+ Actor GetHitActor(std::size_t point) const;
/**
* @brief Retrieves the co-ordinates relative to the top-left of the hit-actor at the point specified.
* then you should use Actor::ScreenToLocal().
* @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
*/
- const Vector2& GetLocalPosition( std::size_t point ) const;
+ const Vector2& GetLocalPosition(std::size_t point) const;
/**
* @brief Retrieves the co-ordinates relative to the top-left of the screen of the point specified.
* @return The co-ordinates relative to the top-left of the screen of the point specified
* @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
*/
- const Vector2& GetScreenPosition( std::size_t point ) const;
+ const Vector2& GetScreenPosition(std::size_t point) const;
/**
* @brief Retrieves the radius of the press point.
* @return The radius of the press point
* @note If point is greater than GetPointCount() then this method will return 0.0f.
*/
- float GetRadius( std::size_t point ) const;
+ float GetRadius(std::size_t point) const;
/**
* @brief Retrieves BOTH the horizontal and the vertical radii of the press point.
* @return The horizontal and vertical radii of the press point
* @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
*/
- const Vector2& GetEllipseRadius( std::size_t point ) const;
+ const Vector2& GetEllipseRadius(std::size_t point) const;
/**
* @brief Retrieves the touch pressure.
* @return The touch pressure
* @note If point is greater than GetPointCount() then this method will return 1.0f.
*/
- float GetPressure( std::size_t point ) const;
+ float GetPressure(std::size_t point) const;
/**
* @brief Retrieves the angle of the press point relative to the Y-Axis.
* @return The angle of the press point
* @note If point is greater than GetPointCount() then this method will return Degree().
*/
- Degree GetAngle( std::size_t point ) const;
+ Degree GetAngle(std::size_t point) const;
/**
* @brief Gets the device class type from which the mouse/touch event is originated.
* @param[in] point The point required
* @return The type of the device class
*/
- Device::Class::Type GetDeviceClass( std::size_t point ) const;
+ Device::Class::Type GetDeviceClass(std::size_t point) const;
/**
* @brief Gets the subclass type of the device from which the mouse/touch event is originated.
* @param[in] point The point required
* @return The type of the device subclass
*/
- Device::Subclass::Type GetDeviceSubclass( std::size_t point ) const;
-
+ Device::Subclass::Type GetDeviceSubclass(std::size_t point) const;
/**
* @brief Gets the value, which indicates a mouse button. (ex: right/left button)
* @param[in] point The point required
* @return The mouse button value
*/
- MouseButton::Type GetMouseButton( std::size_t point ) const;
-
+ MouseButton::Type GetMouseButton(std::size_t point) const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized TouchEvent handle.
* @SINCE_1_9.26
* @param[in] internal A pointer to a newly allocated Dali resource
*/
- explicit DALI_INTERNAL TouchEvent( Internal::TouchEvent* internal );
+ explicit DALI_INTERNAL TouchEvent(Internal::TouchEvent* internal);
/// @endcond
};
namespace Dali
{
-
WheelEvent::WheelEvent()
: BaseHandle()
{
}
-WheelEvent::WheelEvent( const WheelEvent& rhs ) = default;
+WheelEvent::WheelEvent(const WheelEvent& rhs) = default;
-WheelEvent::WheelEvent( WheelEvent&& rhs ) = default;
+WheelEvent::WheelEvent(WheelEvent&& rhs) = default;
WheelEvent::~WheelEvent()
{
}
-WheelEvent& WheelEvent::operator=( const WheelEvent& rhs ) = default;
+WheelEvent& WheelEvent::operator=(const WheelEvent& rhs) = default;
-WheelEvent& WheelEvent::operator=( WheelEvent&& rhs ) = default;
+WheelEvent& WheelEvent::operator=(WheelEvent&& rhs) = default;
bool WheelEvent::IsShiftModifier() const
{
- return GetImplementation( *this ).IsShiftModifier();
+ return GetImplementation(*this).IsShiftModifier();
}
bool WheelEvent::IsCtrlModifier() const
{
- return GetImplementation( *this ).IsCtrlModifier();
+ return GetImplementation(*this).IsCtrlModifier();
}
bool WheelEvent::IsAltModifier() const
{
- return GetImplementation( *this ).IsAltModifier();
+ return GetImplementation(*this).IsAltModifier();
}
WheelEvent::Type WheelEvent::GetType() const
{
- return GetImplementation( *this ).GetType();
+ return GetImplementation(*this).GetType();
}
int32_t WheelEvent::GetDirection() const
{
- return GetImplementation( *this ).GetDirection();
+ return GetImplementation(*this).GetDirection();
}
uint32_t WheelEvent::GetModifiers() const
{
- return GetImplementation( *this ).GetModifiers();
+ return GetImplementation(*this).GetModifiers();
}
const Vector2& WheelEvent::GetPoint() const
{
- return GetImplementation( *this ).GetPoint();
+ return GetImplementation(*this).GetPoint();
}
int32_t WheelEvent::GetDelta() const
{
- return GetImplementation( *this ).GetDelta();
+ return GetImplementation(*this).GetDelta();
}
uint32_t WheelEvent::GetTime() const
{
- return GetImplementation( *this ).GetTime();
+ return GetImplementation(*this).GetTime();
}
-WheelEvent::WheelEvent( Internal::WheelEvent* internal )
-: BaseHandle( internal )
+WheelEvent::WheelEvent(Internal::WheelEvent* internal)
+: BaseHandle(internal)
{
}
namespace Dali
{
-
namespace Internal DALI_INTERNAL
{
class WheelEvent;
*/
class DALI_CORE_API WheelEvent : public BaseHandle
{
-
public:
-
// Enumerations
/**
*/
enum Type
{
- MOUSE_WHEEL, ///< Mouse wheel event @SINCE_1_0.0
- CUSTOM_WHEEL ///< Custom wheel event @SINCE_1_0.0
+ MOUSE_WHEEL, ///< Mouse wheel event @SINCE_1_0.0
+ CUSTOM_WHEEL ///< Custom wheel event @SINCE_1_0.0
};
// Construction & Destruction
* @SINCE_1_9.26
* @param[in] rhs The WheelEvent to copy from
*/
- WheelEvent( const WheelEvent& rhs );
+ WheelEvent(const WheelEvent& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.26
* @param[in] rhs A reference to the moved WheelEvent
*/
- WheelEvent( WheelEvent&& rhs );
+ WheelEvent(WheelEvent&& rhs);
/**
* @brief Destructor.
* @param[in] rhs The WheelEvent to copy from
* @return A reference to this
*/
- WheelEvent& operator=( const WheelEvent& rhs );
+ WheelEvent& operator=(const WheelEvent& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved WheelEvent
* @return A reference to this
*/
- WheelEvent& operator=( WheelEvent&& rhs );
+ WheelEvent& operator=(WheelEvent&& rhs);
/**
* @brief Checks to see if Shift key modifier has been supplied.
uint32_t GetTime() const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used internally to Create an initialized WheelEvent handle.
* @SINCE_1_9.26
* @param[in] wheelEvent A pointer to a newly allocated Dali resource
*/
- explicit DALI_INTERNAL WheelEvent( Internal::WheelEvent* hoverEvent );
+ explicit DALI_INTERNAL WheelEvent(Internal::WheelEvent* hoverEvent);
/// @endcond
};
#define DALI_IMAGE_OPERATIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
namespace FittingMode
{
- /**
+/**
* @brief Enumeration for FittingMode type.
* @SINCE_1_0.0
*/
- enum Type
- {
- SHRINK_TO_FIT, ///< Fit full image inside desired width & height, potentially not
- /// filling one of either the desired image width or height with
- /// pixels.
- /// @SINCE_1_0.0
- SCALE_TO_FILL, ///< Image fills whole desired width & height with image data. The
- /// image is centred in the desired dimensions, exactly touching
- /// in one dimension, with image regions outside the other desired
- /// dimension cropped away.
- /// @SINCE_1_0.0
- FIT_WIDTH, ///< Image fills whole width. Height is scaled proportionately to
- /// maintain aspect ratio.
- /// @SINCE_1_0.0
- FIT_HEIGHT ///< Image fills whole height. Width is scaled proportionately to
- /// maintain aspect ratio.
- /// @SINCE_1_0.0
- };
- const Type DEFAULT = SHRINK_TO_FIT;
-}
+enum Type
+{
+ SHRINK_TO_FIT, ///< Fit full image inside desired width & height, potentially not
+ /// filling one of either the desired image width or height with
+ /// pixels.
+ /// @SINCE_1_0.0
+ SCALE_TO_FILL, ///< Image fills whole desired width & height with image data. The
+ /// image is centred in the desired dimensions, exactly touching
+ /// in one dimension, with image regions outside the other desired
+ /// dimension cropped away.
+ /// @SINCE_1_0.0
+ FIT_WIDTH, ///< Image fills whole width. Height is scaled proportionately to
+ /// maintain aspect ratio.
+ /// @SINCE_1_0.0
+ FIT_HEIGHT ///< Image fills whole height. Width is scaled proportionately to
+ /// maintain aspect ratio.
+ /// @SINCE_1_0.0
+};
+const Type DEFAULT = SHRINK_TO_FIT;
+} // namespace FittingMode
/**
* @brief Filtering options, used when resizing images to sample original pixels.
*/
namespace SamplingMode
{
- /**
+/**
* @brief Enumeration for SamplingMode type.
* @SINCE_1_0.0
*/
- enum Type
- {
- BOX, ///< Iteratively box filter to generate an image of 1/2, 1/4,
- /// 1/8, etc width and height and approximately the desired
- /// size. This is the default.
- /// @SINCE_1_0.0
- NEAREST, ///< For each output pixel, read one input pixel.
- /// @SINCE_1_0.0
- LINEAR, ///< For each output pixel, read a quad of four input pixels
- /// and write a weighted average of them.
- /// @SINCE_1_0.0
- BOX_THEN_NEAREST, ///< Iteratively box filter to generate an image of 1/2, 1/4,
- /// 1/8 etc width and height and approximately the desired
- /// size, then for each output pixel, read one pixel from the
- /// last level of box filtering.
- /// @SINCE_1_0.0
- BOX_THEN_LINEAR, ///< Iteratively box filter to almost the right size, then for
- /// each output pixel, read four pixels from the last level of
- /// box filtering and write their weighted average.
- /// @SINCE_1_0.0
- NO_FILTER, ///< No filtering is performed. If the SCALE_TO_FILL scaling mode
- /// is enabled, the borders of the image may be trimmed to
- /// match the aspect ratio of the desired dimensions.
- /// @SINCE_1_0.0
- DONT_CARE ///< For caching algorithms where a client strongly prefers a
- /// cache-hit to reuse a cached image.
- /// @SINCE_1_0.0
- };
- const Type DEFAULT = BOX;
-}
+enum Type
+{
+ BOX, ///< Iteratively box filter to generate an image of 1/2, 1/4,
+ /// 1/8, etc width and height and approximately the desired
+ /// size. This is the default.
+ /// @SINCE_1_0.0
+ NEAREST, ///< For each output pixel, read one input pixel.
+ /// @SINCE_1_0.0
+ LINEAR, ///< For each output pixel, read a quad of four input pixels
+ /// and write a weighted average of them.
+ /// @SINCE_1_0.0
+ BOX_THEN_NEAREST, ///< Iteratively box filter to generate an image of 1/2, 1/4,
+ /// 1/8 etc width and height and approximately the desired
+ /// size, then for each output pixel, read one pixel from the
+ /// last level of box filtering.
+ /// @SINCE_1_0.0
+ BOX_THEN_LINEAR, ///< Iteratively box filter to almost the right size, then for
+ /// each output pixel, read four pixels from the last level of
+ /// box filtering and write their weighted average.
+ /// @SINCE_1_0.0
+ NO_FILTER, ///< No filtering is performed. If the SCALE_TO_FILL scaling mode
+ /// is enabled, the borders of the image may be trimmed to
+ /// match the aspect ratio of the desired dimensions.
+ /// @SINCE_1_0.0
+ DONT_CARE ///< For caching algorithms where a client strongly prefers a
+ /// cache-hit to reuse a cached image.
+ /// @SINCE_1_0.0
+};
+const Type DEFAULT = BOX;
+} // namespace SamplingMode
/**
* @}
#include <cstdint> // uint32_t
// INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/any.h>
+#include <dali/public-api/object/ref-object.h>
namespace Dali
{
class NativeImageInterface : public Dali::RefObject
{
public:
-
class Extension; ///< Forward declare future extension interface
/**
*/
virtual uint32_t GetHeight() const = 0;
- /**
+ /**
* @brief Queries whether blending is required.
* @SINCE_1_0.0
* @return True if blending is required
}
protected:
-
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*
~NativeImageInterface() override
{
}
-
};
/**
namespace Dali
{
-
-PixelData PixelData::New( uint8_t* buffer,
- uint32_t bufferSize,
- uint32_t width,
- uint32_t height,
- Pixel::Format pixelFormat,
- ReleaseFunction releaseFunction )
+PixelData PixelData::New(uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ Pixel::Format pixelFormat,
+ ReleaseFunction releaseFunction)
{
- IntrusivePtr<Internal::PixelData> internal = Internal::PixelData::New( buffer, bufferSize, width, height, pixelFormat, releaseFunction );
- return PixelData( internal.Get() );
+ IntrusivePtr<Internal::PixelData> internal = Internal::PixelData::New(buffer, bufferSize, width, height, pixelFormat, releaseFunction);
+ return PixelData(internal.Get());
}
PixelData::PixelData()
{
}
-PixelData::PixelData( Internal::PixelData* internal )
-: BaseHandle( internal )
+PixelData::PixelData(Internal::PixelData* internal)
+: BaseHandle(internal)
{
}
PixelData& PixelData::operator=(const PixelData& rhs) = default;
-PixelData::PixelData( PixelData&& rhs ) = default;
+PixelData::PixelData(PixelData&& rhs) = default;
-PixelData& PixelData::operator=( PixelData&& rhs ) = default;
+PixelData& PixelData::operator=(PixelData&& rhs) = default;
uint32_t PixelData::GetWidth() const
{
class DALI_CORE_API PixelData : public BaseHandle
{
public:
-
/**
* @brief Enumeration for Function to release the pixel buffer.
* @SINCE_1_1.43
*/
enum ReleaseFunction
{
- FREE, ///< Use free function to release the pixel buffer @SINCE_1_1.43
- DELETE_ARRAY, ///< Use delete[] operator to release the pixel buffer @SINCE_1_1.43
+ FREE, ///< Use free function to release the pixel buffer @SINCE_1_1.43
+ DELETE_ARRAY, ///< Use delete[] operator to release the pixel buffer @SINCE_1_1.43
};
/**
* @param[in] releaseFunction The function used to release the memory
* @return A handle to the PixelData
*/
- static PixelData New( uint8_t* buffer,
- uint32_t bufferSize,
- uint32_t width,
- uint32_t height,
- Pixel::Format pixelFormat,
- ReleaseFunction releaseFunction);
+ static PixelData New(uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ Pixel::Format pixelFormat,
+ ReleaseFunction releaseFunction);
/**
* @brief Creates an empty handle.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- PixelData( PixelData&& rhs );
+ PixelData(PixelData&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- PixelData& operator=( PixelData&& rhs );
+ PixelData& operator=(PixelData&& rhs);
/**
* @brief Gets the width of the buffer in pixels.
Pixel::Format GetPixelFormat() const;
public:
-
/**
* @brief The constructor.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] pointer A pointer to a newly allocated PixelData
*/
- explicit DALI_INTERNAL PixelData( Internal::PixelData* pointer );
+ explicit DALI_INTERNAL PixelData(Internal::PixelData* pointer);
};
/**
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/images/pixel.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
bool Pixel::HasAlpha(Format pixelformat)
{
- switch (pixelformat)
+ switch(pixelformat)
{
case RGBA5551:
case RGBA8888:
uint32_t Pixel::GetBytesPerPixel(Format pixelFormat)
{
- switch (pixelFormat)
+ switch(pixelFormat)
{
case L8:
case A8:
void Pixel::GetAlphaOffsetAndMask(Format pixelFormat, int& byteOffset, int& bitMask)
{
- switch (pixelFormat)
+ switch(pixelFormat)
{
case A8:
{
case BGR8888:
case BGR565:
{
- byteOffset=0;
- bitMask=0;
+ byteOffset = 0;
+ bitMask = 0;
break;
}
case LA88:
{
- byteOffset=1;
- bitMask=0xff;
+ byteOffset = 1;
+ bitMask = 0xff;
break;
}
case RGBA4444:
case BGRA4444:
{
- byteOffset=1;
- bitMask=0x0f;
+ byteOffset = 1;
+ bitMask = 0x0f;
break;
}
case RGBA5551:
case BGRA5551:
{
- byteOffset=1;
- bitMask=0x01;
+ byteOffset = 1;
+ bitMask = 0x01;
break;
}
case RGBA8888:
case BGRA8888:
{
- byteOffset=3;
- bitMask=0xff;
+ byteOffset = 3;
+ bitMask = 0xff;
break;
}
case INVALID:
{
DALI_LOG_ERROR("Pixel formats are not compatible with simple masking-out of per-pixel alpha.\n");
- byteOffset=0;
- bitMask=0;
+ byteOffset = 0;
+ bitMask = 0;
break;
}
}
#define DALI_PIXEL_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
enum Format
{
- INVALID = 0, ///< Used to represent an unsupported format. @SINCE_1_1.17
+ INVALID = 0, ///< Used to represent an unsupported format. @SINCE_1_1.17
// Start at > 0 to distinguish null data:
- A8 = 1, ///< color depth 8-bit, alpha @SINCE_1_0.0
- L8, ///< color depth 8-bit, luminance @SINCE_1_0.0
- LA88, ///< color depth 16-bit, luminance with 8 bit alpha @SINCE_1_0.0
- RGB565, ///< color depth 16 bit, 5-6-5 @SINCE_1_0.0
- BGR565, ///< color depth 16 bit, 5-6-5 @SINCE_1_0.0
- RGBA4444, ///< color depth 16 bit with alpha, 4-4-4-4 @SINCE_1_0.0
- BGRA4444, ///< color depth 16 bit with alpha, 4-4-4-4 @SINCE_1_0.0
- RGBA5551, ///< color depth 16 bit with alpha, 5-5-5-1 @SINCE_1_0.0
- BGRA5551, ///< color depth 16 bit with alpha, 5-5-5-1 @SINCE_1_0.0
- RGB888, ///< color depth 24 bit, 8-8-8 @SINCE_1_0.0
- RGB8888, ///< color depth 32 bit, alpha is reserved but not used, 8-8-8-8# @SINCE_1_0.0
- BGR8888, ///< color depth 32 bit, alpha is reserved but not used, 8-8-8-8# @SINCE_1_0.0
- RGBA8888, ///< color depth 32 bit with alpha, 8-8-8-8 @SINCE_1_0.0
- BGRA8888, ///< color depth 32 bit with alpha, 8-8-8-8 @SINCE_1_0.0
+ A8 = 1, ///< color depth 8-bit, alpha @SINCE_1_0.0
+ L8, ///< color depth 8-bit, luminance @SINCE_1_0.0
+ LA88, ///< color depth 16-bit, luminance with 8 bit alpha @SINCE_1_0.0
+ RGB565, ///< color depth 16 bit, 5-6-5 @SINCE_1_0.0
+ BGR565, ///< color depth 16 bit, 5-6-5 @SINCE_1_0.0
+ RGBA4444, ///< color depth 16 bit with alpha, 4-4-4-4 @SINCE_1_0.0
+ BGRA4444, ///< color depth 16 bit with alpha, 4-4-4-4 @SINCE_1_0.0
+ RGBA5551, ///< color depth 16 bit with alpha, 5-5-5-1 @SINCE_1_0.0
+ BGRA5551, ///< color depth 16 bit with alpha, 5-5-5-1 @SINCE_1_0.0
+ RGB888, ///< color depth 24 bit, 8-8-8 @SINCE_1_0.0
+ RGB8888, ///< color depth 32 bit, alpha is reserved but not used, 8-8-8-8# @SINCE_1_0.0
+ BGR8888, ///< color depth 32 bit, alpha is reserved but not used, 8-8-8-8# @SINCE_1_0.0
+ RGBA8888, ///< color depth 32 bit with alpha, 8-8-8-8 @SINCE_1_0.0
+ BGRA8888, ///< color depth 32 bit with alpha, 8-8-8-8 @SINCE_1_0.0
// GLES 3 Standard compressed formats:
- COMPRESSED_R11_EAC, ///< ETC2 / EAC single-channel, unsigned @SINCE_1_0.0
- COMPRESSED_SIGNED_R11_EAC, ///< ETC2 / EAC single-channel, signed @SINCE_1_0.0
- COMPRESSED_RG11_EAC, ///< ETC2 / EAC dual-channel, unsigned @SINCE_1_0.0
- COMPRESSED_SIGNED_RG11_EAC, ///< ETC2 / EAC dual-channel, signed @SINCE_1_0.0
- COMPRESSED_RGB8_ETC2, ///< ETC2 / EAC RGB @SINCE_1_0.0
- COMPRESSED_SRGB8_ETC2, ///< ETC2 / EAC RGB using sRGB colourspace. @SINCE_1_0.0
- COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, ///< ETC2 / EAC RGB with single bit per pixel alpha mask. @SINCE_1_0.0
- COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,///< ETC2 / EAC RGB using sRGB colourspace, with single bit per pixel alpha mask. @SINCE_1_0.0
- COMPRESSED_RGBA8_ETC2_EAC, ///< ETC2 / EAC RGB plus separate alpha channel. @SINCE_1_0.0
- COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, ///< ETC2 / EAC RGB using sRGB colourspace, plus separate alpha channel. @SINCE_1_0.0
+ COMPRESSED_R11_EAC, ///< ETC2 / EAC single-channel, unsigned @SINCE_1_0.0
+ COMPRESSED_SIGNED_R11_EAC, ///< ETC2 / EAC single-channel, signed @SINCE_1_0.0
+ COMPRESSED_RG11_EAC, ///< ETC2 / EAC dual-channel, unsigned @SINCE_1_0.0
+ COMPRESSED_SIGNED_RG11_EAC, ///< ETC2 / EAC dual-channel, signed @SINCE_1_0.0
+ COMPRESSED_RGB8_ETC2, ///< ETC2 / EAC RGB @SINCE_1_0.0
+ COMPRESSED_SRGB8_ETC2, ///< ETC2 / EAC RGB using sRGB colourspace. @SINCE_1_0.0
+ COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, ///< ETC2 / EAC RGB with single bit per pixel alpha mask. @SINCE_1_0.0
+ COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, ///< ETC2 / EAC RGB using sRGB colourspace, with single bit per pixel alpha mask. @SINCE_1_0.0
+ COMPRESSED_RGBA8_ETC2_EAC, ///< ETC2 / EAC RGB plus separate alpha channel. @SINCE_1_0.0
+ COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, ///< ETC2 / EAC RGB using sRGB colourspace, plus separate alpha channel. @SINCE_1_0.0
// GLES 2 extension compressed formats:
- COMPRESSED_RGB8_ETC1, ///< ETC1 RGB as defined by GLES 2 extension OES_compressed_ETC1_RGB8_texture: http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt @SINCE_1_0.0
- COMPRESSED_RGB_PVRTC_4BPPV1, ///< PowerVR 4bpp RGB format (v1) as defined by extension IMG_texture_compression_pvrtc: http://www.khronos.org/registry/gles/extensions/IMG/IMG_texture_compression_pvrtc.txt @SINCE_1_0.0
+ COMPRESSED_RGB8_ETC1, ///< ETC1 RGB as defined by GLES 2 extension OES_compressed_ETC1_RGB8_texture: http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt @SINCE_1_0.0
+ COMPRESSED_RGB_PVRTC_4BPPV1, ///< PowerVR 4bpp RGB format (v1) as defined by extension IMG_texture_compression_pvrtc: http://www.khronos.org/registry/gles/extensions/IMG/IMG_texture_compression_pvrtc.txt @SINCE_1_0.0
// GLES 3.1 compressed formats:
- COMPRESSED_RGBA_ASTC_4x4_KHR, ///< ASTC Linear color space with a 4x4 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_5x4_KHR, ///< ASTC Linear color space with a 5x4 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_5x5_KHR, ///< ASTC Linear color space with a 5x5 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_6x5_KHR, ///< ASTC Linear color space with a 6x5 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_6x6_KHR, ///< ASTC Linear color space with a 6x6 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_8x5_KHR, ///< ASTC Linear color space with a 8x5 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_8x6_KHR, ///< ASTC Linear color space with a 8x6 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_8x8_KHR, ///< ASTC Linear color space with a 8x8 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_10x5_KHR, ///< ASTC Linear color space with a 10x5 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_10x6_KHR, ///< ASTC Linear color space with a 10x6 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_10x8_KHR, ///< ASTC Linear color space with a 10x8 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_10x10_KHR, ///< ASTC Linear color space with a 10x10 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_12x10_KHR, ///< ASTC Linear color space with a 12x10 block-size. @SINCE_1_1.17
- COMPRESSED_RGBA_ASTC_12x12_KHR, ///< ASTC Linear color space with a 12x12 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 4x4 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 5x4 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 5x5 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 6x5 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 6x6 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 8x5 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 8x6 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 8x8 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 10x5 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 10x6 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 10x8 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 10x10 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 12x10 block-size. @SINCE_1_1.17
- COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 12x12 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_4x4_KHR, ///< ASTC Linear color space with a 4x4 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_5x4_KHR, ///< ASTC Linear color space with a 5x4 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_5x5_KHR, ///< ASTC Linear color space with a 5x5 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_6x5_KHR, ///< ASTC Linear color space with a 6x5 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_6x6_KHR, ///< ASTC Linear color space with a 6x6 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_8x5_KHR, ///< ASTC Linear color space with a 8x5 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_8x6_KHR, ///< ASTC Linear color space with a 8x6 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_8x8_KHR, ///< ASTC Linear color space with a 8x8 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_10x5_KHR, ///< ASTC Linear color space with a 10x5 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_10x6_KHR, ///< ASTC Linear color space with a 10x6 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_10x8_KHR, ///< ASTC Linear color space with a 10x8 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_10x10_KHR, ///< ASTC Linear color space with a 10x10 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_12x10_KHR, ///< ASTC Linear color space with a 12x10 block-size. @SINCE_1_1.17
+ COMPRESSED_RGBA_ASTC_12x12_KHR, ///< ASTC Linear color space with a 12x12 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 4x4 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 5x4 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 5x5 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 6x5 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 6x6 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 8x5 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 8x6 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 8x8 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 10x5 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 10x6 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 10x8 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 10x10 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 12x10 block-size. @SINCE_1_1.17
+ COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, ///< ASTC Non-linear (gamma-corrected) color space with a 12x12 block-size. @SINCE_1_1.17
// GLES 3.0 floating point formats.
RGB16F, ///< Color depth 48-bit, 16-16-16 half floating point. @SINCE_1_2.60
RGB32F, ///< Color depth 96-bit, 32-32-32 floating point. @SINCE_1_2.60
DEPTH_UNSIGNED_INT, ///< Unsigned int depth format 32-bit. @SINCE_1_9.9
- DEPTH_FLOAT, ///< Float depth format 32-bit. @SINCE_1_9.9
+ DEPTH_FLOAT, ///< Float depth format 32-bit. @SINCE_1_9.9
DEPTH_STENCIL ///< Depth stencil 32-bit, 24 bit for depth, 8 bit for stencil. @SINCE_1_9.9
///! Update LAST_VALID_PIXEL_FORMAT below if you add an enum value here.
AngleAxis()
: angle(0.0f),
axis(0.0f, 0.0f, 0.0f)
- { }
+ {
+ }
/**
* @brief Creates an angle-axis pair.
* @param[in] initialAngle The initial angle in radians
* @param[in] initialAxis The initial axis
*/
- AngleAxis( Radian initialAngle, const Vector3& initialAxis )
- : angle( initialAngle ),
- axis( initialAxis )
- { }
+ AngleAxis(Radian initialAngle, const Vector3& initialAxis)
+ : angle(initialAngle),
+ axis(initialAxis)
+ {
+ }
public:
-
- AngleAxis( const AngleAxis& ) = default; ///< Default copy constructor
- AngleAxis( AngleAxis&& ) = default; ///< Default move constructor
- AngleAxis& operator=( const AngleAxis& ) = default; ///< Default copy assignment operator
- AngleAxis& operator=( AngleAxis&& ) = default; ///< Default move assignment operator
+ AngleAxis(const AngleAxis&) = default; ///< Default copy constructor
+ AngleAxis(AngleAxis&&) = default; ///< Default move constructor
+ AngleAxis& operator=(const AngleAxis&) = default; ///< Default copy assignment operator
+ AngleAxis& operator=(AngleAxis&&) = default; ///< Default move assignment operator
public:
-
- Radian angle; ///< The angle in radians
- Vector3 axis; ///< The axis
-
+ Radian angle; ///< The angle in radians
+ Vector3 axis; ///< The axis
};
// Compiler generated destructor, copy constructor and assignment operators are ok as this class is POD
* @param rhs angle axis
* @return True if they are equal
*/
-inline bool operator==( const Dali::AngleAxis& lhs, const Dali::AngleAxis& rhs )
+inline bool operator==(const Dali::AngleAxis& lhs, const Dali::AngleAxis& rhs)
{
return (lhs.angle == rhs.angle) && (lhs.axis == rhs.axis);
}
* @param[in] angleAxis The angle axis to print
* @return The output stream operator
*/
-inline std::ostream& operator<< (std::ostream& o, const Dali::AngleAxis& angleAxis)
+inline std::ostream& operator<<(std::ostream& o, const Dali::AngleAxis& angleAxis)
{
- return o << "[ Axis: [" << angleAxis.axis.x << ", " << angleAxis.axis.y << ", " << angleAxis.axis.z << "], Angle: " << Degree( angleAxis.angle ).degree << " degrees ]";
+ return o << "[ Axis: [" << angleAxis.axis.x << ", " << angleAxis.axis.y << ", " << angleAxis.axis.z << "], Angle: " << Degree(angleAxis.angle).degree << " degrees ]";
}
/**
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
// verification for static asserts, these get removed from final binary by the linker
-static_assert( Power<10,0>::value == 1, "" );
-static_assert( Power<10,1>::value == 10, "" );
-static_assert( Power<10,2>::value == 100, "" );
-static_assert( Power<10,3>::value == 1000, "" );
-static_assert( Power<4,4>::value == 256, "" );
-
-static_assert( Log<0, 10>::value == 0, "" );
-static_assert( Log<1, 10>::value == 0, "" );
-static_assert( Log<2, 10>::value == 1, "" );
-static_assert( Log<10, 10>::value == 1, "" );
-static_assert( Log<100, 10>::value == 2, "" );
-static_assert( Log<1000, 10>::value == 3, "" );
-
-static_assert( Log<Power<10,0>::value, 10 >::value == 0, "" );
-static_assert( Log<Power<2,0>::value, 2 >::value == 0, "" );
-static_assert( Log<Power<10,2>::value, 10 >::value == 2, "" );
-static_assert( Log<Power<2,2>::value, 2 >::value == 2, "" );
-
-static_assert( Power<10, Log<10,10>::value >::value == 10, "" );
-static_assert( Power<10, Log<100,10>::value >::value == 100, "" );
+static_assert(Power<10, 0>::value == 1, "");
+static_assert(Power<10, 1>::value == 10, "");
+static_assert(Power<10, 2>::value == 100, "");
+static_assert(Power<10, 3>::value == 1000, "");
+static_assert(Power<4, 4>::value == 256, "");
+
+static_assert(Log<0, 10>::value == 0, "");
+static_assert(Log<1, 10>::value == 0, "");
+static_assert(Log<2, 10>::value == 1, "");
+static_assert(Log<10, 10>::value == 1, "");
+static_assert(Log<100, 10>::value == 2, "");
+static_assert(Log<1000, 10>::value == 3, "");
+
+static_assert(Log<Power<10, 0>::value, 10>::value == 0, "");
+static_assert(Log<Power<2, 0>::value, 2>::value == 0, "");
+static_assert(Log<Power<10, 2>::value, 10>::value == 2, "");
+static_assert(Log<Power<2, 2>::value, 2>::value == 2, "");
+
+static_assert(Power<10, Log<10, 10>::value>::value == 10, "");
+static_assert(Power<10, Log<100, 10>::value>::value == 100, "");
// TODO unfortunately cannot static assert floats so cannot test EPSILON here...
#define DALI_COMPILE_TIME_MATH_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
* @note Values need to be compile time constants.
* Usage: <code>Power< 10, 2 >::value; // value=100</code>
*/
-template< size_t mantissa, size_t exponent >
+template<size_t mantissa, size_t exponent>
struct Power
{
- enum { value = mantissa * Power< mantissa, exponent - 1 >::value };
+ enum
+ {
+ value = mantissa * Power<mantissa, exponent - 1>::value
+ };
};
/**
* @SINCE_1_0.0
* @tparam mantissa to raise to exponent
*/
-template< size_t mantissa >
-struct Power< mantissa, 1 >
+template<size_t mantissa>
+struct Power<mantissa, 1>
{
- enum { value = mantissa };
+ enum
+ {
+ value = mantissa
+ };
};
/**
* @SINCE_1_0.0
* @tparam mantissa to raise to exponent
*/
-template< size_t mantissa >
-struct Power< mantissa, 0 >
+template<size_t mantissa>
+struct Power<mantissa, 0>
{
- enum { value = 1 };
+ enum
+ {
+ value = 1
+ };
};
/**
* @note Values need to be compile time constants.
* Usage: <code>Log< 100, 10 >::value; value equals 2</code>
*/
-template< size_t number, size_t base = 2 >
+template<size_t number, size_t base = 2>
struct Log
{
- enum { value = 1 + Log< number / base, base >::value };
+ enum
+ {
+ value = 1 + Log<number / base, base>::value
+ };
};
/**
* @SINCE_1_0.0
* @tparam base logarithm to calculate
*/
-template< size_t base >
-struct Log< 1, base >
+template<size_t base>
+struct Log<1, base>
{
- enum { value = 0 };
+ enum
+ {
+ value = 0
+ };
};
/**
* @SINCE_1_0.0
* @tparam base logarithm to calculate
*/
-template< size_t base >
-struct Log< 0, base >
+template<size_t base>
+struct Log<0, base>
{
- enum { value = 0 };
+ enum
+ {
+ value = 0
+ };
};
-
/**
* @brief Compiles time template to calculate the machine epsilon for a given floating point number.
*
* @note Value needs to be compile time constant.
* Usage: <code>Epsilon<1000>::value; value equals 0.000119209</code>
*/
-template< size_t N >
+template<size_t N>
struct Epsilon
{
// take log10 of the number to get to the nearest power of 10 number and divide that by 10
// template recursion will take care of the rest
#ifdef _CPP11
- static constexpr float value = 10.0f * Epsilon< Power< 10, Log< N, 10 >::value >::value / 10 >::value;
+ static constexpr float value = 10.0f * Epsilon<Power<10, Log<N, 10>::value>::value / 10>::value;
#else
- static const float value = 10.0f * Epsilon< Power< 10, Log< N, 10 >::value >::value / 10 >::value;
+ static const float value = 10.0f * Epsilon<Power<10, Log<N, 10>::value>::value / 10>::value;
#endif
};
* @SINCE_1_0.0
*/
template<>
-struct Epsilon< 1 >
+struct Epsilon<1>
{
#ifdef _CPP11
static constexpr float value = FLT_EPSILON;
* @SINCE_1_0.0
*/
template<>
-struct Epsilon< 0 >
+struct Epsilon<0>
{
#ifdef _CPP11
static constexpr float value = FLT_MIN;
namespace Dali
{
-
-Degree::Degree( Radian radian )
-: degree( radian * Math::ONE80_OVER_PI )
+Degree::Degree(Radian radian)
+: degree(radian * Math::ONE80_OVER_PI)
{
}
* @SINCE_1_0.0
*/
Degree()
- : degree( 0.f )
- { }
+ : degree(0.f)
+ {
+ }
/**
* @brief Creates an angle in degrees.
* @SINCE_1_0.0
* @param[in] value The initial value in degrees
*/
- explicit constexpr Degree( float value )
- : degree( value )
- { }
+ explicit constexpr Degree(float value)
+ : degree(value)
+ {
+ }
/**
* @brief Creates an angle in degrees from a Radian.
* @SINCE_1_0.0
* @param[in] value The initial value in Radians
*/
- DALI_CORE_API Degree( Radian value );
+ DALI_CORE_API Degree(Radian value);
public:
-
- Degree( const Degree& ) = default; ///< Default copy constructor
- Degree( Degree&& ) = default; ///< Default move constructor
- Degree& operator=( const Degree& ) = default; ///< Default copy assignment operator
- Degree& operator=( Degree&& ) = default; ///< Default move assignment operator
+ Degree(const Degree&) = default; ///< Default copy constructor
+ Degree(Degree&&) = default; ///< Default move constructor
+ Degree& operator=(const Degree&) = default; ///< Default copy assignment operator
+ Degree& operator=(Degree&&) = default; ///< Default move assignment operator
public:
-
// member data
float degree; ///< The value in degrees
-
};
// compiler generated destructor, copy constructor and assignment operators are ok as this class is POD
-
/**
* @brief Compares equality between two degrees.
*
* @param[in] rhs Degree to compare to
* @return True if the values are identical
*/
-inline bool operator==( const Degree& lhs, const Degree& rhs )
+inline bool operator==(const Degree& lhs, const Degree& rhs)
{
- return fabsf( lhs.degree - rhs.degree ) < Math::MACHINE_EPSILON_1000; // expect degree angles to be between 0 and 1000
+ return fabsf(lhs.degree - rhs.degree) < Math::MACHINE_EPSILON_1000; // expect degree angles to be between 0 and 1000
}
/**
* @param[in] rhs Degree to compare to
* @return True if the values are not identical
*/
-inline bool operator!=( const Degree& lhs, const Degree& rhs )
+inline bool operator!=(const Degree& lhs, const Degree& rhs)
{
- return !( operator==( lhs, rhs ) );
+ return !(operator==(lhs, rhs));
}
/**
* @param max value
* @return The resulting radian
*/
-inline Degree Clamp( Degree angle, float min, float max )
+inline Degree Clamp(Degree angle, float min, float max)
{
- return Degree( Clamp<float>( angle.degree, min, max ) );
+ return Degree(Clamp<float>(angle.degree, min, max));
}
/**
#define DALI_MATH_UTILS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <cstdint> // uint32_t
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/constants.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
* @param[in] i Input number
* @return The next power of two or i itself in case it's a power of two
*/
-inline uint32_t NextPowerOfTwo( uint32_t i )
+inline uint32_t NextPowerOfTwo(uint32_t i)
{
DALI_ASSERT_ALWAYS(i <= 1u << (sizeof(uint32_t) * 8 - 1) && "Return type cannot represent the next power of two greater than the argument.");
- if(i==0u)
+ if(i == 0u)
{
return 1u;
}
* @param[in] i Input number
* @return True if i is power of two.
*/
-inline bool IsPowerOfTwo( uint32_t i )
+inline bool IsPowerOfTwo(uint32_t i)
{
return (i != 0u) && ((i & (i - 1u)) == 0u);
}
* @param[in] max The maximum allowed value.
* @return T the clamped value
*/
-template< typename T >
-inline const T& Clamp( const T& value, const T& min, const T& max )
+template<typename T>
+inline const T& Clamp(const T& value, const T& min, const T& max)
{
- const T& constrainedUpper = value < max ? value : max;
+ const T& constrainedUpper = value < max ? value : max;
const T& constrainedUpperAndLower = constrainedUpper > min ? constrainedUpper : min;
- return constrainedUpperAndLower;
+ return constrainedUpperAndLower;
}
/**
* @param[in] min The minimum allowed value.
* @param[in] max The maximum allowed value.
*/
-template< typename T >
-inline void ClampInPlace( T& value, const T& min, const T& max )
+template<typename T>
+inline void ClampInPlace(T& value, const T& min, const T& max)
{
- const T& constrainedUpper = value < max ? value : max;
+ const T& constrainedUpper = value < max ? value : max;
const T& constrainedUpperAndLower = constrainedUpper > min ? constrainedUpper : min;
- value = constrainedUpperAndLower;
+ value = constrainedUpperAndLower;
}
-
/**
* @brief Linear interpolation between two values.
*
* @param[in] high Highest value in range
* @return A value between low and high.
*/
-template< typename T >
-inline const T Lerp( const float offset, const T& low, const T& high )
+template<typename T>
+inline const T Lerp(const float offset, const T& low, const T& high)
{
return low + ((high - low) * Clamp(offset, 0.0f, 1.0f));
}
* @param[in] b the second value in the range.
* @return a suitable epsilon
*/
-inline float GetRangedEpsilon( float a, float b )
+inline float GetRangedEpsilon(float a, float b)
{
- const float absA = fabsf( a );
- const float absB = fabsf( b );
- const float absF = absA > absB ? absA : absB;
- const int32_t absI = static_cast<int32_t>( absF ); // truncated
+ const float absA = fabsf(a);
+ const float absB = fabsf(b);
+ const float absF = absA > absB ? absA : absB;
+ const int32_t absI = static_cast<int32_t>(absF); // truncated
float epsilon = Math::MACHINE_EPSILON_10000;
- if (absF < 0.1f)
+ if(absF < 0.1f)
{
return Math::MACHINE_EPSILON_0;
}
- else if (absI < 2)
+ else if(absI < 2)
{
return Math::MACHINE_EPSILON_1;
}
- else if (absI < 20)
+ else if(absI < 20)
{
return Math::MACHINE_EPSILON_10;
}
- else if (absI < 200)
+ else if(absI < 200)
{
return Math::MACHINE_EPSILON_100;
}
- else if (absI < 2000)
+ else if(absI < 2000)
{
return Math::MACHINE_EPSILON_1000;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
-inline bool EqualsZero( float value )
+inline bool EqualsZero(float value)
{
return value == 0.0f;
}
* @param[in] b the second value to compare
* @return true if the values are equal within a minimal epsilon for their values
*/
-inline bool Equals( float a, float b )
+inline bool Equals(float a, float b)
{
- return ( fabsf( a - b ) <= GetRangedEpsilon( a, b ) );
+ return (fabsf(a - b) <= GetRangedEpsilon(a, b));
}
/**
* @param[in] epsilon the minimum epsilon value that will be used to consider the values different
* @return true if the difference between the values is less than the epsilon
*/
-inline bool Equals( float a, float b, float epsilon )
+inline bool Equals(float a, float b, float epsilon)
{
- return ( fabsf( a - b ) <= epsilon );
+ return (fabsf(a - b) <= epsilon);
}
/**
* @param[in] pos decimal place
* @return a rounded float
*/
-inline float Round( float value, int32_t pos )
+inline float Round(float value, int32_t pos)
{
float temp;
- temp = value * powf( 10.f, static_cast<float>( pos ) );
- temp = floorf( temp + 0.5f );
- temp *= powf( 10.f, static_cast<float>( -pos ) );
+ temp = value * powf(10.f, static_cast<float>(pos));
+ temp = floorf(temp + 0.5f);
+ temp *= powf(10.f, static_cast<float>(-pos));
return temp;
}
return start;
}
-
/**
* @brief Find the shortest distance (magnitude) and direction (sign)
* from (a) to (b) in domain (start) to (end).
* (start) to (end).
*
*/
-inline float ShortestDistanceInDomain( float a, float b, float start, float end )
+inline float ShortestDistanceInDomain(float a, float b, float start, float end)
{
// (a-start + end-b)
- float size = end-start;
- float vect = b-a;
+ float size = end - start;
+ float vect = b - a;
if(vect > 0)
{
// +ve vector, let's try perspective 1 domain to the right,
// and see if closer.
- float aRight = a+size;
- if( aRight-b < vect )
+ float aRight = a + size;
+ if(aRight - b < vect)
{
- return b-aRight;
+ return b - aRight;
}
}
else
{
// -ve vector, let's try perspective 1 domain to the left,
// and see if closer.
- float aLeft = a-size;
- if( aLeft-b > vect )
+ float aLeft = a - size;
+ if(aLeft - b > vect)
{
- return b-aLeft;
+ return b - aLeft;
}
}
* @param[in] value The value we want to extract the sign
* @return -1 for negative values, +1 for positive values and 0 if value is 0
*/
-template <typename T>
-int32_t Sign( T value )
+template<typename T>
+int32_t Sign(T value)
{
- return ( T(0) < value ) - ( value < T(0) );
+ return (T(0) < value) - (value < T(0));
}
/**
#include <ostream>
// INTERNAL INCLUDES
+#include <dali/internal/render/common/performance-monitor.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/math-utils.h>
+#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/quaternion.h>
-#include <dali/public-api/math/math-utils.h>
-#include <dali/internal/render/common/performance-monitor.h>
namespace
{
const float ROTATION_EPSILON = 0.003f; // Deliberately large
-const uint32_t NUM_BYTES_IN_ROW_OF_3( 3 * sizeof( float ) );
-const uint32_t NUM_BYTES_IN_ROW( 4 * sizeof( float ) );
-const uint32_t NUM_BYTES_IN_MATRIX( 16 * sizeof( float ) );
-const uint32_t ROW1_OFFSET( 4 );
-const uint32_t ROW2_OFFSET( 8 );
-const uint32_t ROW3_OFFSET( 12 );
+const uint32_t NUM_BYTES_IN_ROW_OF_3(3 * sizeof(float));
+const uint32_t NUM_BYTES_IN_ROW(4 * sizeof(float));
+const uint32_t NUM_BYTES_IN_MATRIX(16 * sizeof(float));
+const uint32_t ROW1_OFFSET(4);
+const uint32_t ROW2_OFFSET(8);
+const uint32_t ROW3_OFFSET(12);
/**
* Helper to convert to Quaternion to float16 array
*/
-void Convert( float*& m, const Dali::Quaternion& rotation )
+void Convert(float*& m, const Dali::Quaternion& rotation)
{
const float xx = rotation.mVector.x * rotation.mVector.x;
const float yy = rotation.mVector.y * rotation.mVector.y;
const float wz = rotation.mVector.w * rotation.mVector.z;
const float yz = rotation.mVector.y * rotation.mVector.z;
+ // clang-format off
m[0] = 1.0f - 2.0f * (yy + zz);
m[1] = 2.0f * (xy + wz);
m[2] = 2.0f * (xz - wy);
m[13]= 0.0f;
m[14]= 0.0f;
m[15]= 1.0f;
+ // clang-format on
}
-}
+} // namespace
namespace Dali
{
-
using Internal::PerformanceMonitor;
-const float identityArray[] = {1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f};
+// clang-format off
+const float identityArray[] = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f};
+// clang-format on
const Matrix Matrix::IDENTITY(identityArray);
Matrix::Matrix()
{
- memset( mMatrix, 0, NUM_BYTES_IN_MATRIX );
+ memset(mMatrix, 0, NUM_BYTES_IN_MATRIX);
}
-Matrix::Matrix( bool initialize )
+Matrix::Matrix(bool initialize)
{
- if( initialize )
+ if(initialize)
{
- memset( mMatrix, 0, NUM_BYTES_IN_MATRIX );
+ memset(mMatrix, 0, NUM_BYTES_IN_MATRIX);
}
}
Matrix::Matrix(const float* array)
{
- memcpy( mMatrix, array, NUM_BYTES_IN_MATRIX );
+ memcpy(mMatrix, array, NUM_BYTES_IN_MATRIX);
}
-Matrix::Matrix( const Quaternion& rotation )
+Matrix::Matrix(const Quaternion& rotation)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,18);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 18);
float* matrixPtr = &mMatrix[0];
- Convert( matrixPtr, rotation );
+ Convert(matrixPtr, rotation);
}
-Matrix::Matrix( const Matrix& matrix )
+Matrix::Matrix(const Matrix& matrix)
{
- memcpy( mMatrix, matrix.mMatrix, NUM_BYTES_IN_MATRIX );
+ memcpy(mMatrix, matrix.mMatrix, NUM_BYTES_IN_MATRIX);
}
-Matrix& Matrix::operator=( const Matrix& matrix )
+Matrix& Matrix::operator=(const Matrix& matrix)
{
// no point copying if self assigning
- if( this != &matrix )
+ if(this != &matrix)
{
- memcpy( mMatrix, matrix.mMatrix, NUM_BYTES_IN_MATRIX );
+ memcpy(mMatrix, matrix.mMatrix, NUM_BYTES_IN_MATRIX);
}
return *this;
}
-Matrix::Matrix( Matrix&& matrix )
+Matrix::Matrix(Matrix&& matrix)
{
- memcpy( mMatrix, matrix.mMatrix, NUM_BYTES_IN_MATRIX );
+ memcpy(mMatrix, matrix.mMatrix, NUM_BYTES_IN_MATRIX);
}
-Matrix& Matrix::operator=( Matrix&& matrix )
+Matrix& Matrix::operator=(Matrix&& matrix)
{
- if( this != &matrix )
+ if(this != &matrix)
{
- memcpy( mMatrix, matrix.mMatrix, NUM_BYTES_IN_MATRIX );
+ memcpy(mMatrix, matrix.mMatrix, NUM_BYTES_IN_MATRIX);
}
return *this;
}
void Matrix::InvertTransform(Matrix& result) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,12);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 12);
float* m1 = result.AsFloat();
- DALI_ASSERT_ALWAYS( EqualsZero( mMatrix[3] ) && EqualsZero( mMatrix[7] ) && EqualsZero( mMatrix[11] ) && Equals( mMatrix[15], 1.0f ) && "Must be a transform matrix" );
+ DALI_ASSERT_ALWAYS(EqualsZero(mMatrix[3]) && EqualsZero(mMatrix[7]) && EqualsZero(mMatrix[11]) && Equals(mMatrix[15], 1.0f) && "Must be a transform matrix");
m1[0] = mMatrix[0];
m1[1] = mMatrix[4];
m1[6] = mMatrix[9];
m1[7] = 0.0f;
- m1[8] = mMatrix[2];
- m1[9] = mMatrix[6];
+ m1[8] = mMatrix[2];
+ m1[9] = mMatrix[6];
m1[10] = mMatrix[10];
m1[11] = 0.0f;
- m1[12] = -( ( mMatrix[0] * mMatrix[12] ) + ( mMatrix[1] * mMatrix[13] ) + ( mMatrix[2] * mMatrix[14] ) + ( mMatrix[3] * mMatrix[15] ) );
- m1[13] = -( ( mMatrix[4] * mMatrix[12] ) + ( mMatrix[5] * mMatrix[13] ) + ( mMatrix[6] * mMatrix[14] ) + ( mMatrix[7] * mMatrix[15] ) );
- m1[14] = -( ( mMatrix[8] * mMatrix[12] ) + ( mMatrix[9] * mMatrix[13] ) + ( mMatrix[10] * mMatrix[14] ) + ( mMatrix[11] * mMatrix[15] ) );
+ m1[12] = -((mMatrix[0] * mMatrix[12]) + (mMatrix[1] * mMatrix[13]) + (mMatrix[2] * mMatrix[14]) + (mMatrix[3] * mMatrix[15]));
+ m1[13] = -((mMatrix[4] * mMatrix[12]) + (mMatrix[5] * mMatrix[13]) + (mMatrix[6] * mMatrix[14]) + (mMatrix[7] * mMatrix[15]));
+ m1[14] = -((mMatrix[8] * mMatrix[12]) + (mMatrix[9] * mMatrix[13]) + (mMatrix[10] * mMatrix[14]) + (mMatrix[11] * mMatrix[15]));
m1[15] = 1.0f;
}
{
float inv[16];
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,192); // 12 x 16 multiples
-
- inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15] + m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10];
- inv[4] = -m[4]*m[10]*m[15] + m[4]*m[11]*m[14] + m[8]*m[6]*m[15] - m[8]*m[7]*m[14] - m[12]*m[6]*m[11] + m[12]*m[7]*m[10];
- inv[8] = m[4]*m[9]*m[15] - m[4]*m[11]*m[13] - m[8]*m[5]*m[15] + m[8]*m[7]*m[13] + m[12]*m[5]*m[11] - m[12]*m[7]*m[9];
- inv[12] = -m[4]*m[9]*m[14] + m[4]*m[10]*m[13] + m[8]*m[5]*m[14] - m[8]*m[6]*m[13] - m[12]*m[5]*m[10] + m[12]*m[6]*m[9];
- inv[1] = -m[1]*m[10]*m[15] + m[1]*m[11]*m[14] + m[9]*m[2]*m[15] - m[9]*m[3]*m[14] - m[13]*m[2]*m[11] + m[13]*m[3]*m[10];
- inv[5] = m[0]*m[10]*m[15] - m[0]*m[11]*m[14] - m[8]*m[2]*m[15] + m[8]*m[3]*m[14] + m[12]*m[2]*m[11] - m[12]*m[3]*m[10];
- inv[9] = -m[0]*m[9]*m[15] + m[0]*m[11]*m[13] + m[8]*m[1]*m[15] - m[8]*m[3]*m[13] - m[12]*m[1]*m[11] + m[12]*m[3]*m[9];
- inv[13] = m[0]*m[9]*m[14] - m[0]*m[10]*m[13] - m[8]*m[1]*m[14] + m[8]*m[2]*m[13] + m[12]*m[1]*m[10] - m[12]*m[2]*m[9];
- inv[2] = m[1]*m[6]*m[15] - m[1]*m[7]*m[14] - m[5]*m[2]*m[15] + m[5]*m[3]*m[14] + m[13]*m[2]*m[7] - m[13]*m[3]*m[6];
- inv[6] = -m[0]*m[6]*m[15] + m[0]*m[7]*m[14] + m[4]*m[2]*m[15] - m[4]*m[3]*m[14] - m[12]*m[2]*m[7] + m[12]*m[3]*m[6];
- inv[10] = m[0]*m[5]*m[15] - m[0]*m[7]*m[13] - m[4]*m[1]*m[15] + m[4]*m[3]*m[13] + m[12]*m[1]*m[7] - m[12]*m[3]*m[5];
- inv[14] = -m[0]*m[5]*m[14] + m[0]*m[6]*m[13] + m[4]*m[1]*m[14] - m[4]*m[2]*m[13] - m[12]*m[1]*m[6] + m[12]*m[2]*m[5];
- inv[3] = -m[1]*m[6]*m[11] + m[1]*m[7]*m[10] + m[5]*m[2]*m[11] - m[5]*m[3]*m[10] - m[9]*m[2]*m[7] + m[9]*m[3]*m[6];
- inv[7] = m[0]*m[6]*m[11] - m[0]*m[7]*m[10] - m[4]*m[2]*m[11] + m[4]*m[3]*m[10] + m[8]*m[2]*m[7] - m[8]*m[3]*m[6];
- inv[11] = -m[0]*m[5]*m[11] + m[0]*m[7]*m[9] + m[4]*m[1]*m[11] - m[4]*m[3]*m[9] - m[8]*m[1]*m[7] + m[8]*m[3]*m[5];
- inv[15] = m[0]*m[5]*m[10] - m[0]*m[6]*m[9] - m[4]*m[1]*m[10] + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5];
-
- float det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12];
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 192); // 12 x 16 multiples
+
+ inv[0] = m[5] * m[10] * m[15] - m[5] * m[11] * m[14] - m[9] * m[6] * m[15] + m[9] * m[7] * m[14] + m[13] * m[6] * m[11] - m[13] * m[7] * m[10];
+ inv[4] = -m[4] * m[10] * m[15] + m[4] * m[11] * m[14] + m[8] * m[6] * m[15] - m[8] * m[7] * m[14] - m[12] * m[6] * m[11] + m[12] * m[7] * m[10];
+ inv[8] = m[4] * m[9] * m[15] - m[4] * m[11] * m[13] - m[8] * m[5] * m[15] + m[8] * m[7] * m[13] + m[12] * m[5] * m[11] - m[12] * m[7] * m[9];
+ inv[12] = -m[4] * m[9] * m[14] + m[4] * m[10] * m[13] + m[8] * m[5] * m[14] - m[8] * m[6] * m[13] - m[12] * m[5] * m[10] + m[12] * m[6] * m[9];
+ inv[1] = -m[1] * m[10] * m[15] + m[1] * m[11] * m[14] + m[9] * m[2] * m[15] - m[9] * m[3] * m[14] - m[13] * m[2] * m[11] + m[13] * m[3] * m[10];
+ inv[5] = m[0] * m[10] * m[15] - m[0] * m[11] * m[14] - m[8] * m[2] * m[15] + m[8] * m[3] * m[14] + m[12] * m[2] * m[11] - m[12] * m[3] * m[10];
+ inv[9] = -m[0] * m[9] * m[15] + m[0] * m[11] * m[13] + m[8] * m[1] * m[15] - m[8] * m[3] * m[13] - m[12] * m[1] * m[11] + m[12] * m[3] * m[9];
+ inv[13] = m[0] * m[9] * m[14] - m[0] * m[10] * m[13] - m[8] * m[1] * m[14] + m[8] * m[2] * m[13] + m[12] * m[1] * m[10] - m[12] * m[2] * m[9];
+ inv[2] = m[1] * m[6] * m[15] - m[1] * m[7] * m[14] - m[5] * m[2] * m[15] + m[5] * m[3] * m[14] + m[13] * m[2] * m[7] - m[13] * m[3] * m[6];
+ inv[6] = -m[0] * m[6] * m[15] + m[0] * m[7] * m[14] + m[4] * m[2] * m[15] - m[4] * m[3] * m[14] - m[12] * m[2] * m[7] + m[12] * m[3] * m[6];
+ inv[10] = m[0] * m[5] * m[15] - m[0] * m[7] * m[13] - m[4] * m[1] * m[15] + m[4] * m[3] * m[13] + m[12] * m[1] * m[7] - m[12] * m[3] * m[5];
+ inv[14] = -m[0] * m[5] * m[14] + m[0] * m[6] * m[13] + m[4] * m[1] * m[14] - m[4] * m[2] * m[13] - m[12] * m[1] * m[6] + m[12] * m[2] * m[5];
+ inv[3] = -m[1] * m[6] * m[11] + m[1] * m[7] * m[10] + m[5] * m[2] * m[11] - m[5] * m[3] * m[10] - m[9] * m[2] * m[7] + m[9] * m[3] * m[6];
+ inv[7] = m[0] * m[6] * m[11] - m[0] * m[7] * m[10] - m[4] * m[2] * m[11] + m[4] * m[3] * m[10] + m[8] * m[2] * m[7] - m[8] * m[3] * m[6];
+ inv[11] = -m[0] * m[5] * m[11] + m[0] * m[7] * m[9] + m[4] * m[1] * m[11] - m[4] * m[3] * m[9] - m[8] * m[1] * m[7] + m[8] * m[3] * m[5];
+ inv[15] = m[0] * m[5] * m[10] - m[0] * m[6] * m[9] - m[4] * m[1] * m[10] + m[4] * m[2] * m[9] + m[8] * m[1] * m[6] - m[8] * m[2] * m[5];
+
+ float det = m[0] * inv[0] + m[1] * inv[4] + m[2] * inv[8] + m[3] * inv[12];
// In the case where the determinant is exactly zero, the matrix is non-invertible
- if ( EqualsZero( det ) )
+ if(EqualsZero(det))
{
return false;
}
det = 1.0f / det;
- for( int32_t i = 0; i < 16; i++)
+ for(int32_t i = 0; i < 16; i++)
{
out[i] = inv[i] * det;
}
mMatrix[1] = mMatrix[4];
mMatrix[4] = temp;
- temp = mMatrix[2];
+ temp = mMatrix[2];
mMatrix[2] = mMatrix[8];
mMatrix[8] = temp;
- temp = mMatrix[3];
- mMatrix[3] = mMatrix[12];
+ temp = mMatrix[3];
+ mMatrix[3] = mMatrix[12];
mMatrix[12] = temp;
- temp = mMatrix[6];
+ temp = mMatrix[6];
mMatrix[6] = mMatrix[9];
mMatrix[9] = temp;
- temp = mMatrix[7];
- mMatrix[7] = mMatrix[13];
+ temp = mMatrix[7];
+ mMatrix[7] = mMatrix[13];
mMatrix[13] = temp;
- temp = mMatrix[11];
+ temp = mMatrix[11];
mMatrix[11] = mMatrix[14];
mMatrix[14] = temp;
}
void Matrix::SetIdentity()
{
- memcpy( mMatrix, identityArray, NUM_BYTES_IN_MATRIX );
+ memcpy(mMatrix, identityArray, NUM_BYTES_IN_MATRIX);
}
-void Matrix::SetIdentityAndScale( const Vector3& scale )
+void Matrix::SetIdentityAndScale(const Vector3& scale)
{
// initialize to zeros
- memset( mMatrix, 0, NUM_BYTES_IN_MATRIX );
+ memset(mMatrix, 0, NUM_BYTES_IN_MATRIX);
// just apply scale on the diagonal
mMatrix[0] = scale.x;
void Matrix::SetTranslation(const Vector4& translation)
{
- memcpy( mMatrix + ROW3_OFFSET, &translation, NUM_BYTES_IN_ROW );
+ memcpy(mMatrix + ROW3_OFFSET, &translation, NUM_BYTES_IN_ROW);
}
void Matrix::SetTranslation(const Vector3& other)
{
- memcpy( mMatrix + ROW3_OFFSET, &other, NUM_BYTES_IN_ROW_OF_3 );
+ memcpy(mMatrix + ROW3_OFFSET, &other, NUM_BYTES_IN_ROW_OF_3);
mMatrix[15] = 1.0f;
}
-void Matrix::Multiply( Matrix& result, const Matrix& lhs, const Matrix& rhs )
+void Matrix::Multiply(Matrix& result, const Matrix& lhs, const Matrix& rhs)
{
MATH_INCREASE_COUNTER(PerformanceMonitor::MATRIX_MULTIPLYS);
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,64); // 64 = 16*4
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 64); // 64 = 16*4
- float* temp = result.AsFloat();
- const float* rhsPtr = rhs.AsFloat();
+ float* temp = result.AsFloat();
+ const float* rhsPtr = rhs.AsFloat();
const float* lhsPtr = lhs.AsFloat();
-#ifndef __ARM_NEON__
+#ifndef __ARM_NEON__
- for( int32_t i=0; i < 4; i++ )
+ for(int32_t i = 0; i < 4; i++)
{
// i<<2 gives the first vector / column
- int32_t loc = i<<2;
- int32_t loc1 = loc + 1;
- int32_t loc2 = loc + 2;
- int32_t loc3 = loc + 3;
- float value0 = lhsPtr[loc];
- float value1 = lhsPtr[loc1];
- float value2 = lhsPtr[loc2];
- float value3 = lhsPtr[loc3];
- temp[loc] = (value0 * rhsPtr[0]) +
- (value1 * rhsPtr[4]) +
- (value2 * rhsPtr[8]) +
- (value3 * rhsPtr[12]);
+ int32_t loc = i << 2;
+ int32_t loc1 = loc + 1;
+ int32_t loc2 = loc + 2;
+ int32_t loc3 = loc + 3;
+ float value0 = lhsPtr[loc];
+ float value1 = lhsPtr[loc1];
+ float value2 = lhsPtr[loc2];
+ float value3 = lhsPtr[loc3];
+
+ temp[loc] = (value0 * rhsPtr[0]) +
+ (value1 * rhsPtr[4]) +
+ (value2 * rhsPtr[8]) +
+ (value3 * rhsPtr[12]);
temp[loc1] = (value0 * rhsPtr[1]) +
(value1 * rhsPtr[5]) +
temp[loc2] = (value0 * rhsPtr[2]) +
(value1 * rhsPtr[6]) +
- (value2 * rhsPtr[10])+
+ (value2 * rhsPtr[10]) +
(value3 * rhsPtr[14]);
temp[loc3] = (value0 * rhsPtr[3]) +
(value1 * rhsPtr[7]) +
- (value2 * rhsPtr[11])+
+ (value2 * rhsPtr[11]) +
(value3 * rhsPtr[15]);
}
// e.g. q0 = d0 and d1
// load and stores interleaved as NEON can load and store while calculating
- asm volatile ( "VLDM %1, {q0-q3} \n\t" // load matrix 1 (lhsPtr) q[0..q3]
- "VLDM %0, {q8-q11} \n\t" // load matrix 2 (rhsPtr) q[q8-q11]
- "VMUL.F32 q12, q8, d0[0] \n\t" // column 0 = rhsPtr[0..3] * lhsPtr[0..3]
- "VMUL.F32 q13, q8, d2[0] \n\t" // column 1 = rhsPtr[0..3] * lhsPtr[4..7]
- "VMUL.F32 q14, q8, d4[0] \n\t" // column 2 = rhsPtr[0..3] * lhsPtr[8..11]
- "VMUL.F32 q15, q8, d6[0] \n\t" // column 3 = rhsPtr[0..3] * lhsPtr[12..15]
-
- "VMLA.F32 q12, q9, d0[1] \n\t" // column 0 += rhsPtr[4..7] * lhsPtr[0..3]
- "VMLA.F32 q13, q9, d2[1] \n\t" // column 1 += rhsPtr[4..7] * lhsPtr[4..7]
- "VMLA.F32 q14, q9, d4[1] \n\t" // column 2 += rhsPtr[4..7] * lhsPtr[8..11]
- "VMLA.F32 q15, q9, d6[1] \n\t" // column 3 += rhsPtr[4..7] * lhsPtr[12..15]
-
- "VMLA.F32 q12, q10, d1[0] \n\t" // column 0 += rhsPtr[8..11] * lhsPtr[0..3]
- "VMLA.F32 q13, q10, d3[0] \n\t" // column 1 += rhsPtr[8..11] * lhsPtr[4..7]
- "VMLA.F32 q14, q10, d5[0] \n\t" // column 2 += rhsPtr[8..11] * lhsPtr[8..11]
- "VMLA.F32 q15, q10, d7[0] \n\t" // column 3 += rhsPtr[8..11] * lhsPtr[12..15]
-
- "VMLA.F32 q12, q11, d1[1] \n\t" // column 0 += rhsPtr[12..15] * lhsPtr[0..3]
- "VMLA.F32 q13, q11, d3[1] \n\t" // column 1 += rhsPtr[12..15] * lhsPtr[4..7]
- "VMLA.F32 q14, q11, d5[1] \n\t" // column 2 += rhsPtr[12..15] * lhsPtr[8..11]
- "VMLA.F32 q15, q11, d7[1] \n\t" // column 3 += rhsPtr[12..15] * lhsPtr[12..15]
- "VSTM %2, {q12-q15} \n\t" // store entire output matrix.
- : "+r"(rhsPtr), "+r"(lhsPtr), "+r"(temp)
- :
- : "q0", "q1", "q2", "q3", "q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15", "memory" );
+ asm volatile(
+ "VLDM %1, {q0-q3} \n\t" // load matrix 1 (lhsPtr) q[0..q3]
+ "VLDM %0, {q8-q11} \n\t" // load matrix 2 (rhsPtr) q[q8-q11]
+ "VMUL.F32 q12, q8, d0[0] \n\t" // column 0 = rhsPtr[0..3] * lhsPtr[0..3]
+ "VMUL.F32 q13, q8, d2[0] \n\t" // column 1 = rhsPtr[0..3] * lhsPtr[4..7]
+ "VMUL.F32 q14, q8, d4[0] \n\t" // column 2 = rhsPtr[0..3] * lhsPtr[8..11]
+ "VMUL.F32 q15, q8, d6[0] \n\t" // column 3 = rhsPtr[0..3] * lhsPtr[12..15]
+
+ "VMLA.F32 q12, q9, d0[1] \n\t" // column 0 += rhsPtr[4..7] * lhsPtr[0..3]
+ "VMLA.F32 q13, q9, d2[1] \n\t" // column 1 += rhsPtr[4..7] * lhsPtr[4..7]
+ "VMLA.F32 q14, q9, d4[1] \n\t" // column 2 += rhsPtr[4..7] * lhsPtr[8..11]
+ "VMLA.F32 q15, q9, d6[1] \n\t" // column 3 += rhsPtr[4..7] * lhsPtr[12..15]
+
+ "VMLA.F32 q12, q10, d1[0] \n\t" // column 0 += rhsPtr[8..11] * lhsPtr[0..3]
+ "VMLA.F32 q13, q10, d3[0] \n\t" // column 1 += rhsPtr[8..11] * lhsPtr[4..7]
+ "VMLA.F32 q14, q10, d5[0] \n\t" // column 2 += rhsPtr[8..11] * lhsPtr[8..11]
+ "VMLA.F32 q15, q10, d7[0] \n\t" // column 3 += rhsPtr[8..11] * lhsPtr[12..15]
+
+ "VMLA.F32 q12, q11, d1[1] \n\t" // column 0 += rhsPtr[12..15] * lhsPtr[0..3]
+ "VMLA.F32 q13, q11, d3[1] \n\t" // column 1 += rhsPtr[12..15] * lhsPtr[4..7]
+ "VMLA.F32 q14, q11, d5[1] \n\t" // column 2 += rhsPtr[12..15] * lhsPtr[8..11]
+ "VMLA.F32 q15, q11, d7[1] \n\t" // column 3 += rhsPtr[12..15] * lhsPtr[12..15]
+ "VSTM %2, {q12-q15} \n\t" // store entire output matrix.
+ : "+r"(rhsPtr), "+r"(lhsPtr), "+r"(temp)
+ :
+ : "q0", "q1", "q2", "q3", "q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15", "memory");
#endif
}
-void Matrix::Multiply( Matrix& result, const Matrix& lhs, const Quaternion& rhs )
+void Matrix::Multiply(Matrix& result, const Matrix& lhs, const Quaternion& rhs)
{
MATH_INCREASE_COUNTER(PerformanceMonitor::MATRIX_MULTIPLYS);
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,54); // 54 = 36+18
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 54); // 54 = 36+18
- float matrix[16];
+ float matrix[16];
float* rhsPtr = &matrix[0];
- Convert( rhsPtr, rhs );
+ Convert(rhsPtr, rhs);
// quaternion contains just rotation so it really only needs 3x3 matrix
- float* temp = result.AsFloat();
+ float* temp = result.AsFloat();
const float* lhsPtr = lhs.AsFloat();
-#ifndef __ARM_NEON__
+#ifndef __ARM_NEON__
- for( int32_t i=0; i < 4; i++ )
+ for(int32_t i = 0; i < 4; i++)
{
// i<<2 gives the first vector / column
- int32_t loc = i<<2;
- int32_t loc1 = loc + 1;
- int32_t loc2 = loc + 2;
- int32_t loc3 = loc + 3;
- float value0 = lhsPtr[loc];
- float value1 = lhsPtr[loc1];
- float value2 = lhsPtr[loc2];
- float value3 = lhsPtr[loc3];
- temp[loc] = (value0 * rhsPtr[0]) +
- (value1 * rhsPtr[4]) +
- (value2 * rhsPtr[8]) +
- (0.0f); //value3 * rhsPtr[12] is 0.0f
+ int32_t loc = i << 2;
+ int32_t loc1 = loc + 1;
+ int32_t loc2 = loc + 2;
+ int32_t loc3 = loc + 3;
+ float value0 = lhsPtr[loc];
+ float value1 = lhsPtr[loc1];
+ float value2 = lhsPtr[loc2];
+ float value3 = lhsPtr[loc3];
+
+ temp[loc] = (value0 * rhsPtr[0]) +
+ (value1 * rhsPtr[4]) +
+ (value2 * rhsPtr[8]) +
+ (0.0f); //value3 * rhsPtr[12] is 0.0f
temp[loc1] = (value0 * rhsPtr[1]) +
(value1 * rhsPtr[5]) +
temp[loc2] = (value0 * rhsPtr[2]) +
(value1 * rhsPtr[6]) +
- (value2 * rhsPtr[10])+
+ (value2 * rhsPtr[10]) +
(0.0f); //value3 * rhsPtr[14] is 0.0f
- temp[loc3] = (0.0f) + //value0 * rhsPtr[3] is 0.0f
- (0.0f) + //value1 * rhsPtr[7] is 0.0f
- (0.0f) + //value2 * rhsPtr[11] is 0.0f
+ temp[loc3] = (0.0f) + //value0 * rhsPtr[3] is 0.0f
+ (0.0f) + //value1 * rhsPtr[7] is 0.0f
+ (0.0f) + //value2 * rhsPtr[11] is 0.0f
(value3); // rhsPtr[15] is 1.0f
}
// q =128 bit quad-word q0 -q15 (enough to handle a column of 4 floats in a matrix)
// e.g. q0 = d0 and d1
// load and stores interleaved as NEON can load and store while calculating
- asm volatile ( "VLDM %1, {q4-q6} \n\t" // load matrix 1 (lhsPtr)
- "VLD1.F32 {q7}, [%2]! \n\t" // load matrix 2 (rhsPtr) [0..3]
- "VMUL.F32 q0, q7, d8[0] \n\t" // column 0 = rhsPtr[0..3] * lhsPtr[0..3]
- "VMUL.F32 q1, q7, d10[0] \n\t" // column 1 = rhsPtr[0..3] * lhsPtr[4..7]
- "VMUL.F32 q2, q7, d12[0] \n\t" // column 2 = rhsPtr[0..3] * lhsPtr[8..11]
- "VLD1.F32 {q7}, [%2]! \n\t" // load matrix 2 (rhsPtr) [4..7]
- "VMLA.F32 q0, q7, d8[1] \n\t" // column 0+= rhsPtr[4..7] * lhsPtr[0..3]
- "VMLA.F32 q1, q7, d10[1] \n\t" // column 1+= rhsPtr[4..7] * lhsPtr[4..7]
- "VMLA.F32 q2, q7, d12[1] \n\t" // column 2+= rhsPtr[4..7] * lhsPtr[8..11]
- "VLD1.F32 {q7}, [%2]! \n\t" // load matrix 2 (rhsPtr) [8..11]
- "VMLA.F32 q0, q7, d9[0] \n\t" // column 0+= rhsPtr[8..11] * lhsPtr[0..3]
- "VMLA.F32 q1, q7, d11[0] \n\t" // column 1+= rhsPtr[8..11] * lhsPtr[4..7]
- "VMLA.F32 q2, q7, d13[0] \n\t" // column 2+= rhsPtr[8..11] * lhsPtr[8..11]
- "VSTM %0, {q0-q2} \n\t" // store entire output matrix.
- :
- : "r"(temp), "r"(lhsPtr), "r" (rhsPtr)
- : "%r0", "%q0", "%q1", "%q2", "%q4", "%q5", "%q6", "%q7", "memory" );
-
- temp[ 12 ] = 0.0f;
- temp[ 13 ] = 0.0f;
- temp[ 14 ] = 0.0f;
- temp[ 15 ] = 1.0f;
+ asm volatile(
+ "VLDM %1, {q4-q6} \n\t" // load matrix 1 (lhsPtr)
+ "VLD1.F32 {q7}, [%2]! \n\t" // load matrix 2 (rhsPtr) [0..3]
+ "VMUL.F32 q0, q7, d8[0] \n\t" // column 0 = rhsPtr[0..3] * lhsPtr[0..3]
+ "VMUL.F32 q1, q7, d10[0] \n\t" // column 1 = rhsPtr[0..3] * lhsPtr[4..7]
+ "VMUL.F32 q2, q7, d12[0] \n\t" // column 2 = rhsPtr[0..3] * lhsPtr[8..11]
+ "VLD1.F32 {q7}, [%2]! \n\t" // load matrix 2 (rhsPtr) [4..7]
+ "VMLA.F32 q0, q7, d8[1] \n\t" // column 0+= rhsPtr[4..7] * lhsPtr[0..3]
+ "VMLA.F32 q1, q7, d10[1] \n\t" // column 1+= rhsPtr[4..7] * lhsPtr[4..7]
+ "VMLA.F32 q2, q7, d12[1] \n\t" // column 2+= rhsPtr[4..7] * lhsPtr[8..11]
+ "VLD1.F32 {q7}, [%2]! \n\t" // load matrix 2 (rhsPtr) [8..11]
+ "VMLA.F32 q0, q7, d9[0] \n\t" // column 0+= rhsPtr[8..11] * lhsPtr[0..3]
+ "VMLA.F32 q1, q7, d11[0] \n\t" // column 1+= rhsPtr[8..11] * lhsPtr[4..7]
+ "VMLA.F32 q2, q7, d13[0] \n\t" // column 2+= rhsPtr[8..11] * lhsPtr[8..11]
+ "VSTM %0, {q0-q2} \n\t" // store entire output matrix.
+ :
+ : "r"(temp), "r"(lhsPtr), "r"(rhsPtr)
+ : "%r0", "%q0", "%q1", "%q2", "%q4", "%q5", "%q6", "%q7", "memory");
+
+ temp[12] = 0.0f;
+ temp[13] = 0.0f;
+ temp[14] = 0.0f;
+ temp[15] = 1.0f;
#endif
}
Vector4 Matrix::operator*(const Vector4& rhs) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,16);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 16);
Vector4 temp;
-#ifndef __ARM_NEON__
+#ifndef __ARM_NEON__
- temp.x = rhs.x * mMatrix[0] + rhs.y * mMatrix[4] + rhs.z * mMatrix[8] + rhs.w * mMatrix[12];
- temp.y = rhs.x * mMatrix[1] + rhs.y * mMatrix[5] + rhs.z * mMatrix[9] + rhs.w * mMatrix[13];
- temp.z = rhs.x * mMatrix[2] + rhs.y * mMatrix[6] + rhs.z * mMatrix[10] + rhs.w * mMatrix[14];
- temp.w = rhs.x * mMatrix[3] + rhs.y * mMatrix[7] + rhs.z * mMatrix[11] + rhs.w * mMatrix[15];
+ temp.x = rhs.x * mMatrix[0] + rhs.y * mMatrix[4] + rhs.z * mMatrix[8] + rhs.w * mMatrix[12];
+ temp.y = rhs.x * mMatrix[1] + rhs.y * mMatrix[5] + rhs.z * mMatrix[9] + rhs.w * mMatrix[13];
+ temp.z = rhs.x * mMatrix[2] + rhs.y * mMatrix[6] + rhs.z * mMatrix[10] + rhs.w * mMatrix[14];
+ temp.w = rhs.x * mMatrix[3] + rhs.y * mMatrix[7] + rhs.z * mMatrix[11] + rhs.w * mMatrix[15];
#else
// q =128 bit quad-word q0 -q15 (enough to handle a column of 4 floats in a matrix)
// e.g. q0 = d0 and d1
// load and stores interleaved as NEON can load and store while calculating
- asm volatile ( "VLD1.F32 {q0}, [%1] \n\t" //q0 = rhs
- "VLD1.F32 {q9}, [%0]! \n\t"
- "VMUL.F32 q10, q9, d0[0] \n\t"
- "VLD1.F32 {q9}, [%0]! \n\t"
- "VMLA.F32 q10, q9, d0[1] \n\t" //q10 = mMatrix[0..3] * rhs + mMatrix[4..7] * rhs
- "VLD1.F32 {q9}, [%0]! \n\t"
- "VMUL.F32 q11, q9, d1[0] \n\t"
- "VLD1.F32 {q9}, [%0]! \n\t"
- "VMLA.F32 q11, q9, d1[1] \n\t" //q11 = mMatrix[8..11] * rhs + mMatrix[12..15] * rhs
- "VADD.F32 q10, q10, q11 \n\t"
- "VST1.F32 {q10},[%2] \n\t" //temp = q10 + q11
- :
- : "r"(mMatrix), "r"(&rhs), "r"(&temp)
- : "q0", "q9", "q10", "q11", "memory" );
+ asm volatile(
+ "VLD1.F32 {q0}, [%1] \n\t" //q0 = rhs
+ "VLD1.F32 {q9}, [%0]! \n\t"
+ "VMUL.F32 q10, q9, d0[0] \n\t"
+ "VLD1.F32 {q9}, [%0]! \n\t"
+ "VMLA.F32 q10, q9, d0[1] \n\t" //q10 = mMatrix[0..3] * rhs + mMatrix[4..7] * rhs
+ "VLD1.F32 {q9}, [%0]! \n\t"
+ "VMUL.F32 q11, q9, d1[0] \n\t"
+ "VLD1.F32 {q9}, [%0]! \n\t"
+ "VMLA.F32 q11, q9, d1[1] \n\t" //q11 = mMatrix[8..11] * rhs + mMatrix[12..15] * rhs
+ "VADD.F32 q10, q10, q11 \n\t"
+ "VST1.F32 {q10},[%2] \n\t" //temp = q10 + q11
+ :
+ : "r"(mMatrix), "r"(&rhs), "r"(&temp)
+ : "q0", "q9", "q10", "q11", "memory");
#endif
return temp;
}
bool Matrix::operator==(const Matrix& rhs) const
{
return (
- ( fabsf( mMatrix[0] - rhs.mMatrix[0] ) <= GetRangedEpsilon( mMatrix[0], rhs.mMatrix[0] ) ) &&
- ( fabsf( mMatrix[1] - rhs.mMatrix[1] ) <= GetRangedEpsilon( mMatrix[1], rhs.mMatrix[1] ) ) &&
- ( fabsf( mMatrix[2] - rhs.mMatrix[2] ) <= GetRangedEpsilon( mMatrix[2], rhs.mMatrix[2] ) ) &&
- ( fabsf( mMatrix[3] - rhs.mMatrix[3] ) <= GetRangedEpsilon( mMatrix[3], rhs.mMatrix[3] ) ) &&
- ( fabsf( mMatrix[4] - rhs.mMatrix[4] ) <= GetRangedEpsilon( mMatrix[4], rhs.mMatrix[4] ) ) &&
- ( fabsf( mMatrix[5] - rhs.mMatrix[5] ) <= GetRangedEpsilon( mMatrix[5], rhs.mMatrix[5] ) ) &&
- ( fabsf( mMatrix[6] - rhs.mMatrix[6] ) <= GetRangedEpsilon( mMatrix[6], rhs.mMatrix[6] ) ) &&
- ( fabsf( mMatrix[7] - rhs.mMatrix[7] ) <= GetRangedEpsilon( mMatrix[7], rhs.mMatrix[7] ) ) &&
- ( fabsf( mMatrix[8] - rhs.mMatrix[8] ) <= GetRangedEpsilon( mMatrix[8], rhs.mMatrix[8] ) ) &&
- ( fabsf( mMatrix[9] - rhs.mMatrix[9] ) <= GetRangedEpsilon( mMatrix[9], rhs.mMatrix[9] ) ) &&
- ( fabsf( mMatrix[10] - rhs.mMatrix[10] ) <= GetRangedEpsilon( mMatrix[10], rhs.mMatrix[10] ) ) &&
- ( fabsf( mMatrix[11] - rhs.mMatrix[11] ) <= GetRangedEpsilon( mMatrix[11], rhs.mMatrix[11] ) ) &&
- ( fabsf( mMatrix[12] - rhs.mMatrix[12] ) <= GetRangedEpsilon( mMatrix[12], rhs.mMatrix[12] ) ) &&
- ( fabsf( mMatrix[13] - rhs.mMatrix[13] ) <= GetRangedEpsilon( mMatrix[13], rhs.mMatrix[13] ) ) &&
- ( fabsf( mMatrix[14] - rhs.mMatrix[14] ) <= GetRangedEpsilon( mMatrix[14], rhs.mMatrix[14] ) ) &&
- ( fabsf( mMatrix[15] - rhs.mMatrix[15] ) <= GetRangedEpsilon( mMatrix[15], rhs.mMatrix[15] ) ) );
+ (fabsf(mMatrix[0] - rhs.mMatrix[0]) <= GetRangedEpsilon(mMatrix[0], rhs.mMatrix[0])) &&
+ (fabsf(mMatrix[1] - rhs.mMatrix[1]) <= GetRangedEpsilon(mMatrix[1], rhs.mMatrix[1])) &&
+ (fabsf(mMatrix[2] - rhs.mMatrix[2]) <= GetRangedEpsilon(mMatrix[2], rhs.mMatrix[2])) &&
+ (fabsf(mMatrix[3] - rhs.mMatrix[3]) <= GetRangedEpsilon(mMatrix[3], rhs.mMatrix[3])) &&
+ (fabsf(mMatrix[4] - rhs.mMatrix[4]) <= GetRangedEpsilon(mMatrix[4], rhs.mMatrix[4])) &&
+ (fabsf(mMatrix[5] - rhs.mMatrix[5]) <= GetRangedEpsilon(mMatrix[5], rhs.mMatrix[5])) &&
+ (fabsf(mMatrix[6] - rhs.mMatrix[6]) <= GetRangedEpsilon(mMatrix[6], rhs.mMatrix[6])) &&
+ (fabsf(mMatrix[7] - rhs.mMatrix[7]) <= GetRangedEpsilon(mMatrix[7], rhs.mMatrix[7])) &&
+ (fabsf(mMatrix[8] - rhs.mMatrix[8]) <= GetRangedEpsilon(mMatrix[8], rhs.mMatrix[8])) &&
+ (fabsf(mMatrix[9] - rhs.mMatrix[9]) <= GetRangedEpsilon(mMatrix[9], rhs.mMatrix[9])) &&
+ (fabsf(mMatrix[10] - rhs.mMatrix[10]) <= GetRangedEpsilon(mMatrix[10], rhs.mMatrix[10])) &&
+ (fabsf(mMatrix[11] - rhs.mMatrix[11]) <= GetRangedEpsilon(mMatrix[11], rhs.mMatrix[11])) &&
+ (fabsf(mMatrix[12] - rhs.mMatrix[12]) <= GetRangedEpsilon(mMatrix[12], rhs.mMatrix[12])) &&
+ (fabsf(mMatrix[13] - rhs.mMatrix[13]) <= GetRangedEpsilon(mMatrix[13], rhs.mMatrix[13])) &&
+ (fabsf(mMatrix[14] - rhs.mMatrix[14]) <= GetRangedEpsilon(mMatrix[14], rhs.mMatrix[14])) &&
+ (fabsf(mMatrix[15] - rhs.mMatrix[15]) <= GetRangedEpsilon(mMatrix[15], rhs.mMatrix[15])));
}
bool Matrix::operator!=(const Matrix& rhs) const
{
- if (*this == rhs)
+ if(*this == rhs)
{
return false;
}
vector0.Normalize();
vector1.Normalize();
- vector2 = vector0.Cross( vector1 );
- vector1 = vector2.Cross( vector0 );
+ vector2 = vector0.Cross(vector1);
+ vector1 = vector2.Cross(vector0);
- memcpy( mMatrix, &vector0, NUM_BYTES_IN_ROW );
- memcpy( mMatrix + ROW1_OFFSET, &vector1, NUM_BYTES_IN_ROW );
- memcpy( mMatrix + ROW2_OFFSET, &vector2, NUM_BYTES_IN_ROW );
+ memcpy(mMatrix, &vector0, NUM_BYTES_IN_ROW);
+ memcpy(mMatrix + ROW1_OFFSET, &vector1, NUM_BYTES_IN_ROW);
+ memcpy(mMatrix + ROW2_OFFSET, &vector2, NUM_BYTES_IN_ROW);
}
Vector3 Matrix::GetXAxis() const
void Matrix::SetZAxis(const Vector3& axis)
{
- mMatrix[8] = axis.x;
- mMatrix[9] = axis.y;
+ mMatrix[8] = axis.x;
+ mMatrix[9] = axis.y;
mMatrix[10] = axis.z;
}
void Matrix::SetTransformComponents(const Vector3& scale,
const Quaternion& rotation,
- const Vector3& translation )
+ const Vector3& translation)
{
- if( rotation.IsIdentity() )
+ if(rotation.IsIdentity())
{
mMatrix[0] = scale.x;
mMatrix[1] = 0.0f;
mMatrix[6] = 0.0f;
mMatrix[7] = 0.0f;
- mMatrix[8] = 0.0f;
- mMatrix[9] = 0.0f;
- mMatrix[10]= scale.z;
- mMatrix[11]= 0.0f;
+ mMatrix[8] = 0.0f;
+ mMatrix[9] = 0.0f;
+ mMatrix[10] = scale.z;
+ mMatrix[11] = 0.0f;
}
else
{
MATH_INCREASE_COUNTER(PerformanceMonitor::MATRIX_MULTIPLYS);
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,27); // 27 = 9+18
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 27); // 27 = 9+18
const float xx = rotation.mVector.x * rotation.mVector.x;
const float yy = rotation.mVector.y * rotation.mVector.y;
const float yz = rotation.mVector.y * rotation.mVector.z;
mMatrix[0] = (scale.x * (1.0f - 2.0f * (yy + zz)));
- mMatrix[1] = (scale.x * ( 2.0f * (xy + wz)));
- mMatrix[2] = (scale.x * ( 2.0f * (xz - wy)));
+ mMatrix[1] = (scale.x * (2.0f * (xy + wz)));
+ mMatrix[2] = (scale.x * (2.0f * (xz - wy)));
mMatrix[3] = 0.0f;
- mMatrix[4] = (scale.y * ( 2.0f * (xy - wz)));
+ mMatrix[4] = (scale.y * (2.0f * (xy - wz)));
mMatrix[5] = (scale.y * (1.0f - 2.0f * (xx + zz)));
- mMatrix[6] = (scale.y * ( 2.0f * (yz + wx)));
+ mMatrix[6] = (scale.y * (2.0f * (yz + wx)));
mMatrix[7] = 0.0f;
- mMatrix[8] = (scale.z * ( 2.0f * (xz + wy)));
- mMatrix[9] = (scale.z * ( 2.0f * (yz - wx)));
- mMatrix[10]= (scale.z * (1.0f - 2.0f * (xx + yy)));
- mMatrix[11]= 0.0f;
+ mMatrix[8] = (scale.z * (2.0f * (xz + wy)));
+ mMatrix[9] = (scale.z * (2.0f * (yz - wx)));
+ mMatrix[10] = (scale.z * (1.0f - 2.0f * (xx + yy)));
+ mMatrix[11] = 0.0f;
}
// apply translation
mMatrix[12] = translation.x;
void Matrix::SetInverseTransformComponents(const Vector3& scale,
const Quaternion& rotation,
- const Vector3& translation )
+ const Vector3& translation)
{
- Vector3 inverseTranslation = -translation;
- Vector3 inverseScale( 1.0f/scale.x, 1.0f/scale.y, 1.0f/scale.z);
+ Vector3 inverseTranslation = -translation;
+ Vector3 inverseScale(1.0f / scale.x, 1.0f / scale.y, 1.0f / scale.z);
Quaternion inverseRotation(rotation);
- bool isRotated = ! inverseRotation.IsIdentity();
+ bool isRotated = !inverseRotation.IsIdentity();
// Order of application is translation, rotation, scale.
// Ensure translation is relative to scale & rotation:
- if( isRotated )
+ if(isRotated)
{
inverseRotation.Invert();
inverseTranslation = inverseRotation.Rotate(inverseTranslation);
inverseTranslation *= inverseScale;
- if( isRotated )
+ if(isRotated)
{
MATH_INCREASE_COUNTER(PerformanceMonitor::MATRIX_MULTIPLYS);
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,27); // 27 = 9+18
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 27); // 27 = 9+18
const float xx = inverseRotation.mVector.x * inverseRotation.mVector.x;
const float yy = inverseRotation.mVector.y * inverseRotation.mVector.y;
mMatrix[6] = (inverseScale.z * (2.0f * (yz + wx)));
mMatrix[7] = 0.0f;
- mMatrix[8] = (inverseScale.x * (2.0f * (xz + wy)));
- mMatrix[9] = (inverseScale.y * (2.0f * (yz - wx)));
- mMatrix[10]= (inverseScale.z * (1.0f - 2.0f * (xx + yy)));
- mMatrix[11]= 0.0f;
+ mMatrix[8] = (inverseScale.x * (2.0f * (xz + wy)));
+ mMatrix[9] = (inverseScale.y * (2.0f * (yz - wx)));
+ mMatrix[10] = (inverseScale.z * (1.0f - 2.0f * (xx + yy)));
+ mMatrix[11] = 0.0f;
}
else
{
mMatrix[6] = 0.0f;
mMatrix[7] = 0.0f;
- mMatrix[8] = 0.0f;
- mMatrix[9] = 0.0f;
- mMatrix[10]= inverseScale.z;
- mMatrix[11]= 0.0f;
+ mMatrix[8] = 0.0f;
+ mMatrix[9] = 0.0f;
+ mMatrix[10] = inverseScale.z;
+ mMatrix[11] = 0.0f;
}
// apply translation
mMatrix[15] = 1.0f;
}
-void Matrix::SetInverseTransformComponents(const Vector3& xAxis,
- const Vector3& yAxis,
- const Vector3& zAxis,
- const Vector3& translation )
+void Matrix::SetInverseTransformComponents(const Vector3& xAxis,
+ const Vector3& yAxis,
+ const Vector3& zAxis,
+ const Vector3& translation)
{
// x, y, z axis parameters represent a orthonormal basis with no scaling, i.e. a rotation matrix.
// Invert rotation by transposing in place
// Order of application is translation, rotation
- mMatrix[0] = xAxis.x;
- mMatrix[1] = yAxis.x;
- mMatrix[2] = zAxis.x;
- mMatrix[3] = 0.0f;
+ mMatrix[0] = xAxis.x;
+ mMatrix[1] = yAxis.x;
+ mMatrix[2] = zAxis.x;
+ mMatrix[3] = 0.0f;
- mMatrix[4] = xAxis.y;
- mMatrix[5] = yAxis.y;
- mMatrix[6] = zAxis.y;
- mMatrix[7] = 0.0f;
+ mMatrix[4] = xAxis.y;
+ mMatrix[5] = yAxis.y;
+ mMatrix[6] = zAxis.y;
+ mMatrix[7] = 0.0f;
mMatrix[8] = xAxis.z;
mMatrix[9] = yAxis.z;
// Ensure translation is relative to scale & rotation:
- Vector4 inverseTranslation( -translation.x, -translation.y, -translation.z, 1.0f);
- inverseTranslation = *this * inverseTranslation; // Rotate inverse translation
+ Vector4 inverseTranslation(-translation.x, -translation.y, -translation.z, 1.0f);
+ inverseTranslation = *this * inverseTranslation; // Rotate inverse translation
inverseTranslation.w = 1.0f;
SetTranslation(inverseTranslation);
}
-
-void Matrix::GetTransformComponents(Vector3& position,
- Quaternion& rotation,
- Vector3& scale) const
+void Matrix::GetTransformComponents(Vector3& position,
+ Quaternion& rotation,
+ Vector3& scale) const
{
position = GetTranslation3();
Vector3 theScale(GetXAxis().Length(), GetYAxis().Length(), GetZAxis().Length());
scale = theScale;
- if( ! ( fabs(theScale.x - Vector3::ONE.x) < ROTATION_EPSILON &&
- fabs(theScale.y - Vector3::ONE.y) < ROTATION_EPSILON &&
- fabs(theScale.z - Vector3::ONE.z) < ROTATION_EPSILON ) )
+ if(!(fabs(theScale.x - Vector3::ONE.x) < ROTATION_EPSILON &&
+ fabs(theScale.y - Vector3::ONE.y) < ROTATION_EPSILON &&
+ fabs(theScale.z - Vector3::ONE.z) < ROTATION_EPSILON))
{
MATH_INCREASE_COUNTER(PerformanceMonitor::MATRIX_MULTIPLYS);
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,9);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 9);
// Non-identity scale is embedded into rotation matrix. Remove it first:
- Matrix m(*this);
- Vector3 inverseScale(1.0f/theScale.x, 1.0f/theScale.y, 1.0f/theScale.z);
+ Matrix m(*this);
+ Vector3 inverseScale(1.0f / theScale.x, 1.0f / theScale.y, 1.0f / theScale.z);
m.mMatrix[0] *= inverseScale.x;
m.mMatrix[1] *= inverseScale.x;
m.mMatrix[2] *= inverseScale.x;
Quaternion theRotation(m);
// If the imaginary components are close to zero, then use null quaternion instead.
- if( fabs(theRotation.mVector.x) < ROTATION_EPSILON &&
- fabs(theRotation.mVector.y) < ROTATION_EPSILON &&
- fabs(theRotation.mVector.z) < ROTATION_EPSILON )
+ if(fabs(theRotation.mVector.x) < ROTATION_EPSILON &&
+ fabs(theRotation.mVector.y) < ROTATION_EPSILON &&
+ fabs(theRotation.mVector.z) < ROTATION_EPSILON)
{
theRotation = Quaternion();
}
Quaternion theRotation(*this);
// If the imaginary components are close to zero, then use null quaternion instead.
- if( fabs(theRotation.mVector.x) < ROTATION_EPSILON &&
- fabs(theRotation.mVector.y) < ROTATION_EPSILON &&
- fabs(theRotation.mVector.z) < ROTATION_EPSILON )
+ if(fabs(theRotation.mVector.x) < ROTATION_EPSILON &&
+ fabs(theRotation.mVector.y) < ROTATION_EPSILON &&
+ fabs(theRotation.mVector.z) < ROTATION_EPSILON)
{
theRotation = Quaternion();
}
}
}
-
-
-std::ostream& operator<< (std::ostream& o, const Matrix& matrix)
+std::ostream& operator<<(std::ostream& o, const Matrix& matrix)
{
- return o << "[ " << matrix.mMatrix[0] << ", " << matrix.mMatrix[1] << ", " << matrix.mMatrix[2] << ", " << matrix.mMatrix[3] << ", "
- << matrix.mMatrix[4] << ", " << matrix.mMatrix[5] << ", " << matrix.mMatrix[6] << ", " << matrix.mMatrix[7] << ", "
- << matrix.mMatrix[8] << ", " << matrix.mMatrix[9] << ", " << matrix.mMatrix[10] << ", " << matrix.mMatrix[11] << ", "
- << matrix.mMatrix[12] << ", " << matrix.mMatrix[13] << ", " << matrix.mMatrix[14] << ", " << matrix.mMatrix[15] << " ]";
+ return o << "[ " << matrix.mMatrix[0] << ", " << matrix.mMatrix[1] << ", " << matrix.mMatrix[2] << ", " << matrix.mMatrix[3] << ", "
+ << matrix.mMatrix[4] << ", " << matrix.mMatrix[5] << ", " << matrix.mMatrix[6] << ", " << matrix.mMatrix[7] << ", "
+ << matrix.mMatrix[8] << ", " << matrix.mMatrix[9] << ", " << matrix.mMatrix[10] << ", " << matrix.mMatrix[11] << ", "
+ << matrix.mMatrix[12] << ", " << matrix.mMatrix[13] << ", " << matrix.mMatrix[14] << ", " << matrix.mMatrix[15] << " ]";
}
} // namespace Dali
class DALI_CORE_API Matrix
{
public:
-
- friend DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Matrix& matrix);
+ friend DALI_CORE_API std::ostream& operator<<(std::ostream& o, const Matrix& matrix);
/**
* @brief Constructor.
* @SINCE_1_0.0
* @param[in] initialize True for initialization by zero or otherwise
*/
- explicit Matrix( bool initialize );
+ explicit Matrix(bool initialize);
/**
* @brief Constructor.
* @SINCE_1_0.0
* @param rotation Rotation as quaternion
*/
- explicit Matrix( const Quaternion& rotation );
+ explicit Matrix(const Quaternion& rotation);
/**
* @brief Copy constructor.
* @SINCE_1_0.0
* @param[in] matrix A reference to the copied matrix
*/
- Matrix( const Matrix& matrix );
+ Matrix(const Matrix& matrix);
/**
* @brief Assignment operator.
* @param[in] matrix A reference to the copied matrix
* @return A reference to this
*/
- Matrix& operator=( const Matrix& matrix );
+ Matrix& operator=(const Matrix& matrix);
/**
* @brief Move constructor.
* @SINCE_1_9.21
* @param[in] matrix A reference to the moved matrix
*/
- Matrix( Matrix&& matrix );
+ Matrix(Matrix&& matrix);
/**
* @brief Move assignment operator.
* @param[in] matrix A reference to the moved matrix
* @return A reference to this
*/
- Matrix& operator=( Matrix&& matrix );
+ Matrix& operator=(Matrix&& matrix);
/**
* @brief The identity matrix.
* @SINCE_1_0.0
* @param[in] scale Scale to set on top of identity matrix
*/
- void SetIdentityAndScale( const Vector3& scale );
+ void SetIdentityAndScale(const Vector3& scale);
/**
* @brief Inverts a transform Matrix.
* @return The translation
* @note inlined for performance reasons (generates less code than a function call)
*/
- const Vector4& GetTranslation() const { return reinterpret_cast<const Vector4&>(mMatrix[12]); }
+ const Vector4& GetTranslation() const
+ {
+ return reinterpret_cast<const Vector4&>(mMatrix[12]);
+ }
/**
* @brief Gets the x,y and z components of the translation as a Vector3.
* @return The translation
* @note inlined for performance reasons (generates less code than a function call)
*/
- const Vector3& GetTranslation3() const { return reinterpret_cast<const Vector3&>(mMatrix[12]); }
+ const Vector3& GetTranslation3() const
+ {
+ return reinterpret_cast<const Vector3&>(mMatrix[12]);
+ }
/**
* @brief Sets the translation.
* @return The matrix contents as an array of 16 floats
* @note inlined for performance reasons (generates less code than a function call)
*/
- const float* AsFloat() const {return mMatrix;}
+ const float* AsFloat() const
+ {
+ return mMatrix;
+ }
/**
* @brief Returns the contents of the matrix as an array of 16 floats.
* @return The matrix contents as an array of 16 floats
* @note inlined for performance reasons (generates less code than a function call)
*/
- float* AsFloat() {return mMatrix;}
+ float* AsFloat()
+ {
+ return mMatrix;
+ }
/**
* @brief Function to multiply two matrices and store the result onto third.
* @param[in] lhs Matrix, this can be same matrix as result
* @param[in] rhs Matrix, this cannot be same matrix as result
*/
- static void Multiply( Matrix& result, const Matrix& lhs, const Matrix& rhs );
+ static void Multiply(Matrix& result, const Matrix& lhs, const Matrix& rhs);
/**
* @brief Function to multiply a matrix and quaternion and store the result onto third.
* @param[in] lhs Matrix, this can be same matrix as result
* @param[in] rhs Quaternion
*/
- static void Multiply( Matrix& result, const Matrix& lhs, const Quaternion& rhs );
+ static void Multiply(Matrix& result, const Matrix& lhs, const Quaternion& rhs);
/**
* @brief The multiplication operator.
* @param[in] rhs The Matrix to compare this to
* @return true if the matrices are equal
*/
- bool operator==(const Matrix & rhs) const;
+ bool operator==(const Matrix& rhs) const;
/**
* @brief The inequality operator.
* @param[in] rhs The Matrix to compare this to
* @return true if the matrices are not equal.
*/
- bool operator!=(const Matrix & rhs) const;
+ bool operator!=(const Matrix& rhs) const;
/**
* @brief Sets this matrix to contain the position, scale and rotation components.
* @param[in] rotation Rotation to apply
* @param[in] translation Translation to apply
*/
- void SetTransformComponents(const Vector3& scale,
+ void SetTransformComponents(const Vector3& scale,
const Quaternion& rotation,
- const Vector3& translation );
+ const Vector3& translation);
/**
* @brief Sets this matrix to contain the inverse of the position, scale and rotation components.
*/
void SetInverseTransformComponents(const Vector3& scale,
const Quaternion& rotation,
- const Vector3& translation );
-
+ const Vector3& translation);
/**
* @brief Sets this matrix to contain the inverse of the orthonormal basis and position components.
* @param[in] zAxis The Z axis of the basis
* @param[in] translation Translation to apply
*/
- void SetInverseTransformComponents(const Vector3& xAxis,
- const Vector3& yAxis,
- const Vector3& zAxis,
- const Vector3& translation );
+ void SetInverseTransformComponents(const Vector3& xAxis,
+ const Vector3& yAxis,
+ const Vector3& zAxis,
+ const Vector3& translation);
/**
* @brief Gets the position, scale and rotation components from the given transform matrix.
* @param[out] scale Scale to set - only valid if the transform matrix has not been skewed or sheared
* @pre This matrix must not contain skews or shears.
*/
- void GetTransformComponents(Vector3& position,
+ void GetTransformComponents(Vector3& position,
Quaternion& rotation,
- Vector3& scale) const;
+ Vector3& scale) const;
private:
-
float mMatrix[16]; ///< The elements of the matrix
};
* @param[in] matrix The matrix to print
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Matrix& matrix);
+DALI_CORE_API std::ostream& operator<<(std::ostream& o, const Matrix& matrix);
// Allow Matrix to be treated as a POD type
-template <> struct TypeTraits< Matrix > : public BasicTypes< Matrix > { enum { IS_TRIVIAL_TYPE = true }; };
+template<>
+struct TypeTraits<Matrix> : public BasicTypes<Matrix>
+{
+ enum
+ {
+ IS_TRIVIAL_TYPE = true
+ };
+};
/**
* @}
namespace
{
-const uint32_t NUM_BYTES_IN_ROW = 3*sizeof(float);
-const uint32_t NUM_BYTES_IN_MATRIX = 9*sizeof(float);
-}
+const uint32_t NUM_BYTES_IN_ROW = 3 * sizeof(float);
+const uint32_t NUM_BYTES_IN_MATRIX = 9 * sizeof(float);
+} // namespace
namespace Dali
{
-
-const Matrix3 Matrix3::IDENTITY(1.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 1.0f);
+const Matrix3 Matrix3::IDENTITY(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
Matrix3::Matrix3()
{
Matrix3::Matrix3(const Matrix3& m)
{
- memcpy( mElements, m.mElements, NUM_BYTES_IN_MATRIX );
+ memcpy(mElements, m.mElements, NUM_BYTES_IN_MATRIX);
}
Matrix3::Matrix3(const Matrix& matrix)
{
const float* m4 = matrix.AsFloat();
- memcpy(&mElements[S00], m4, NUM_BYTES_IN_ROW);
- memcpy(&mElements[S10], m4+4, NUM_BYTES_IN_ROW);
- memcpy(&mElements[S20], m4+8, NUM_BYTES_IN_ROW);
+ memcpy(&mElements[S00], m4, NUM_BYTES_IN_ROW);
+ memcpy(&mElements[S10], m4 + 4, NUM_BYTES_IN_ROW);
+ memcpy(&mElements[S20], m4 + 8, NUM_BYTES_IN_ROW);
}
Matrix3::Matrix3(float s00, float s01, float s02, float s10, float s11, float s12, float s20, float s21, float s22)
mElements[S22] = s22;
}
-
void Matrix3::SetIdentity()
{
memset(mElements, 0, NUM_BYTES_IN_MATRIX);
- mElements[S00]=1.0f;
- mElements[S11]=1.0f;
- mElements[S22]=1.0f;
+ mElements[S00] = 1.0f;
+ mElements[S11] = 1.0f;
+ mElements[S22] = 1.0f;
}
-Matrix3::Matrix3( Matrix3&& matrix )
+Matrix3::Matrix3(Matrix3&& matrix)
{
- memcpy( mElements, matrix.mElements, NUM_BYTES_IN_MATRIX );
+ memcpy(mElements, matrix.mElements, NUM_BYTES_IN_MATRIX);
}
-Matrix3& Matrix3::operator=( Matrix3&& matrix )
+Matrix3& Matrix3::operator=(Matrix3&& matrix)
{
- if( this != &matrix )
+ if(this != &matrix)
{
- memcpy( AsFloat(), matrix.AsFloat(), NUM_BYTES_IN_MATRIX );
+ memcpy(AsFloat(), matrix.AsFloat(), NUM_BYTES_IN_MATRIX);
}
return *this;
}
-Matrix3& Matrix3::operator=( const Matrix3& matrix )
+Matrix3& Matrix3::operator=(const Matrix3& matrix)
{
// no point copying if self assigning
- if( this != &matrix )
+ if(this != &matrix)
{
- memcpy( AsFloat(), matrix.AsFloat(), NUM_BYTES_IN_MATRIX );
+ memcpy(AsFloat(), matrix.AsFloat(), NUM_BYTES_IN_MATRIX);
}
return *this;
}
-Matrix3& Matrix3::operator=( const Matrix& matrix )
+Matrix3& Matrix3::operator=(const Matrix& matrix)
{
const float* m4 = matrix.AsFloat();
- memcpy(&mElements[S00], m4, NUM_BYTES_IN_ROW);
- memcpy(&mElements[S10], m4+4, NUM_BYTES_IN_ROW);
- memcpy(&mElements[S20], m4+8, NUM_BYTES_IN_ROW);
+ memcpy(&mElements[S00], m4, NUM_BYTES_IN_ROW);
+ memcpy(&mElements[S10], m4 + 4, NUM_BYTES_IN_ROW);
+ memcpy(&mElements[S20], m4 + 8, NUM_BYTES_IN_ROW);
return *this;
}
float det = mElements[S00] * cof[S00] + mElements[S01] * cof[S10] + mElements[S02] * cof[S20];
// In the case where the determinant is exactly zero, the matrix is non-invertible
- if( ! EqualsZero( det ) )
+ if(!EqualsZero(det))
{
det = 1.0f / det;
- for( int32_t i = 0; i < 9; i++ )
+ for(int32_t i = 0; i < 9; i++)
{
mElements[i] = cof[i] * det;
}
bool Matrix3::Transpose()
{
float tmp;
- tmp = mElements[S01]; mElements[S01] = mElements[S10]; mElements[S10]=tmp;
- tmp = mElements[S02]; mElements[S02] = mElements[S20]; mElements[S20]=tmp;
- tmp = mElements[S21]; mElements[S21] = mElements[S12]; mElements[S12]=tmp;
+ tmp = mElements[S01];
+ mElements[S01] = mElements[S10];
+ mElements[S10] = tmp;
+ tmp = mElements[S02];
+ mElements[S02] = mElements[S20];
+ mElements[S20] = tmp;
+ tmp = mElements[S21];
+ mElements[S21] = mElements[S12];
+ mElements[S12] = tmp;
return true;
}
float det = mElements[S00] * cof[S00] + mElements[S01] * cof[S10] + mElements[S02] * cof[S20];
// In the case where the determinant is exactly zero, the matrix is non-invertible
- if( ! EqualsZero( det ) )
+ if(!EqualsZero(det))
{
// Use average rather than determinant to remove rounding to zero errors in further multiplication
- float sum=0;
- for(uint32_t i=0;i<9;i++)
+ float sum = 0;
+ for(uint32_t i = 0; i < 9; i++)
{
- sum+=fabsf(cof[i]);
+ sum += fabsf(cof[i]);
}
- float scale = 9.0f/sum; // Inverse of the average values
- if (det < 0)
+ float scale = 9.0f / sum; // Inverse of the average values
+ if(det < 0)
{
// Ensure the signs of the inverse are correct
scale = -scale;
float Matrix3::Magnitude() const
{
- float avg=0;
- for(uint32_t i=0;i<9;i++)
+ float avg = 0;
+ for(uint32_t i = 0; i < 9; i++)
{
- avg+=fabsf(mElements[i]);
+ avg += fabsf(mElements[i]);
}
- return avg/3.0f;
+ return avg / 3.0f;
}
-
-void Matrix3::Multiply( Matrix3& result, const Matrix3& lhs, const Matrix3& rhs )
+void Matrix3::Multiply(Matrix3& result, const Matrix3& lhs, const Matrix3& rhs)
{
- float* temp = result.AsFloat();
- const float* rhsPtr = rhs.AsFloat();
+ float* temp = result.AsFloat();
+ const float* rhsPtr = rhs.AsFloat();
const float* lhsPtr = lhs.AsFloat();
- for( int32_t i=0; i < 3; i++ )
+ for(int32_t i = 0; i < 3; i++)
{
- int32_t loc = i * 3;
+ int32_t loc = i * 3;
int32_t loc1 = loc + 1;
int32_t loc2 = loc + 2;
float value0 = lhsPtr[loc];
float value1 = lhsPtr[loc1];
float value2 = lhsPtr[loc2];
- temp[loc] = (value0 * rhsPtr[0]) +
- (value1 * rhsPtr[3]) +
- (value2 * rhsPtr[6]);
+ temp[loc] = (value0 * rhsPtr[0]) +
+ (value1 * rhsPtr[3]) +
+ (value2 * rhsPtr[6]);
temp[loc1] = (value0 * rhsPtr[1]) +
(value1 * rhsPtr[4]) +
}
}
-bool Matrix3::operator==(const Matrix3 & rhs) const
+bool Matrix3::operator==(const Matrix3& rhs) const
{
return (
- Equals( mElements[0], rhs.mElements[0]) &&
- Equals( mElements[1], rhs.mElements[1]) &&
- Equals( mElements[2], rhs.mElements[2]) &&
- Equals( mElements[3], rhs.mElements[3]) &&
- Equals( mElements[4], rhs.mElements[4]) &&
- Equals( mElements[5], rhs.mElements[5]) &&
- Equals( mElements[6], rhs.mElements[6]) &&
- Equals( mElements[7], rhs.mElements[7]) &&
- Equals( mElements[8], rhs.mElements[8]));
+ Equals(mElements[0], rhs.mElements[0]) &&
+ Equals(mElements[1], rhs.mElements[1]) &&
+ Equals(mElements[2], rhs.mElements[2]) &&
+ Equals(mElements[3], rhs.mElements[3]) &&
+ Equals(mElements[4], rhs.mElements[4]) &&
+ Equals(mElements[5], rhs.mElements[5]) &&
+ Equals(mElements[6], rhs.mElements[6]) &&
+ Equals(mElements[7], rhs.mElements[7]) &&
+ Equals(mElements[8], rhs.mElements[8]));
}
bool Matrix3::operator!=(const Matrix3& rhs) const
return !(*this == rhs);
}
-std::ostream& operator<< (std::ostream& o, const Matrix3& matrix)
+std::ostream& operator<<(std::ostream& o, const Matrix3& matrix)
{
return o << "[ " << matrix.mElements[0] << ", " << matrix.mElements[1] << ", " << matrix.mElements[2] << ", "
- << matrix.mElements[3] << ", " << matrix.mElements[4] << ", " << matrix.mElements[5] << ", "
- << matrix.mElements[6] << ", " << matrix.mElements[7] << ", " << matrix.mElements[8] << " ]";
+ << matrix.mElements[3] << ", " << matrix.mElements[4] << ", " << matrix.mElements[5] << ", "
+ << matrix.mElements[6] << ", " << matrix.mElements[7] << ", " << matrix.mElements[8] << " ]";
}
} // namespace Dali
*/
// INTERNAL INCLUDES
-#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/math/matrix.h>
#include <dali/public-api/common/type-traits.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/vector3.h>
namespace Dali
{
class DALI_CORE_API Matrix3
{
public:
-
- friend DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Matrix3& matrix);
+ friend DALI_CORE_API std::ostream& operator<<(std::ostream& o, const Matrix3& matrix);
/**
* @brief The identity matrix.
* @SINCE_1_9.21
* @param[in] matrix A reference to the moved matrix
*/
- Matrix3( Matrix3&& matrix );
+ Matrix3(Matrix3&& matrix);
/**
* @brief Move assignment operator.
* @param[in] matrix A reference to the moved matrix
* @return A reference to this
*/
- Matrix3& operator=( Matrix3&& matrix );
+ Matrix3& operator=(Matrix3&& matrix);
/**
* @brief Assignment Operator.
* @param[in] matrix From which to copy values
* @return Reference to this object
*/
- Matrix3& operator=( const Matrix3& matrix );
+ Matrix3& operator=(const Matrix3& matrix);
/**
* @brief Assignment Operator.
* @param[in] matrix A reference to the copied matrix
* @return A reference to this
*/
- Matrix3& operator=( const Matrix& matrix );
+ Matrix3& operator=(const Matrix& matrix);
/**
* @brief The equality operator.
* @param[in] rhs The Matrix to compare this to
* @return True if the matrices are equal
*/
- bool operator==(const Matrix3 & rhs) const;
+ bool operator==(const Matrix3& rhs) const;
/**
* @brief The inequality operator.
* @param[in] rhs The Matrix to compare this to
* @return true if the matrices are equal
*/
- bool operator!=(const Matrix3 & rhs) const;
+ bool operator!=(const Matrix3& rhs) const;
/**
* @brief Destructor.
* @SINCE_1_0.0
* @return The matrix contents as an array of 9 floats
*/
- const float* AsFloat() const {return &mElements[0];}
+ const float* AsFloat() const
+ {
+ return &mElements[0];
+ }
/**
* @brief Returns the contents of the matrix as an array of 9 floats.
* @SINCE_1_0.0
* @return The matrix contents as an array of 9 floats
*/
- float* AsFloat() {return &mElements[0];}
+ float* AsFloat()
+ {
+ return &mElements[0];
+ }
/**
* @brief Inverts the matrix.
* @param[in] lhs Matrix, this can be same matrix as result
* @param[in] rhs Matrix, this cannot be same matrix as result
*/
- static void Multiply( Matrix3& result, const Matrix3& lhs, const Matrix3& rhs );
+ static void Multiply(Matrix3& result, const Matrix3& lhs, const Matrix3& rhs);
private:
-
float mElements[9]; ///< The elements of the matrix
};
* @param[in] matrix The matrix to print
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Matrix3& matrix);
+DALI_CORE_API std::ostream& operator<<(std::ostream& o, const Matrix3& matrix);
// Allow Matrix3 to be treated as a POD type
-template <> struct TypeTraits< Matrix3 > : public BasicTypes< Matrix3 > { enum { IS_TRIVIAL_TYPE = true }; };
+template<>
+struct TypeTraits<Matrix3> : public BasicTypes<Matrix3>
+{
+ enum
+ {
+ IS_TRIVIAL_TYPE = true
+ };
+};
/**
* @}
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <ostream>
// INTERNAL INCLUDES
+#include <dali/internal/render/common/performance-monitor.h>
#include <dali/public-api/common/constants.h>
#include <dali/public-api/math/degree.h>
+#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/radian.h>
-#include <dali/public-api/math/math-utils.h>
-#include <dali/internal/render/common/performance-monitor.h>
namespace Dali
{
const Quaternion Quaternion::IDENTITY;
-
/**
* Default Constructor
*/
Quaternion::Quaternion()
-: mVector( 0.0f, 0.0f, 0.0f, 1.0f )
+: mVector(0.0f, 0.0f, 0.0f, 1.0f)
{
}
-Quaternion::Quaternion( float cosThetaBy2, float iBySineTheta, float jBySineTheta, float kBySineTheta )
-: mVector( iBySineTheta, jBySineTheta, kBySineTheta, cosThetaBy2 )
+Quaternion::Quaternion(float cosThetaBy2, float iBySineTheta, float jBySineTheta, float kBySineTheta)
+: mVector(iBySineTheta, jBySineTheta, kBySineTheta, cosThetaBy2)
{
}
-Quaternion::Quaternion( const Vector4& vector )
-: mVector( vector )
+Quaternion::Quaternion(const Vector4& vector)
+: mVector(vector)
{
}
-Quaternion::Quaternion( Radian angle, const Vector3& axis )
+Quaternion::Quaternion(Radian angle, const Vector3& axis)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,4);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 4);
Vector3 tmpAxis = axis;
tmpAxis.Normalize();
- const float halfAngle = angle.radian * 0.5f;
+ const float halfAngle = angle.radian * 0.5f;
const float sinThetaByTwo = sinf(halfAngle);
const float cosThetaByTwo = cosf(halfAngle);
- mVector.x = tmpAxis.x * sinThetaByTwo;
- mVector.y = tmpAxis.y * sinThetaByTwo;
- mVector.z = tmpAxis.z * sinThetaByTwo;
- mVector.w = cosThetaByTwo;
+ mVector.x = tmpAxis.x * sinThetaByTwo;
+ mVector.y = tmpAxis.y * sinThetaByTwo;
+ mVector.z = tmpAxis.z * sinThetaByTwo;
+ mVector.w = cosThetaByTwo;
}
-Quaternion::Quaternion( Radian pitch, Radian yaw, Radian roll )
+Quaternion::Quaternion(Radian pitch, Radian yaw, Radian roll)
{
- SetEuler( pitch, yaw, roll );
+ SetEuler(pitch, yaw, roll);
}
-Quaternion::Quaternion( const Matrix& matrix )
+Quaternion::Quaternion(const Matrix& matrix)
{
- Vector3 xAxis( matrix.GetXAxis() );
- Vector3 yAxis( matrix.GetYAxis() );
- Vector3 zAxis( matrix.GetZAxis() );
+ Vector3 xAxis(matrix.GetXAxis());
+ Vector3 yAxis(matrix.GetYAxis());
+ Vector3 zAxis(matrix.GetZAxis());
- SetFromAxes( xAxis, yAxis, zAxis );
+ SetFromAxes(xAxis, yAxis, zAxis);
}
-Quaternion::Quaternion( const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis )
+Quaternion::Quaternion(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis)
{
- SetFromAxes( xAxis, yAxis, zAxis );
+ SetFromAxes(xAxis, yAxis, zAxis);
}
-Quaternion::Quaternion( const Vector3& v0, const Vector3& v1 )
+Quaternion::Quaternion(const Vector3& v0, const Vector3& v1)
{
float dot = v0.Dot(v1);
- if( dot > 1.0f - Math::MACHINE_EPSILON_1 )
+ if(dot > 1.0f - Math::MACHINE_EPSILON_1)
{
//Identity quaternion
mVector.x = mVector.y = mVector.z = 0.0f;
- mVector.w = 1.0f;
+ mVector.w = 1.0f;
}
- else if( dot < -1.0f + Math::MACHINE_EPSILON_1)
+ else if(dot < -1.0f + Math::MACHINE_EPSILON_1)
{
//180 degree rotation across the Z axis
mVector.x = mVector.y = mVector.w = 0.0f;
- mVector.z = 1.0f;
+ mVector.z = 1.0f;
}
else
{
{
// start from w as its unlikely that any real rotation has w == 1
// Uses a relaxed epsilon, as composition of rotation introduces error
- return ( ( fabsf( mVector.w - 1.0f ) < Math::MACHINE_EPSILON_10 )&&
- ( fabsf( mVector.x ) < Math::MACHINE_EPSILON_10 )&&
- ( fabsf( mVector.y ) < Math::MACHINE_EPSILON_10 )&&
- ( fabsf( mVector.z ) < Math::MACHINE_EPSILON_10 ) );
+ return ((fabsf(mVector.w - 1.0f) < Math::MACHINE_EPSILON_10) &&
+ (fabsf(mVector.x) < Math::MACHINE_EPSILON_10) &&
+ (fabsf(mVector.y) < Math::MACHINE_EPSILON_10) &&
+ (fabsf(mVector.z) < Math::MACHINE_EPSILON_10));
}
bool Quaternion::ToAxisAngle(Vector3& axis, Radian& angle) const
{
- angle = acosf(mVector.w);
+ angle = acosf(mVector.w);
bool converted = false;
// pre-compute to save time
- const float sine = sinf( angle.radian );
+ const float sine = sinf(angle.radian);
// If sine(angle) is zero, conversion is not possible
- if ( ! EqualsZero( sine ) )
+ if(!EqualsZero(sine))
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
float sinf_theta_inv = 1.0f / sine;
- axis.x = mVector.x*sinf_theta_inv;
- axis.y = mVector.y*sinf_theta_inv;
- axis.z = mVector.z*sinf_theta_inv;
+ axis.x = mVector.x * sinf_theta_inv;
+ axis.y = mVector.y * sinf_theta_inv;
+ axis.z = mVector.z * sinf_theta_inv;
angle.radian *= 2.0f;
converted = true;
}
return mVector;
}
-void Quaternion::SetEuler( Radian pitch, Radian yaw, Radian roll )
+void Quaternion::SetEuler(Radian pitch, Radian yaw, Radian roll)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,19);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 19);
const float halfX = 0.5f * pitch.radian;
const float halfY = 0.5f * yaw.radian;
Vector4 Quaternion::EulerAngles() const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,13);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 13);
- float sqw = mVector.w*mVector.w;
- float sqx = mVector.x*mVector.x;
- float sqy = mVector.y*mVector.y;
- float sqz = mVector.z*mVector.z;
+ float sqw = mVector.w * mVector.w;
+ float sqx = mVector.x * mVector.x;
+ float sqy = mVector.y * mVector.y;
+ float sqz = mVector.z * mVector.z;
Vector4 euler;
- euler.x = atan2f(2.0f * (mVector.y*mVector.z + mVector.x*mVector.w), -sqx - sqy + sqz + sqw);
- euler.y = asinf(-2.0f * (mVector.x*mVector.z - mVector.y*mVector.w));
- euler.z = atan2f(2.0f * (mVector.x*mVector.y + mVector.z*mVector.w), sqx - sqy - sqz + sqw);
+ euler.x = atan2f(2.0f * (mVector.y * mVector.z + mVector.x * mVector.w), -sqx - sqy + sqz + sqw);
+ euler.y = asinf(-2.0f * (mVector.x * mVector.z - mVector.y * mVector.w));
+ euler.z = atan2f(2.0f * (mVector.x * mVector.y + mVector.z * mVector.w), sqx - sqy - sqz + sqw);
return euler;
}
-const Quaternion Quaternion::operator+( const Quaternion& other ) const
+const Quaternion Quaternion::operator+(const Quaternion& other) const
{
return Quaternion(mVector + other.mVector);
}
-const Quaternion Quaternion::operator-( const Quaternion& other ) const
+const Quaternion Quaternion::operator-(const Quaternion& other) const
{
return Quaternion(mVector - other.mVector);
}
-const Quaternion Quaternion::operator*( const Quaternion& other ) const
+const Quaternion Quaternion::operator*(const Quaternion& other) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,12);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 12);
return Quaternion(mVector.w * other.mVector.w - mVector.Dot(other.mVector),
mVector.y * other.mVector.z - mVector.z * other.mVector.y + mVector.w * other.mVector.x + mVector.x * other.mVector.w,
mVector.x * other.mVector.y - mVector.y * other.mVector.x + mVector.w * other.mVector.z + mVector.z * other.mVector.w);
}
-Vector3 Quaternion::operator*( const Vector3& other ) const
+Vector3 Quaternion::operator*(const Vector3& other) const
{
Vector3 qvec(mVector.x, mVector.y, mVector.z);
- Vector3 uv = qvec.Cross( other );
+ Vector3 uv = qvec.Cross(other);
Vector3 uuv = qvec.Cross(uv);
uv *= (2.0f * mVector.w);
uuv *= 2.0f;
return other + uv + uuv;
}
-const Quaternion Quaternion::operator/( const Quaternion& q ) const
+const Quaternion Quaternion::operator/(const Quaternion& q) const
{
Quaternion p(q);
p.Invert();
return *this * p;
}
-const Quaternion Quaternion::operator*( float scale ) const
+const Quaternion Quaternion::operator*(float scale) const
{
- return Quaternion(mVector*scale);
+ return Quaternion(mVector * scale);
}
-const Quaternion Quaternion::operator/( float scale ) const
+const Quaternion Quaternion::operator/(float scale) const
{
- return Quaternion(mVector/scale);
+ return Quaternion(mVector / scale);
}
Quaternion Quaternion::operator-() const
return Quaternion(-mVector.w, -mVector.x, -mVector.y, -mVector.z);
}
-const Quaternion& Quaternion::operator+=( const Quaternion& q )
+const Quaternion& Quaternion::operator+=(const Quaternion& q)
{
- mVector += q.mVector; return *this;
+ mVector += q.mVector;
+ return *this;
}
-const Quaternion& Quaternion::operator-=( const Quaternion& q )
+const Quaternion& Quaternion::operator-=(const Quaternion& q)
{
- mVector -= q.mVector; return *this;
+ mVector -= q.mVector;
+ return *this;
}
-const Quaternion& Quaternion::operator*=( const Quaternion& q )
+const Quaternion& Quaternion::operator*=(const Quaternion& q)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,12);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 12);
float x = mVector.x, y = mVector.y, z = mVector.z, w = mVector.w;
mVector.w = mVector.w * q.mVector.w - mVector.Dot(q.mVector);
- mVector.x = y*q.mVector.z - z*q.mVector.y + w*q.mVector.x + x*q.mVector.w;
- mVector.y = z*q.mVector.x - x*q.mVector.z + w*q.mVector.y + y*q.mVector.w;
- mVector.z = x*q.mVector.y - y*q.mVector.x + w*q.mVector.z + z*q.mVector.w;
+ mVector.x = y * q.mVector.z - z * q.mVector.y + w * q.mVector.x + x * q.mVector.w;
+ mVector.y = z * q.mVector.x - x * q.mVector.z + w * q.mVector.y + y * q.mVector.w;
+ mVector.z = x * q.mVector.y - y * q.mVector.x + w * q.mVector.z + z * q.mVector.w;
return *this;
}
-const Quaternion& Quaternion::operator*=( float scale )
+const Quaternion& Quaternion::operator*=(float scale)
{
- mVector*=scale; return *this;
+ mVector *= scale;
+ return *this;
}
-const Quaternion& Quaternion::operator/=( float scale )
+const Quaternion& Quaternion::operator/=(float scale)
{
- mVector/=scale; return *this;
+ mVector /= scale;
+ return *this;
}
-bool Quaternion::operator==( const Quaternion& rhs ) const
+bool Quaternion::operator==(const Quaternion& rhs) const
{
- return ( ( fabsf(mVector.x - rhs.mVector.x) < Math::MACHINE_EPSILON_1 &&
- fabsf(mVector.y - rhs.mVector.y) < Math::MACHINE_EPSILON_1 &&
- fabsf(mVector.z - rhs.mVector.z) < Math::MACHINE_EPSILON_1 &&
- fabsf(mVector.w - rhs.mVector.w) < Math::MACHINE_EPSILON_1 ) ||
- // Or equal to negation of rhs
- ( fabsf(mVector.x + rhs.mVector.x) < Math::MACHINE_EPSILON_1 &&
- fabsf(mVector.y + rhs.mVector.y) < Math::MACHINE_EPSILON_1 &&
- fabsf(mVector.z + rhs.mVector.z) < Math::MACHINE_EPSILON_1 &&
- fabsf(mVector.w + rhs.mVector.w) < Math::MACHINE_EPSILON_1 )
- );
+ return ((fabsf(mVector.x - rhs.mVector.x) < Math::MACHINE_EPSILON_1 &&
+ fabsf(mVector.y - rhs.mVector.y) < Math::MACHINE_EPSILON_1 &&
+ fabsf(mVector.z - rhs.mVector.z) < Math::MACHINE_EPSILON_1 &&
+ fabsf(mVector.w - rhs.mVector.w) < Math::MACHINE_EPSILON_1) ||
+ // Or equal to negation of rhs
+ (fabsf(mVector.x + rhs.mVector.x) < Math::MACHINE_EPSILON_1 &&
+ fabsf(mVector.y + rhs.mVector.y) < Math::MACHINE_EPSILON_1 &&
+ fabsf(mVector.z + rhs.mVector.z) < Math::MACHINE_EPSILON_1 &&
+ fabsf(mVector.w + rhs.mVector.w) < Math::MACHINE_EPSILON_1));
}
-bool Quaternion::operator!=( const Quaternion& rhs ) const
+bool Quaternion::operator!=(const Quaternion& rhs) const
{
return !operator==(rhs);
}
float Quaternion::Length() const
{
- return static_cast< float >( sqrt(mVector.w * mVector.w + mVector.Dot(mVector) ) );
+ return static_cast<float>(sqrt(mVector.w * mVector.w + mVector.Dot(mVector)));
}
float Quaternion::LengthSquared() const
{
- return static_cast< float >( mVector.w * mVector.w + mVector.Dot(mVector) );
+ return static_cast<float>(mVector.w * mVector.w + mVector.Dot(mVector));
}
void Quaternion::Normalize()
{
- *this/=Length();
+ *this /= Length();
}
Quaternion Quaternion::Normalized() const
{
- return *this/Length();
+ return *this / Length();
}
void Quaternion::Conjugate()
void Quaternion::Invert()
{
Conjugate();
- *this/=LengthSquared();
+ *this /= LengthSquared();
}
Quaternion Quaternion::Log() const
{
- float a = acosf(mVector.w);
- float sina = sinf(a);
+ float a = acosf(mVector.w);
+ float sina = sinf(a);
Quaternion ret;
ret.mVector.w = 0;
- if (fabsf(sina) >= Math::MACHINE_EPSILON_1)
+ if(fabsf(sina) >= Math::MACHINE_EPSILON_1)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,4);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 4);
float angleBySinAngle = a * (1.0f / sina);
- ret.mVector.x = mVector.x * angleBySinAngle;
- ret.mVector.y = mVector.y * angleBySinAngle;
- ret.mVector.z = mVector.z * angleBySinAngle;
+ ret.mVector.x = mVector.x * angleBySinAngle;
+ ret.mVector.y = mVector.y * angleBySinAngle;
+ ret.mVector.z = mVector.z * angleBySinAngle;
}
else
{
- ret.mVector.x= ret.mVector.y= ret.mVector.z= 0;
+ ret.mVector.x = ret.mVector.y = ret.mVector.z = 0;
}
return ret;
}
Quaternion Quaternion::Exp() const
{
- DALI_ASSERT_ALWAYS( EqualsZero( mVector.w ) && "Cannot perform Exponent" );
+ DALI_ASSERT_ALWAYS(EqualsZero(mVector.w) && "Cannot perform Exponent");
- float a = mVector.Length();
- float sina = sinf(a);
+ float a = mVector.Length();
+ float sina = sinf(a);
Quaternion ret;
ret.mVector.w = cosf(a);
- if (a >= Math::MACHINE_EPSILON_1)
+ if(a >= Math::MACHINE_EPSILON_1)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,4);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 4);
float sinAOverA = sina * (1.0f / a);
- ret.mVector.x = mVector.x * sinAOverA;
- ret.mVector.y = mVector.y * sinAOverA;
- ret.mVector.z = mVector.z * sinAOverA;
+ ret.mVector.x = mVector.x * sinAOverA;
+ ret.mVector.y = mVector.y * sinAOverA;
+ ret.mVector.z = mVector.z * sinAOverA;
}
else
{
return ret;
}
-float Quaternion::Dot( const Quaternion& q1, const Quaternion& q2 )
+float Quaternion::Dot(const Quaternion& q1, const Quaternion& q2)
{
return q1.mVector.Dot4(q2.mVector);
}
-Quaternion Quaternion::Lerp(const Quaternion& q1, const Quaternion& q2, float t )
+Quaternion Quaternion::Lerp(const Quaternion& q1, const Quaternion& q2, float t)
{
- return (q1*(1.0f-t) + q2*t).Normalized();
+ return (q1 * (1.0f - t) + q2 * t).Normalized();
}
-Quaternion Quaternion::Slerp( const Quaternion& q1, const Quaternion& q2, float progress )
+Quaternion Quaternion::Slerp(const Quaternion& q1, const Quaternion& q2, float progress)
{
Quaternion q3;
- float cosTheta = Quaternion::Dot(q1, q2);
+ float cosTheta = Quaternion::Dot(q1, q2);
/**
* If cos(theta) < 0, q1 and q2 are more than 90 degrees apart,
* so invert one to reduce spinning.
*/
- if (cosTheta < 0.0f)
+ if(cosTheta < 0.0f)
{
cosTheta = -cosTheta;
- q3 = -q2;
+ q3 = -q2;
}
else
{
q3 = q2;
}
- if (fabsf(cosTheta) < 0.95f)
+ if(fabsf(cosTheta) < 0.95f)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,5);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 5);
// Normal SLERP
- float sine = sqrtf(1.0f - cosTheta*cosTheta);
- float angle = atan2f(sine, cosTheta);
+ float sine = sqrtf(1.0f - cosTheta * cosTheta);
+ float angle = atan2f(sine, cosTheta);
float invSine = 1.0f / sine;
- float coeff0 = sinf((1.0f - progress) * angle) * invSine;
- float coeff1 = sinf(progress * angle) * invSine;
+ float coeff0 = sinf((1.0f - progress) * angle) * invSine;
+ float coeff1 = sinf(progress * angle) * invSine;
- return q1*coeff0 + q3*coeff1;
+ return q1 * coeff0 + q3 * coeff1;
}
else
{
// If the angle is small, use linear interpolation
- Quaternion result = q1*(1.0f - progress) + q3*progress;
+ Quaternion result = q1 * (1.0f - progress) + q3 * progress;
return result.Normalized();
}
}
-Quaternion Quaternion::SlerpNoInvert( const Quaternion& q1, const Quaternion& q2, float t )
+Quaternion Quaternion::SlerpNoInvert(const Quaternion& q1, const Quaternion& q2, float t)
{
float cosTheta = Quaternion::Dot(q1, q2);
- if (cosTheta > -0.95f && cosTheta < 0.95f)
+ if(cosTheta > -0.95f && cosTheta < 0.95f)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,2);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 2);
float theta = acosf(cosTheta);
- return (q1*sinf(theta*(1.0f-t)) + q2*sinf(theta*t))/sinf(theta);
+ return (q1 * sinf(theta * (1.0f - t)) + q2 * sinf(theta * t)) / sinf(theta);
}
else
{
}
}
-Quaternion Quaternion::Squad( const Quaternion& start, const Quaternion& end, const Quaternion& ctrl1, const Quaternion& ctrl2, float t )
+Quaternion Quaternion::Squad(const Quaternion& start, const Quaternion& end, const Quaternion& ctrl1, const Quaternion& ctrl2, float t)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,2);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 2);
- Quaternion c = SlerpNoInvert( start, end, t );
- Quaternion d = SlerpNoInvert( ctrl1, ctrl2, t );
- return SlerpNoInvert( c, d, 2*t*(1-t) );
+ Quaternion c = SlerpNoInvert(start, end, t);
+ Quaternion d = SlerpNoInvert(ctrl1, ctrl2, t);
+ return SlerpNoInvert(c, d, 2 * t * (1 - t));
}
-float Quaternion::AngleBetween( const Quaternion& q1, const Quaternion& q2 )
+float Quaternion::AngleBetween(const Quaternion& q1, const Quaternion& q2)
{
Quaternion from(q1);
Quaternion to(q2);
//Formula for angle θ between two quaternion is:
//θ = cos^−1 (2⟨q1,q2⟩^2 − 1), Where (q1,q2) is inner product of the quaternions.
- float X = from.mVector.Dot4(to.mVector);
- float theta = acosf( (2 * X * X) - 1); // float arc cosine
+ float X = from.mVector.Dot4(to.mVector);
+ float theta = acosf((2 * X * X) - 1); // float arc cosine
return theta;
}
-Vector4 Quaternion::Rotate( const Vector4& vector ) const
+Vector4 Quaternion::Rotate(const Vector4& vector) const
{
Quaternion V(0.0f, vector.x, vector.y, vector.z);
Quaternion conjugate(*this);
return (*this * V * conjugate).mVector;
}
-Vector3 Quaternion::Rotate( const Vector3& vector ) const
+Vector3 Quaternion::Rotate(const Vector3& vector) const
{
Quaternion V(0.0f, vector.x, vector.y, vector.z);
Quaternion conjugate(*this);
return Vector3((*this * V * conjugate).mVector);
}
-void Quaternion::SetFromAxes( const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis )
+void Quaternion::SetFromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis)
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,4);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 4);
float t = xAxis.x + yAxis.y + zAxis.z;
- if ( t > 0.0f ) // w is largest
+ if(t > 0.0f) // w is largest
{
- float root = sqrtf( t + 1.0f );
+ float root = sqrtf(t + 1.0f);
float one_over_4w = 0.5f / root;
- mVector.x = ( yAxis.z - zAxis.y ) * one_over_4w;
- mVector.y = ( zAxis.x - xAxis.z ) * one_over_4w;
- mVector.z = ( xAxis.y - yAxis.x ) * one_over_4w;
- mVector.w = root * 0.5f;
+ mVector.x = (yAxis.z - zAxis.y) * one_over_4w;
+ mVector.y = (zAxis.x - xAxis.z) * one_over_4w;
+ mVector.z = (xAxis.y - yAxis.x) * one_over_4w;
+ mVector.w = root * 0.5f;
}
- else if( zAxis.z > xAxis.x && zAxis.z > yAxis.y ) // z is largest
+ else if(zAxis.z > xAxis.x && zAxis.z > yAxis.y) // z is largest
{
- float root = sqrtf( zAxis.z - xAxis.x - yAxis.y + 1.0f );
+ float root = sqrtf(zAxis.z - xAxis.x - yAxis.y + 1.0f);
float one_over_4w = 0.5f / root;
- mVector.x = ( xAxis.z + zAxis.x ) * one_over_4w;
- mVector.y = ( yAxis.z + zAxis.y ) * one_over_4w;
- mVector.z = root * 0.5f;
- mVector.w = ( xAxis.y - yAxis.x ) * one_over_4w;
+ mVector.x = (xAxis.z + zAxis.x) * one_over_4w;
+ mVector.y = (yAxis.z + zAxis.y) * one_over_4w;
+ mVector.z = root * 0.5f;
+ mVector.w = (xAxis.y - yAxis.x) * one_over_4w;
}
- else if( yAxis.y > xAxis.x ) // y is largest
+ else if(yAxis.y > xAxis.x) // y is largest
{
- float root = sqrtf(yAxis.y - zAxis.z - xAxis.x + 1.0f );
+ float root = sqrtf(yAxis.y - zAxis.z - xAxis.x + 1.0f);
float one_over_4w = 0.5f / root;
- mVector.x = ( xAxis.y + yAxis.x ) * one_over_4w;
+ mVector.x = (xAxis.y + yAxis.x) * one_over_4w;
mVector.y = root * 0.5f;
- mVector.z = ( zAxis.y + yAxis.z ) * one_over_4w;
- mVector.w = ( zAxis.x - xAxis.z ) * one_over_4w;
+ mVector.z = (zAxis.y + yAxis.z) * one_over_4w;
+ mVector.w = (zAxis.x - xAxis.z) * one_over_4w;
}
- else // x is largest
+ else // x is largest
{
- float root = sqrtf( xAxis.x - yAxis.y - zAxis.z + 1.0f );
+ float root = sqrtf(xAxis.x - yAxis.y - zAxis.z + 1.0f);
float one_over_4w = 0.5f / root;
- mVector.x = root * 0.5f;
- mVector.y = ( yAxis.x + xAxis.y ) * one_over_4w;
- mVector.z = ( zAxis.x + xAxis.z ) * one_over_4w;
- mVector.w = ( yAxis.z - zAxis.y ) * one_over_4w;
+ mVector.x = root * 0.5f;
+ mVector.y = (yAxis.x + xAxis.y) * one_over_4w;
+ mVector.z = (zAxis.x + xAxis.z) * one_over_4w;
+ mVector.w = (yAxis.z - zAxis.y) * one_over_4w;
}
Normalize();
}
-std::ostream& operator<<( std::ostream& o, const Quaternion& quaternion )
+std::ostream& operator<<(std::ostream& o, const Quaternion& quaternion)
{
Vector3 axis;
- Radian angleRadians;
+ Radian angleRadians;
- quaternion.ToAxisAngle( axis, angleRadians );
- Degree degrees( angleRadians );
+ quaternion.ToAxisAngle(axis, angleRadians);
+ Degree degrees(angleRadians);
return o << "[ Axis: [" << axis.x << ", " << axis.y << ", " << axis.z << "], Angle: " << degrees.degree << " degrees ]";
}
class DALI_CORE_API Quaternion
{
public:
-
/**
* @brief Default Constructor.
* @SINCE_1_0.0
* @param[in] jBySineTheta
* @param[in] kBySineTheta
*/
- Quaternion( float cosThetaBy2, float iBySineTheta, float jBySineTheta, float kBySineTheta );
+ Quaternion(float cosThetaBy2, float iBySineTheta, float jBySineTheta, float kBySineTheta);
/**
* @brief Constructs from a quaternion represented by a vector.
* @SINCE_1_0.0
* @param[in] vector x,y,z fields represent i,j,k coefficients, w represents cos(theta/2)
*/
- explicit Quaternion( const Vector4& vector );
+ explicit Quaternion(const Vector4& vector);
/**
* @brief Constructor from an axis and angle.
* @param[in] angle The angle around the axis
* @param[in] axis The vector of the axis
*/
- Quaternion( Radian angle, const Vector3& axis );
+ Quaternion(Radian angle, const Vector3& axis);
/**
* @brief Constructs from Euler angles.
* @param[in] yaw
* @param[in] roll
*/
- Quaternion( Radian pitch, Radian yaw, Radian roll );
+ Quaternion(Radian pitch, Radian yaw, Radian roll);
/**
* @brief Constructs from a matrix.
* @param[in] yAxis The Y axis
* @param[in] zAxis The Z axis
*/
- explicit Quaternion( const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis );
+ explicit Quaternion(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis);
/**
* @brief Constructs quaternion which describes minimum rotation to align v0 with v1.
* @pre v0 and v1 should be normalized
*
*/
- explicit Quaternion( const Vector3& v0, const Vector3& v1 );
+ explicit Quaternion(const Vector3& v0, const Vector3& v1);
/**
* @brief Destructor, nonvirtual as this is not a base class.
*/
~Quaternion();
-// Constants
+ // Constants
static const Quaternion IDENTITY; ///< (0.0f,0.0f,0.0f,1.0f)
* @param[out] angle Angle in radians
* @return True if converted correctly
*/
- bool ToAxisAngle( Vector3& axis, Radian& angle ) const;
+ bool ToAxisAngle(Vector3& axis, Radian& angle) const;
/**
* @brief Returns the quaternion as a vector.
* @param[in] yaw
* @param[in] roll
*/
- void SetEuler( Radian pitch, Radian yaw, Radian roll );
+ void SetEuler(Radian pitch, Radian yaw, Radian roll);
/**
* @brief Returns the Euler angles from a rotation Quaternion.
* @param[in] other The quaternion to add
* @return A quaternion containing the result of the addition
*/
- const Quaternion operator+( const Quaternion& other ) const;
+ const Quaternion operator+(const Quaternion& other) const;
/**
* @brief Subtraction operator.
* @param[in] other The quaternion to subtract
* @return A quaternion containing the result of the subtract
*/
- const Quaternion operator-( const Quaternion& other ) const;
+ const Quaternion operator-(const Quaternion& other) const;
/**
* @brief Multiplication operator.
* @param[in] other The quaternion to multiply
* @return A quaternion containing the result
*/
- const Quaternion operator*( const Quaternion& other ) const;
+ const Quaternion operator*(const Quaternion& other) const;
/**
* @brief Multiplication operator.
* @param[in] other The vector to multiply
* @return A vector containing the result of the multiplication
*/
- Vector3 operator*( const Vector3& other ) const;
+ Vector3 operator*(const Vector3& other) const;
/**
* @brief Division operator.
* @param[in] other A quaternion to divide by
* @return A quaternion containing the result
*/
- const Quaternion operator/( const Quaternion& other ) const;
+ const Quaternion operator/(const Quaternion& other) const;
/**
* @brief Scale operator.
* @param[in] scale A value to scale by
* @return A quaternion containing the result
*/
- const Quaternion operator*( float scale ) const;
+ const Quaternion operator*(float scale) const;
/**
* @brief Scale operator.
* @param[in] scale A value to scale by
* @return A quaternion containing the result
*/
- const Quaternion operator/( float scale ) const;
+ const Quaternion operator/(float scale) const;
/**
* @brief Unary Negation operator.
* @param[in] other The quaternion to add
* @return A reference to this
*/
- const Quaternion& operator+=( const Quaternion& other );
+ const Quaternion& operator+=(const Quaternion& other);
/**
* @brief Subtraction with Assignment operator.
* @param[in] other The quaternion to subtract
* @return A reference to this
*/
- const Quaternion& operator-=( const Quaternion& other );
+ const Quaternion& operator-=(const Quaternion& other);
/**
* @brief Multiplication with Assignment operator.
* @param[in] other The quaternion to multiply
* @return A reference to this
*/
- const Quaternion& operator*=( const Quaternion& other );
+ const Quaternion& operator*=(const Quaternion& other);
/**
* @brief Scale with Assignment operator.
* @param[in] scale the value to scale by
* @return A reference to this
*/
- const Quaternion& operator*=( float scale );
+ const Quaternion& operator*=(float scale);
/**
* @brief Scale with Assignment operator.
* @param[in] scale The value to scale by
* @return A reference to this
*/
- const Quaternion& operator/=( float scale );
+ const Quaternion& operator/=(float scale);
/**
* @brief Equality operator.
* @param[in] rhs The quaternion to compare with
* @return True if the quaternions are equal
*/
- bool operator==( const Quaternion& rhs ) const;
+ bool operator==(const Quaternion& rhs) const;
/**
* @brief Inequality operator.
* @param[in] rhs The quaternion to compare with
* @return True if the quaternions are not equal
*/
- bool operator!=( const Quaternion& rhs ) const;
+ bool operator!=(const Quaternion& rhs) const;
/**
* @brief Returns the length of the quaternion.
* @param[in] q2 The second quaternion
* @return The dot product of the two quaternions
*/
- static float Dot( const Quaternion &q1, const Quaternion &q2 );
+ static float Dot(const Quaternion& q1, const Quaternion& q2);
/**
* @brief Linear Interpolation (using a straight line between the two quaternions).
* @param[in] t A progress value between 0 and 1
* @return The interpolated quaternion
*/
- static Quaternion Lerp( const Quaternion &q1, const Quaternion &q2, float t );
+ static Quaternion Lerp(const Quaternion& q1, const Quaternion& q2, float t);
/**
* @brief Spherical Linear Interpolation (using the shortest arc of a great circle between
* @param[in] progress A progress value between 0 and 1
* @return The interpolated quaternion
*/
- static Quaternion Slerp( const Quaternion &q1, const Quaternion &q2, float progress );
+ static Quaternion Slerp(const Quaternion& q1, const Quaternion& q2, float progress);
/**
* @brief This version of Slerp, used by Squad, does not check for theta > 90.
* @param[in] t A progress value between 0 and 1
* @return The interpolated quaternion
*/
- static Quaternion SlerpNoInvert( const Quaternion &q1, const Quaternion &q2, float t );
+ static Quaternion SlerpNoInvert(const Quaternion& q1, const Quaternion& q2, float t);
/**
* @brief Spherical Cubic Interpolation.
* @param[in] t A progress value between 0 and 1
* @return The interpolated quaternion
*/
- static Quaternion Squad( const Quaternion& start, const Quaternion& end, const Quaternion& ctrl1, const Quaternion& ctrl2, float t );
+ static Quaternion Squad(const Quaternion& start, const Quaternion& end, const Quaternion& ctrl1, const Quaternion& ctrl2, float t);
/**
* @brief Returns the shortest angle between two quaternions in Radians.
* @param[in] q2 The second quaternion
* @return The angle between the two quaternions
*/
- static float AngleBetween( const Quaternion& q1, const Quaternion& q2 );
+ static float AngleBetween(const Quaternion& q1, const Quaternion& q2);
/**
* @brief Rotates v by this Quaternion (Quaternion must be unit).
* @param[in] vector A vector to rotate
* @return The rotated vector
*/
- Vector4 Rotate( const Vector4& vector ) const;
+ Vector4 Rotate(const Vector4& vector) const;
/**
* @brief Rotates v by this Quaternion (Quaternion must be unit).
* @param[in] vector A vector to rotate
* @return The rotated vector
*/
- Vector3 Rotate( const Vector3& vector ) const;
+ Vector3 Rotate(const Vector3& vector) const;
private:
-
/// @cond internal
/**
* @brief Sets the quaternion from 3 orthonormal axes.
* @param[in] yAxis The Y axis
* @param[in] zAxis The Z axis
*/
- DALI_INTERNAL void SetFromAxes( const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis );
+ DALI_INTERNAL void SetFromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis);
/// @endcond
public:
-
- Quaternion( const Quaternion& ) = default; ///< Default copy constructor
- Quaternion( Quaternion&& ) = default; ///< Default move constructor
- Quaternion& operator=( const Quaternion& ) = default; ///< Default copy assignment operator
- Quaternion& operator=( Quaternion&& ) = default; ///< Default move assignment operator
+ Quaternion(const Quaternion&) = default; ///< Default copy constructor
+ Quaternion(Quaternion&&) = default; ///< Default move constructor
+ Quaternion& operator=(const Quaternion&) = default; ///< Default copy assignment operator
+ Quaternion& operator=(Quaternion&&) = default; ///< Default move assignment operator
public:
-
- Vector4 mVector; ///< w component is s ( = cos(theta/2.0) )
+ Vector4 mVector; ///< w component is s ( = cos(theta/2.0) )
};
/**
* @param[in] quaternion The quaternion to print
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Quaternion& quaternion);
+DALI_CORE_API std::ostream& operator<<(std::ostream& o, const Quaternion& quaternion);
// Allow Quaternion to be treated as a POD type
-template <> struct TypeTraits< Quaternion > : public BasicTypes< Quaternion > { enum { IS_TRIVIAL_TYPE = true }; };
+template<>
+struct TypeTraits<Quaternion> : public BasicTypes<Quaternion>
+{
+ enum
+ {
+ IS_TRIVIAL_TYPE = true
+ };
+};
/**
* @}
// INTERNAL INCLUDES
#include <dali/public-api/common/constants.h>
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/degree.h>
+#include <dali/public-api/math/math-utils.h>
namespace Dali
{
* @SINCE_1_0.0
*/
Radian()
- : radian( 0.f )
- { }
+ : radian(0.f)
+ {
+ }
/**
* @brief Creates an angle in radians.
* @SINCE_1_0.0
* @param[in] value The initial value in radians
*/
- explicit constexpr Radian( float value )
- : radian( value )
- { }
+ explicit constexpr Radian(float value)
+ : radian(value)
+ {
+ }
/**
* @brief Creates an angle in radians from an angle in degrees.
* @SINCE_1_0.0
* @param[in] degree The initial value in degrees
*/
- Radian( Degree degree )
- : radian( degree.degree * Math::PI_OVER_180 )
- { }
+ Radian(Degree degree)
+ : radian(degree.degree * Math::PI_OVER_180)
+ {
+ }
/**
* @brief Assigns an angle from a float value.
* @param[in] value Float value in radians
* @return A reference to this
*/
- Radian& operator=( float value )
+ Radian& operator=(float value)
{
radian = value;
return *this;
* @param[in] degree The value in degrees
* @return A reference to this
*/
- Radian& operator=( Degree degree )
+ Radian& operator=(Degree degree)
{
radian = degree.degree * Math::PI_OVER_180;
return *this;
}
public:
-
- Radian( const Radian& ) = default; ///< Default copy constructor
- Radian( Radian&& ) = default; ///< Default move constructor
- Radian& operator=( const Radian& ) = default; ///< Default copy assignment operator
- Radian& operator=( Radian&& ) = default; ///< Default move assignment operator
+ Radian(const Radian&) = default; ///< Default copy constructor
+ Radian(Radian&&) = default; ///< Default move constructor
+ Radian& operator=(const Radian&) = default; ///< Default copy assignment operator
+ Radian& operator=(Radian&&) = default; ///< Default move assignment operator
public:
-
// member data
float radian; ///< The value in radians
-
};
// compiler generated destructor, copy constructor and assignment operators are ok as this class is POD
* @param[in] rhs Radian to compare to
* @return True if the values are identical
*/
-inline bool operator==( Radian lhs, Radian rhs )
+inline bool operator==(Radian lhs, Radian rhs)
{
- return fabsf( lhs.radian - rhs.radian ) < Math::MACHINE_EPSILON_10; // expect Radian angles to be between 0 and 10 (multiplies of Math::PI)
+ return fabsf(lhs.radian - rhs.radian) < Math::MACHINE_EPSILON_10; // expect Radian angles to be between 0 and 10 (multiplies of Math::PI)
}
/**
* @param[in] rhs Radian to compare to
* @return True if the values are not identical
*/
-inline bool operator!=( Radian lhs, Radian rhs )
+inline bool operator!=(Radian lhs, Radian rhs)
{
- return !( operator==( lhs, rhs ) );
+ return !(operator==(lhs, rhs));
}
/**
* @param[in] rhs Degree to compare to
* @return True if the values are identical
*/
-inline bool operator==( Radian lhs, Degree rhs )
+inline bool operator==(Radian lhs, Degree rhs)
{
- return fabsf( lhs.radian - Radian( rhs ).radian ) < Math::MACHINE_EPSILON_100; // expect Degree angles to be between 0 and 999
+ return fabsf(lhs.radian - Radian(rhs).radian) < Math::MACHINE_EPSILON_100; // expect Degree angles to be between 0 and 999
}
/**
* @param[in] rhs Degree to compare to
* @return True if the values are not identical
*/
-inline bool operator!=( Radian lhs, Degree rhs )
+inline bool operator!=(Radian lhs, Degree rhs)
{
- return !( operator==( lhs, rhs ) );
+ return !(operator==(lhs, rhs));
}
/**
* @param[in] rhs Radian to compare to
* @return True if the values are identical
*/
-inline bool operator==( Degree lhs, Radian rhs )
+inline bool operator==(Degree lhs, Radian rhs)
{
- return fabsf( Radian( lhs ).radian - rhs.radian ) < Math::MACHINE_EPSILON_100; // expect Degree angles to be between 0 and 999
+ return fabsf(Radian(lhs).radian - rhs.radian) < Math::MACHINE_EPSILON_100; // expect Degree angles to be between 0 and 999
}
/**
* @param[in] rhs Radian to compare to
* @return True if the values are not identical
*/
-inline bool operator!=( Degree lhs, Radian rhs )
+inline bool operator!=(Degree lhs, Radian rhs)
{
- return !( operator==( lhs, rhs ) );
+ return !(operator==(lhs, rhs));
}
/**
* @param[in] rhs Radian to compare to
* @return True if lhs is greater than rhs
*/
-inline bool operator>( Radian lhs, Radian rhs )
+inline bool operator>(Radian lhs, Radian rhs)
{
return lhs.radian > rhs.radian;
}
* @param[in] rhs Degree to compare to
* @return True if lhs is greater than rhs
*/
-inline bool operator>( Radian lhs, Degree rhs )
+inline bool operator>(Radian lhs, Degree rhs)
{
return lhs.radian > Radian(rhs).radian;
}
* @param[in] rhs Degree to compare to
* @return True if lhs is greater than rhs
*/
-inline bool operator>( Degree lhs, Radian rhs )
+inline bool operator>(Degree lhs, Radian rhs)
{
return Radian(lhs).radian > rhs.radian;
}
* @param[in] rhs Radian to compare to
* @return True if lhs is less than rhs
*/
-inline bool operator<( Radian lhs, Radian rhs )
+inline bool operator<(Radian lhs, Radian rhs)
{
return lhs.radian < rhs.radian;
}
* @param[in] rhs Degree to compare to
* @return True if lhs is less than rhs
*/
-inline bool operator<( Radian lhs, Degree rhs )
+inline bool operator<(Radian lhs, Degree rhs)
{
return lhs.radian < Radian(rhs).radian;
}
* @param[in] rhs Radian to compare to
* @return True if lhs is less than rhs
*/
-inline bool operator<( Degree lhs, Radian rhs )
+inline bool operator<(Degree lhs, Radian rhs)
{
return Radian(lhs).radian < rhs.radian;
}
* @param[in] rhs float to multiply
* @return Result of the multiplication
*/
-inline Radian operator*( Radian lhs, float rhs )
+inline Radian operator*(Radian lhs, float rhs)
{
- return Radian( lhs.radian * rhs );
+ return Radian(lhs.radian * rhs);
}
/**
* @param[in] in Radian to negate
* @return The negative angle
*/
-inline Radian operator-( Radian in )
+inline Radian operator-(Radian in)
{
- return Radian( -in.radian );
+ return Radian(-in.radian);
}
/**
* @param max value
* @return The resulting radian
*/
-inline Radian Clamp( Radian angle, float min, float max )
+inline Radian Clamp(Radian angle, float min, float max)
{
- return Radian( Clamp<float>( angle.radian, min, max ) );
+ return Radian(Clamp<float>(angle.radian, min, max));
}
// useful constant angles
-inline constexpr Radian ANGLE_360( Math::PI * 2.f );
-inline constexpr Radian ANGLE_315( Math::PI * 1.75f );
-inline constexpr Radian ANGLE_270( Math::PI * 1.5f );
-inline constexpr Radian ANGLE_225( Math::PI * 1.25f );
-inline constexpr Radian ANGLE_180( Math::PI );
-inline constexpr Radian ANGLE_135( Math::PI * 0.75f );
-inline constexpr Radian ANGLE_120( Math::PI * 2.f/3.f );
-inline constexpr Radian ANGLE_90 ( Math::PI_2 );
-inline constexpr Radian ANGLE_60 ( Math::PI / 3.f );
-inline constexpr Radian ANGLE_45 ( Math::PI_4 );
-inline constexpr Radian ANGLE_30 ( Math::PI / 6.f );
-inline constexpr Radian ANGLE_0 ( 0.0f );
+inline constexpr Radian ANGLE_360(Math::PI * 2.f);
+inline constexpr Radian ANGLE_315(Math::PI * 1.75f);
+inline constexpr Radian ANGLE_270(Math::PI * 1.5f);
+inline constexpr Radian ANGLE_225(Math::PI * 1.25f);
+inline constexpr Radian ANGLE_180(Math::PI);
+inline constexpr Radian ANGLE_135(Math::PI * 0.75f);
+inline constexpr Radian ANGLE_120(Math::PI * 2.f / 3.f);
+inline constexpr Radian ANGLE_90(Math::PI_2);
+inline constexpr Radian ANGLE_60(Math::PI / 3.f);
+inline constexpr Radian ANGLE_45(Math::PI_4);
+inline constexpr Radian ANGLE_30(Math::PI / 6.f);
+inline constexpr Radian ANGLE_0(0.0f);
/**
* @}
#define DALI_RANDOM_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
namespace Random
{
-
/**
* @brief Returns a random number between f0 and f1.
*
// Ensure we initialize only once. As it's inlined, this static variable will exist in the code-block using it, thus,
// will be created and then initialized again when another code-block uses this.
- static bool initialized( false );
- if( !initialized )
+ static bool initialized(false);
+ if(!initialized)
{
- uint32_t seed = static_cast<uint32_t>( time( nullptr ) );
- srand( seed );
+ uint32_t seed = static_cast<uint32_t>(time(nullptr));
+ srand(seed);
initialized = true;
}
int32_t randValue = rand();
- return static_cast<float>(randValue & 0xfff) * (1.0f/4095.0f) * (max-min) + min;
+ return static_cast<float>(randValue & 0xfff) * (1.0f / 4095.0f) * (max - min) + min;
}
/**
do
{
axis.x = Range(-1.0f, 1.0f);
- axis.y = Range( 0.0f, 1.0f);
- axis.z = Range( 0.0f, 1.0f);
+ axis.y = Range(0.0f, 1.0f);
+ axis.z = Range(0.0f, 1.0f);
axis.w = 0.0f;
- } while (axis == Vector4::ZERO);
+ } while(axis == Vector4::ZERO);
axis.Normalize();
return axis;
}
// Ensure Rect is maintained as a trivially copyable type
static_assert(std::is_trivially_copyable<Rect<float>>::value);
} // namespace Dali
-
* @brief Template class to create and operate on rectangles.
* @SINCE_1_0.0
*/
-template< typename T = float >
+template<typename T = float>
struct Rect
{
-// Methods
+ // Methods
/**
* @brief Constructor.
* @SINCE_1_9.14
* @param[in] vec4 Vector4 to convert from
*/
- Rect( const Vector4& vec4 )
+ Rect(const Vector4& vec4)
: x(vec4.x),
y(vec4.y),
width(vec4.z),
* @SINCE_1_9.27
* @param[in] rhs The original object
*/
- Rect( const Rect<T>& rhs ) = default;
+ Rect(const Rect<T>& rhs) = default;
/**
* @brief Default copy assignment operator.
* @param[in] rhs The original object
* @return Reference to this
*/
- Rect<T>& operator=( const Rect<T>& rhs ) = default;
+ Rect<T>& operator=(const Rect<T>& rhs) = default;
/**
* @brief Default move constructor.
* @SINCE_1_9.27
* @param[in] rhs The original object
*/
- Rect<T>( Rect<T>&& rhs ) = default;
+ Rect<T>(Rect<T>&& rhs) = default;
/**
* @brief Default move assignment operator.
* @param[in] rhs The original object
* @return Reference to this
*/
- Rect<T>& operator=( Rect<T>&& rhs ) = default;
+ Rect<T>& operator=(Rect<T>&& rhs) = default;
/**
* @brief Assignment operator.
*/
Rect<T>& operator=(const Vector4& vec4)
{
- x = vec4.x;
- y = vec4.y;
- width = vec4.z;
+ x = vec4.x;
+ y = vec4.y;
+ width = vec4.z;
height = vec4.w;
return *this;
*/
void Set(T newX, T newY, T newWidth, T newHeight)
{
- x = newX;
- y = newY;
- width = newWidth;
+ x = newX;
+ y = newY;
+ width = newWidth;
height = newHeight;
}
*/
bool IsEmpty() const
{
- return width == 0 ||
- height == 0;
+ return width == 0 ||
+ height == 0;
}
/**
bool Intersects(const Rect<T>& other) const
{
return (other.x + other.width) > x && other.x < (x + width) &&
- (other.y + other.height) > y && other.y < (y + height);
+ (other.y + other.height) > y && other.y < (y + height);
}
/**
*/
bool Intersect(const Rect<T>& rect)
{
- const int left = std::max(rect.x, x);
- const int top = std::max(rect.y, y);
- const int right = std::min(rect.x + rect.width, x + width);
+ const int left = std::max(rect.x, x);
+ const int top = std::max(rect.y, y);
+ const int right = std::min(rect.x + rect.width, x + width);
const int bottom = std::min(rect.y + rect.height, y + height);
- const int width = right - left;
+ const int width = right - left;
const int height = bottom - top;
- if (!(width < 0 || height < 0))
+ if(!(width < 0 || height < 0))
{
- x = left;
- y = top;
- this->width = width;
+ x = left;
+ y = top;
+ this->width = width;
this->height = height;
return true;
}
*/
void Merge(const Rect<T>& rect)
{
- const int left = std::min(rect.x, x);
- const int top = std::min(rect.y, y);
- const int right = std::max(rect.x + rect.width, x + width);
+ const int left = std::min(rect.x, x);
+ const int top = std::min(rect.y, y);
+ const int right = std::max(rect.x + rect.width, x + width);
const int bottom = std::max(rect.y + rect.height, y + height);
- x = left;
- y = top;
- width = right - left;
- height = bottom - top;
+ x = left;
+ y = top;
+ width = right - left;
+ height = bottom - top;
}
/**
*/
void Inset(T dx, T dy)
{
- const int left = x - dx;
- const int top = y - dy;
- const int right = x + width + dx;
+ const int left = x - dx;
+ const int top = y - dy;
+ const int right = x + width + dx;
const int bottom = y + height + dy;
- x = left;
- y = top;
- width = right - left;
- height = bottom - top;
+ x = left;
+ y = top;
+ width = right - left;
+ height = bottom - top;
}
/**
*/
bool Contains(const Rect<T>& other) const
{
- return other.x >= x && (other.x + other.width) <= (x + width) &&
- other.y >= y && (other.y + other.height) <= (y + height);
+ return other.x >= x && (other.x + other.width) <= (x + width) &&
+ other.y >= y && (other.y + other.height) <= (y + height);
}
-public: // Data
-
+public: // Data
union
{
- T x; ///< X position of the rectangle
- T left; ///< The left value
+ T x; ///< X position of the rectangle
+ T left; ///< The left value
};
union
{
- T y; ///< Y position of the rectangle
- T right; ///< The right value
+ T y; ///< Y position of the rectangle
+ T right; ///< The right value
};
union
* @param[in] rhs Second operand
* @return True if boxes are exactly same
*/
-template< typename T >
-inline bool operator==( const Rect<T>& lhs, const Rect<T>& rhs )
+template<typename T>
+inline bool operator==(const Rect<T>& lhs, const Rect<T>& rhs)
{
- return ( lhs.x == rhs.x )&&
- ( lhs.y == rhs.y )&&
- ( lhs.width == rhs.width )&&
- ( lhs.height == rhs.height );
+ return (lhs.x == rhs.x) &&
+ (lhs.y == rhs.y) &&
+ (lhs.width == rhs.width) &&
+ (lhs.height == rhs.height);
}
/**
* @param[in] rhs The second rectangle
* @return True if rectangles are not identical
*/
-template< typename T >
-inline bool operator!=( const Rect<T>& lhs, const Rect<T>& rhs )
+template<typename T>
+inline bool operator!=(const Rect<T>& lhs, const Rect<T>& rhs)
{
return !(lhs == rhs);
}
* @return True if rectangles are exactly same
*/
template<>
-inline bool operator==( const Rect<float>& lhs, const Rect<float>& rhs )
+inline bool operator==(const Rect<float>& lhs, const Rect<float>& rhs)
{
- return ( fabsf( lhs.x - rhs.x ) < GetRangedEpsilon(lhs.x, rhs.x) )&&
- ( fabsf( lhs.y - rhs.y ) < GetRangedEpsilon(lhs.y, rhs.y) )&&
- ( fabsf( lhs.width - rhs.width ) < GetRangedEpsilon(lhs.width, rhs.width) )&&
- ( fabsf( lhs.height - rhs.height ) < GetRangedEpsilon(lhs.height, rhs.height) );
+ return (fabsf(lhs.x - rhs.x) < GetRangedEpsilon(lhs.x, rhs.x)) &&
+ (fabsf(lhs.y - rhs.y) < GetRangedEpsilon(lhs.y, rhs.y)) &&
+ (fabsf(lhs.width - rhs.width) < GetRangedEpsilon(lhs.width, rhs.width)) &&
+ (fabsf(lhs.height - rhs.height) < GetRangedEpsilon(lhs.height, rhs.height));
}
/**
template<>
inline bool Rect<float>::IsEmpty() const
{
- return (fabsf(width) <= GetRangedEpsilon(width, width)
- ||
+ return (fabsf(width) <= GetRangedEpsilon(width, width) ||
fabsf(height) <= GetRangedEpsilon(height, height));
}
* @param[in] rectangle the rectangle to output
* @return The output stream operator
*/
-template< typename T >
-inline std::ostream& operator<< (std::ostream& stream, const Rect<T>& rectangle)
+template<typename T>
+inline std::ostream& operator<<(std::ostream& stream, const Rect<T>& rectangle)
{
return stream << "[" << rectangle.x << ", " << rectangle.y << ", " << rectangle.width << ", " << rectangle.height << "]";
}
* @brief Default constructor for the (0, 0) tuple.
* @SINCE_1_0.0
*/
- Uint16Pair() : mData(0) {}
+ Uint16Pair()
+ : mData(0)
+ {
+ }
/**
* @brief Constructor taking separate x and y (width and height) parameters.
* @param[in] width The width or X dimension of the tuple. Make sure it is less than 65536
* @param[in] height The height or Y dimension of the tuple. Make sure it is less than 65536
*/
- Uint16Pair( uint32_t width, uint32_t height )
+ Uint16Pair(uint32_t width, uint32_t height)
{
- DALI_ASSERT_DEBUG( width < ( 1u << 16 ) && "Width parameter not representable." );
- DALI_ASSERT_DEBUG( height < ( 1u << 16 ) && "Height parameter not representable." );
+ DALI_ASSERT_DEBUG(width < (1u << 16) && "Width parameter not representable.");
+ DALI_ASSERT_DEBUG(height < (1u << 16) && "Height parameter not representable.");
/* Do equivalent of the code below with one aligned memory access:
* mComponents[0] = width;
* @SINCE_1_1.13
* @param[in] width The x dimension to be stored in this 2-tuple
*/
- void SetWidth( uint16_t width )
+ void SetWidth(uint16_t width)
{
mComponents[0] = width;
}
* @SINCE_1_1.13
* @param[in] height The y dimension to be stored in this 2-tuple
*/
- void SetHeight( uint16_t height )
+ void SetHeight(uint16_t height)
{
mComponents[1] = height;
}
* @SINCE_1_1.14
* @param[in] x The x dimension to be stored in this 2-tuple
*/
- void SetX( uint16_t x )
+ void SetX(uint16_t x)
{
mComponents[0] = x;
}
* @SINCE_1_0.0
* @return X
*/
- uint16_t GetX() const
+ uint16_t GetX() const
{
return mComponents[0];
}
* @SINCE_1_1.14
* @param[in] y The y dimension to be stored in this 2-tuple
*/
- void SetY( uint16_t y )
+ void SetY(uint16_t y)
{
mComponents[1] = y;
}
* @param[in] rhs A reference for comparison
* @return True if same
*/
- bool operator==( const Uint16Pair& rhs ) const
+ bool operator==(const Uint16Pair& rhs) const
{
return mData == rhs.mData;
}
* @param[in] rhs A reference for comparison
* @return True if different
*/
- bool operator!=( const Uint16Pair& rhs ) const
+ bool operator!=(const Uint16Pair& rhs) const
{
return mData != rhs.mData;
}
* @param[in] rhs A reference for comparison
* @return True if less
*/
- bool operator<( const Uint16Pair& rhs ) const
+ bool operator<(const Uint16Pair& rhs) const
{
return mData < rhs.mData;
}
* @param[in] rhs A reference for comparison
* @return True if greater
*/
- bool operator>( const Uint16Pair& rhs ) const
+ bool operator>(const Uint16Pair& rhs) const
{
return mData > rhs.mData;
}
* @return Closest integer value
*/
template<typename FLOAT_VECTOR_N_TYPE>
- static Uint16Pair FromFloatVec2( const FLOAT_VECTOR_N_TYPE& from )
+ static Uint16Pair FromFloatVec2(const FLOAT_VECTOR_N_TYPE& from)
{
- DALI_ASSERT_DEBUG( from.x + 0.5f < 65536.0f );
- DALI_ASSERT_DEBUG( from.y + 0.5f < 65536.0f );
- return Uint16Pair( from.x + 0.5f, from.y + 0.5f );
+ DALI_ASSERT_DEBUG(from.x + 0.5f < 65536.0f);
+ DALI_ASSERT_DEBUG(from.y + 0.5f < 65536.0f);
+ return Uint16Pair(from.x + 0.5f, from.y + 0.5f);
}
/**
* @return Closest integer value
*/
template<typename FLOAT_ARRAY>
- static Uint16Pair FromFloatArray( const FLOAT_ARRAY& from )
+ static Uint16Pair FromFloatArray(const FLOAT_ARRAY& from)
{
- DALI_ASSERT_DEBUG( from[0] + 0.5f < 65536.0f );
- DALI_ASSERT_DEBUG( from[1] + 0.5f < 65536.0f );
- return Uint16Pair( from[0] + 0.5f, from[1] + 0.5f );
+ DALI_ASSERT_DEBUG(from[0] + 0.5f < 65536.0f);
+ DALI_ASSERT_DEBUG(from[1] + 0.5f < 65536.0f);
+ return Uint16Pair(from[0] + 0.5f, from[1] + 0.5f);
}
public:
-
- Uint16Pair( const Uint16Pair& ) = default; ///< Default copy constructor
- Uint16Pair( Uint16Pair&& ) = default; ///< Default move constructor
- Uint16Pair& operator=( const Uint16Pair& ) = default; ///< Default copy assignment operator
- Uint16Pair& operator=( Uint16Pair&& ) = default; ///< Default move assignment operator
+ Uint16Pair(const Uint16Pair&) = default; ///< Default copy constructor
+ Uint16Pair(Uint16Pair&&) = default; ///< Default move constructor
+ Uint16Pair& operator=(const Uint16Pair&) = default; ///< Default copy assignment operator
+ Uint16Pair& operator=(Uint16Pair&&) = default; ///< Default move assignment operator
private:
union
};
// Allow Uint16Pair to be treated as a POD type
-template <> struct TypeTraits< Uint16Pair > : public BasicTypes< Uint16Pair > { enum { IS_TRIVIAL_TYPE = true }; };
+template<>
+struct TypeTraits<Uint16Pair> : public BasicTypes<Uint16Pair>
+{
+ enum
+ {
+ IS_TRIVIAL_TYPE = true
+ };
+};
/**
* @}
#include <ostream>
// INTERNAL INCLUDES
+#include <dali/internal/render/common/performance-monitor.h>
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/uint-16-pair.h>
-#include <dali/internal/render/common/performance-monitor.h>
+#include <dali/public-api/math/vector3.h>
namespace Dali
{
-
const Vector2 Vector2::ONE(1.0f, 1.0f);
const Vector2 Vector2::XAXIS(1.0f, 0.0f);
const Vector2 Vector2::YAXIS(0.0f, 1.0f);
return *this;
}
-
bool Vector2::operator==(const Vector2& rhs) const
{
- if (fabsf(x - rhs.x) > GetRangedEpsilon(x, rhs.x))
+ if(fabsf(x - rhs.x) > GetRangedEpsilon(x, rhs.x))
{
return false;
}
- if (fabsf(y - rhs.y) > GetRangedEpsilon(y, rhs.y))
+ if(fabsf(y - rhs.y) > GetRangedEpsilon(y, rhs.y))
{
return false;
}
float Vector2::LengthSquared() const
{
- return (x*x) + (y*y);
+ return (x * x) + (y * y);
}
void Vector2::Normalize()
{
float length = Length();
- if( ! EqualsZero(length) )
+ if(!EqualsZero(length))
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,2);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 2);
const float inverseLength = 1.0f / length;
x *= inverseLength;
}
}
-void Vector2::Clamp( const Vector2& min, const Vector2& max )
+void Vector2::Clamp(const Vector2& min, const Vector2& max)
{
- Dali::ClampInPlace<float>( x, min.x, max.x );
- Dali::ClampInPlace<float>( y, min.y, max.y );
+ Dali::ClampInPlace<float>(x, min.x, max.x);
+ Dali::ClampInPlace<float>(y, min.y, max.y);
}
-std::ostream& operator<< (std::ostream& o, const Vector2& vector)
+std::ostream& operator<<(std::ostream& o, const Vector2& vector)
{
return o << "[" << vector.x << ", " << vector.y << "]";
}
-Vector2 Clamp( const Vector2& v, const float& min, const float& max )
+Vector2 Clamp(const Vector2& v, const float& min, const float& max)
{
- Vector2 result( v );
- result.Clamp( Vector2( min, min ) , Vector2( max, max ) );
+ Vector2 result(v);
+ result.Clamp(Vector2(min, min), Vector2(max, max));
return result;
}
namespace Dali
{
-
class Uint16Pair;
/**
*/
struct DALI_CORE_API Vector2
{
-// (x width) and (y height) must be consecutive in memory.
-// No other data must be added before (x width) member.
-// No virtual methods must be added to this struct.
+ // (x width) and (y height) must be consecutive in memory.
+ // No other data must be added before (x width) member.
+ // No virtual methods must be added to this struct.
public:
-
/**
* @brief Constructor.
* @SINCE_1_0.0
* @param[in] y y or height component
*/
explicit constexpr Vector2(float x, float y)
- : x(x), y(y)
+ : x(x),
+ y(y)
{
}
*/
Vector2(const Uint16Pair& pair);
-// Constants
+ // Constants
- static const Vector2 ONE; ///< (1.0f,1.0f)
- static const Vector2 XAXIS; ///< Vector representing the X axis
- static const Vector2 YAXIS; ///< Vector representing the Y axis
- static const Vector2 NEGATIVE_XAXIS; ///< Vector representing the negative X axis
- static const Vector2 NEGATIVE_YAXIS; ///< Vector representing the negative Y axis
- static const Vector2 ZERO; ///< (0.0f, 0.0f)
+ static const Vector2 ONE; ///< (1.0f,1.0f)
+ static const Vector2 XAXIS; ///< Vector representing the X axis
+ static const Vector2 YAXIS; ///< Vector representing the Y axis
+ static const Vector2 NEGATIVE_XAXIS; ///< Vector representing the negative X axis
+ static const Vector2 NEGATIVE_YAXIS; ///< Vector representing the negative Y axis
+ static const Vector2 ZERO; ///< (0.0f, 0.0f)
-// API
+ // API
/**
* @brief Assignment operator.
return Vector2(x / rhs, y / rhs);
}
-
/**
* @brief Division assignment operator.
*
*/
const float& operator[](const uint32_t index) const
{
- DALI_ASSERT_ALWAYS( index < 2 && "Vector element index out of bounds" );
+ DALI_ASSERT_ALWAYS(index < 2 && "Vector element index out of bounds");
return AsFloat()[index];
}
*/
float& operator[](const uint32_t index)
{
- DALI_ASSERT_ALWAYS( index < 2 && "Vector element index out of bounds" );
+ DALI_ASSERT_ALWAYS(index < 2 && "Vector element index out of bounds");
return AsFloat()[index];
}
* @param[in] min The minimum vector
* @param[in] max The maximum vector
*/
- void Clamp( const Vector2& min, const Vector2& max );
+ void Clamp(const Vector2& min, const Vector2& max);
/**
* @brief Returns the contents of the vector as an array of 2 floats.
* @return The vector contents as an array of 2 floats
* @note inlined for performance reasons (generates less code than a function call)
*/
- const float* AsFloat() const {return &x;}
+ const float* AsFloat() const
+ {
+ return &x;
+ }
/**
* @brief Returns the contents of the vector as an array of 2 floats.
* @return The vector contents as an array of 2 floats
* @note inlined for performance reasons (generates less code than a function call)
*/
- float* AsFloat() {return &x;}
+ float* AsFloat()
+ {
+ return &x;
+ }
public:
-
- Vector2( const Vector2& ) = default; ///< Default copy constructor
- Vector2( Vector2&& ) = default; ///< Default move constructor
- Vector2& operator=( const Vector2& ) = default; ///< Default copy assignment operator
- Vector2& operator=( Vector2&& ) = default; ///< Default move assignment operator
+ Vector2(const Vector2&) = default; ///< Default copy constructor
+ Vector2(Vector2&&) = default; ///< Default move constructor
+ Vector2& operator=(const Vector2&) = default; ///< Default copy assignment operator
+ Vector2& operator=(Vector2&&) = default; ///< Default move assignment operator
public: // Data
-
// NOTE
// (x width) and (y height) must be consecutive in memory.
// No other data must be added before (x width) member.
float y; ///< y component
float height; ///< height
};
-
};
/**
* @param[in] vector The vector to print
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Vector2& vector);
+DALI_CORE_API std::ostream& operator<<(std::ostream& o, const Vector2& vector);
/**
* @brief Returns a vector with components set to the minimum of the corresponding component in a and b.
* @param[in] b A vector
* @return A vector containing the minimum of each component from a and b
*/
-inline Vector2 Min( const Vector2& a, const Vector2& b )
+inline Vector2 Min(const Vector2& a, const Vector2& b)
{
- return Vector2( a.x < b.x ? a.x : b.x , a.y < b.y ? a.y : b.y );
+ return Vector2(a.x < b.x ? a.x : b.x, a.y < b.y ? a.y : b.y);
}
/**
* @param[in] b A vector
* @return A vector containing the maximum of each component from a and b
*/
-inline Vector2 Max( const Vector2& a, const Vector2& b )
+inline Vector2 Max(const Vector2& a, const Vector2& b)
{
- return Vector2( a.x > b.x ? a.x : b.x , a.y > b.y ? a.y : b.y );
+ return Vector2(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y);
}
/**
* @param[in] max The maximum value
* @return A vector containing the clamped components of v
*/
-DALI_CORE_API Vector2 Clamp( const Vector2& v, const float& min, const float& max );
+DALI_CORE_API Vector2 Clamp(const Vector2& v, const float& min, const float& max);
// Allow Vector2 to be treated as a POD type
-template <> struct TypeTraits< Vector2 > : public BasicTypes< Vector2 > { enum { IS_TRIVIAL_TYPE = true }; };
+template<>
+struct TypeTraits<Vector2> : public BasicTypes<Vector2>
+{
+ enum
+ {
+ IS_TRIVIAL_TYPE = true
+ };
+};
/**
* @}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// CLASS HEADER
-#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/quaternion.h>
+#include <dali/public-api/math/vector3.h>
// EXTERNAL INCLUDES
#include <math.h>
#include <ostream>
// INTERNAL INCLUDES
+#include <dali/internal/render/common/performance-monitor.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/math-utils.h>
-#include <dali/internal/render/common/performance-monitor.h>
namespace Dali
{
const Vector3 Vector3::NEGATIVE_ZAXIS(0.0f, 0.0f, -1.0f);
const Vector3 Vector3::ZERO(0.0f, 0.0f, 0.0f);
-Vector3::Vector3( const Vector2& vec2 )
+Vector3::Vector3(const Vector2& vec2)
: x(vec2.x),
y(vec2.y),
z(0.0f)
{
}
-Vector3::Vector3( const Vector4& vec4 )
+Vector3::Vector3(const Vector4& vec4)
: x(vec4.x),
y(vec4.y),
z(vec4.z)
// nVidia SDK implementation
Vector3 qvec(rhs.mVector.x, rhs.mVector.y, rhs.mVector.z);
- Vector3 uv( (qvec.y * z) - (qvec.z * y),
- (qvec.z * x) - (qvec.x * z),
- (qvec.x * y) - (qvec.y * x) );
+ Vector3 uv((qvec.y * z) - (qvec.z * y),
+ (qvec.z * x) - (qvec.x * z),
+ (qvec.x * y) - (qvec.y * x));
- Vector3 uuv( (qvec.y * uv.z) - (qvec.z * uv.y),
- (qvec.z * uv.x) - (qvec.x * uv.z),
- (qvec.x * uv.y) - (qvec.y * uv.x) );
+ Vector3 uuv((qvec.y * uv.z) - (qvec.z * uv.y),
+ (qvec.z * uv.x) - (qvec.x * uv.z),
+ (qvec.x * uv.y) - (qvec.y * uv.x));
uv *= rhs.mVector.w;
bool Vector3::operator==(const Vector3& rhs) const
{
- if (fabsf(x - rhs.x) > GetRangedEpsilon(x, rhs.x) )
+ if(fabsf(x - rhs.x) > GetRangedEpsilon(x, rhs.x))
{
return false;
}
- if (fabsf(y - rhs.y) > GetRangedEpsilon(y, rhs.y) )
+ if(fabsf(y - rhs.y) > GetRangedEpsilon(y, rhs.y))
{
return false;
}
- if (fabsf(z - rhs.z) > GetRangedEpsilon(z, rhs.z) )
+ if(fabsf(z - rhs.z) > GetRangedEpsilon(z, rhs.z))
{
return false;
}
return true;
}
-float Vector3::Dot(const Vector3 &other) const
+float Vector3::Dot(const Vector3& other) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
return x * other.x + y * other.y + z * other.z;
}
-Vector3 Vector3::Cross(const Vector3 &other) const
+Vector3 Vector3::Cross(const Vector3& other) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,6);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 6);
- return Vector3( (y * other.z) - (z * other.y),
- (z * other.x) - (x * other.z),
- (x * other.y) - (y * other.x));
+ return Vector3((y * other.z) - (z * other.y),
+ (z * other.x) - (x * other.z),
+ (x * other.y) - (y * other.x));
}
float Vector3::Length() const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
- return sqrtf(x*x + y*y + z*z);
+ return sqrtf(x * x + y * y + z * z);
}
float Vector3::LengthSquared() const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
- return x*x + y*y + z*z;
+ return x * x + y * y + z * z;
}
void Vector3::Normalize()
{
float length = Length();
- if( ! EqualsZero(length) )
+ if(!EqualsZero(length))
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
const float inverseLength = 1.0f / length;
x *= inverseLength;
}
}
-void Vector3::Clamp( const Vector3& min, const Vector3& max )
+void Vector3::Clamp(const Vector3& min, const Vector3& max)
{
- Dali::ClampInPlace<float>( x, min.x, max.x );
- Dali::ClampInPlace<float>( y, min.y, max.y );
- Dali::ClampInPlace<float>( z, min.z, max.z );
+ Dali::ClampInPlace<float>(x, min.x, max.x);
+ Dali::ClampInPlace<float>(y, min.y, max.y);
+ Dali::ClampInPlace<float>(z, min.z, max.z);
}
-std::ostream& operator<< (std::ostream& o, const Vector3& vector)
+std::ostream& operator<<(std::ostream& o, const Vector3& vector)
{
return o << "[" << vector.x << ", " << vector.y << ", " << vector.z << "]";
}
-Vector3 Clamp( const Vector3& v, const float& min, const float& max )
+Vector3 Clamp(const Vector3& v, const float& min, const float& max)
{
- Vector3 result( v );
- result.Clamp( Vector3( min, min, min ) , Vector3( max, max, max ) );
+ Vector3 result(v);
+ result.Clamp(Vector3(min, min, min), Vector3(max, max, max));
return result;
}
*/
struct DALI_CORE_API Vector3
{
-// Construction
+ // Construction
/**
* @brief Constructor.
* @SINCE_1_0.0
* @param[in] vec2 Vector2 to create this vector from
*/
- explicit Vector3( const Vector2& vec2 );
+ explicit Vector3(const Vector2& vec2);
/**
* @brief Constructor.
* @SINCE_1_0.0
* @param[in] vec4 Vector4 to create this vector from
*/
- explicit Vector3( const Vector4& vec4 );
+ explicit Vector3(const Vector4& vec4);
-// Constants
+ // Constants
- static const Vector3 ONE; ///< (1.0f,1.0f,1.0f)
- static const Vector3 XAXIS; ///< Vector representing the X axis
- static const Vector3 YAXIS; ///< Vector representing the Y axis
- static const Vector3 ZAXIS; ///< Vector representing the Z axis
- static const Vector3 NEGATIVE_XAXIS; ///< Vector representing the negative X axis
- static const Vector3 NEGATIVE_YAXIS; ///< Vector representing the negative Y axis
- static const Vector3 NEGATIVE_ZAXIS; ///< Vector representing the negative Z axis
- static const Vector3 ZERO; ///< (0.0f, 0.0f, 0.0f)
+ static const Vector3 ONE; ///< (1.0f,1.0f,1.0f)
+ static const Vector3 XAXIS; ///< Vector representing the X axis
+ static const Vector3 YAXIS; ///< Vector representing the Y axis
+ static const Vector3 ZAXIS; ///< Vector representing the Z axis
+ static const Vector3 NEGATIVE_XAXIS; ///< Vector representing the negative X axis
+ static const Vector3 NEGATIVE_YAXIS; ///< Vector representing the negative Y axis
+ static const Vector3 NEGATIVE_ZAXIS; ///< Vector representing the negative Z axis
+ static const Vector3 ZERO; ///< (0.0f, 0.0f, 0.0f)
-// API
+ // API
/**
* @brief Assignment operator.
*/
const float& operator[](const uint32_t index) const
{
- DALI_ASSERT_ALWAYS( index < 3 && "Vector element index out of bounds" );
+ DALI_ASSERT_ALWAYS(index < 3 && "Vector element index out of bounds");
return AsFloat()[index];
}
*/
float& operator[](const uint32_t index)
{
- DALI_ASSERT_ALWAYS( index < 3 && "Vector element index out of bounds" );
+ DALI_ASSERT_ALWAYS(index < 3 && "Vector element index out of bounds");
return AsFloat()[index];
}
* @param[in] min The minimum vector
* @param[in] max The maximum vector
*/
- void Clamp( const Vector3& min, const Vector3& max );
+ void Clamp(const Vector3& min, const Vector3& max);
/**
* @brief Returns the contents of the vector as an array of 3 floats.
* @return The vector contents as an array of 3 floats
* @note inlined for performance reasons (generates less code than a function call)
*/
- const float* AsFloat() const {return &x;}
+ const float* AsFloat() const
+ {
+ return &x;
+ }
/**
* @brief Returns the contents of the vector as an array of 3 floats.
* @return The vector contents as an array of 3 floats
* @note inlined for performance reasons (generates less code than a function call)
*/
- float* AsFloat() {return &x;}
+ float* AsFloat()
+ {
+ return &x;
+ }
/**
* @brief Returns the x & y components (or width & height, or r & g) as a Vector2.
* @return The partial vector contents as Vector2 (x,y)
* @note inlined for performance reasons (generates less code than a function call)
*/
- const Vector2& GetVectorXY() const {return reinterpret_cast<const Vector2&>(x);}
+ const Vector2& GetVectorXY() const
+ {
+ return reinterpret_cast<const Vector2&>(x);
+ }
/**
* @brief Returns the x & y components (or width & height, or r & g) as a Vector2.
* @return The partial vector contents as Vector2 (x,y)
* @note inlined for performance reasons (generates less code than a function call)
*/
- Vector2& GetVectorXY() {return reinterpret_cast<Vector2&>(x);}
+ Vector2& GetVectorXY()
+ {
+ return reinterpret_cast<Vector2&>(x);
+ }
/**
* @brief Returns the y & z components (or height & depth, or g & b) as a Vector2.
* @return The partial vector contents as Vector2 (y,z)
* @note inlined for performance reasons (generates less code than a function call)
*/
- const Vector2& GetVectorYZ() const {return reinterpret_cast<const Vector2&>(y);}
+ const Vector2& GetVectorYZ() const
+ {
+ return reinterpret_cast<const Vector2&>(y);
+ }
/**
* @brief Returns the y & z components (or height & depth, or g & b) as a Vector2.
* @return The partial vector contents as Vector2 (y,z)
* @note inlined for performance reasons (generates less code than a function call)
*/
- Vector2& GetVectorYZ() {return reinterpret_cast<Vector2&>(y);}
+ Vector2& GetVectorYZ()
+ {
+ return reinterpret_cast<Vector2&>(y);
+ }
-// Data
+ // Data
// NOTE
// (x width r), (y height g), (z depth b) must be consecutive in memory.
// No virtual methods must be added to this struct.
union
{
- float x; ///< x component
- float width; ///< width component
- float r; ///< red component
+ float x; ///< x component
+ float width; ///< width component
+ float r; ///< red component
};
union
{
};
union
{
- float z; ///< z component
- float depth; ///< depth component
- float b; ///< blue component
+ float z; ///< z component
+ float depth; ///< depth component
+ float b; ///< blue component
};
public:
-
- Vector3( const Vector3& ) = default; ///< Default copy constructor
- Vector3( Vector3&& ) = default; ///< Default move constructor
- Vector3& operator=( const Vector3& ) = default; ///< Default copy assignment operator
- Vector3& operator=( Vector3&& ) = default; ///< Default move assignment operator
+ Vector3(const Vector3&) = default; ///< Default copy constructor
+ Vector3(Vector3&&) = default; ///< Default move constructor
+ Vector3& operator=(const Vector3&) = default; ///< Default copy assignment operator
+ Vector3& operator=(Vector3&&) = default; ///< Default move assignment operator
};
/**
* @param[in] vector The vector to print
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Vector3& vector);
+DALI_CORE_API std::ostream& operator<<(std::ostream& o, const Vector3& vector);
/**
* @brief Returns a vector with components set to the minimum of the corresponding component in a and b.
* @param[in] b A vector
* @return A vector containing the minimum of each component from a and b
*/
-inline Vector3 Min( const Vector3& a, const Vector3& b )
+inline Vector3 Min(const Vector3& a, const Vector3& b)
{
- return Vector3( a.x < b.x ? a.x : b.x ,
- a.y < b.y ? a.y : b.y,
- a.z < b.z ? a.z : b.z );
+ return Vector3(a.x < b.x ? a.x : b.x,
+ a.y < b.y ? a.y : b.y,
+ a.z < b.z ? a.z : b.z);
}
/**
* @param[in] b A vector
* @return A vector containing the maximum of each component from a and b
*/
-inline Vector3 Max( const Vector3& a, const Vector3& b )
+inline Vector3 Max(const Vector3& a, const Vector3& b)
{
- return Vector3( a.x > b.x ? a.x : b.x,
- a.y > b.y ? a.y : b.y,
- a.z > b.z ? a.z : b.z );
+ return Vector3(a.x > b.x ? a.x : b.x,
+ a.y > b.y ? a.y : b.y,
+ a.z > b.z ? a.z : b.z);
}
/**
* @param[in] max The maximum value
* @return A vector containing the clamped components of v
*/
-DALI_CORE_API Vector3 Clamp( const Vector3& v, const float& min, const float& max );
+DALI_CORE_API Vector3 Clamp(const Vector3& v, const float& min, const float& max);
// Allow Vector3 to be treated as a POD type
-template <> struct TypeTraits< Vector3 > : public BasicTypes< Vector3 > { enum { IS_TRIVIAL_TYPE = true }; };
+template<>
+struct TypeTraits<Vector3> : public BasicTypes<Vector3>
+{
+ enum
+ {
+ IS_TRIVIAL_TYPE = true
+ };
+};
/**
* @}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <ostream>
// INTERNAL INCLUDES
+#include <dali/internal/render/common/performance-monitor.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/math/math-utils.h>
-#include <dali/internal/render/common/performance-monitor.h>
namespace Dali
{
-
using Internal::PerformanceMonitor;
const Vector4 Vector4::ONE(1.0f, 1.0f, 1.0f, 1.0f);
const Vector4 Vector4::ZAXIS(0.0f, 0.0f, 1.0f, 0.0f);
const Vector4 Vector4::ZERO(0.0f, 0.0f, 0.0f, 0.0f);
-Vector4::Vector4( const Vector2& vec2 )
+Vector4::Vector4(const Vector2& vec2)
: x(vec2.x),
y(vec2.y),
z(0.0f),
{
}
-Vector4::Vector4( const Vector3& vec3 )
+Vector4::Vector4(const Vector3& vec3)
: x(vec3.x),
y(vec3.y),
z(vec3.z),
{
}
-Vector4& Vector4::operator=(const Vector2& vec2 )
+Vector4& Vector4::operator=(const Vector2& vec2)
{
x = vec2.x;
y = vec2.y;
return *this;
}
-Vector4& Vector4::operator=(const Vector3& vec3 )
+Vector4& Vector4::operator=(const Vector3& vec3)
{
x = vec3.x;
y = vec3.y;
return *this;
}
-
bool Vector4::operator==(const Vector4& rhs) const
{
- if (fabsf(x - rhs.x) > GetRangedEpsilon(x, rhs.x) )
+ if(fabsf(x - rhs.x) > GetRangedEpsilon(x, rhs.x))
{
return false;
}
- if (fabsf(y - rhs.y) > GetRangedEpsilon(y, rhs.y) )
+ if(fabsf(y - rhs.y) > GetRangedEpsilon(y, rhs.y))
{
return false;
}
- if (fabsf(z - rhs.z) > GetRangedEpsilon(z, rhs.z) )
+ if(fabsf(z - rhs.z) > GetRangedEpsilon(z, rhs.z))
{
return false;
}
- if (fabsf(w - rhs.w) > GetRangedEpsilon(w, rhs.w) )
+ if(fabsf(w - rhs.w) > GetRangedEpsilon(w, rhs.w))
{
return false;
}
return true;
}
-float Vector4::Dot(const Vector3 &other) const
+float Vector4::Dot(const Vector3& other) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
return x * other.x + y * other.y + z * other.z;
}
-float Vector4::Dot(const Vector4 &other) const
+float Vector4::Dot(const Vector4& other) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
return x * other.x + y * other.y + z * other.z;
}
-float Vector4::Dot4(const Vector4 &other) const
+float Vector4::Dot4(const Vector4& other) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,4);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 4);
return x * other.x + y * other.y + z * other.z + w * other.w;
}
-Vector4 Vector4::Cross(const Vector4 &other) const
+Vector4 Vector4::Cross(const Vector4& other) const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,6);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 6);
- return Vector4( (y * other.z) - (z * other.y),
- (z * other.x) - (x * other.z),
- (x * other.y) - (y * other.x),
- 0.0f);
+ return Vector4((y * other.z) - (z * other.y),
+ (z * other.x) - (x * other.z),
+ (x * other.y) - (y * other.x),
+ 0.0f);
}
// Will always return positive square root
float Vector4::Length() const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
- return sqrtf(x*x + y*y + z*z);
+ return sqrtf(x * x + y * y + z * z);
}
float Vector4::LengthSquared() const
{
- MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY,3);
+ MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
- return x*x + y*y + z*z;
+ return x * x + y * y + z * z;
}
void Vector4::Normalize()
const float length = Length();
// In the case where the length is exactly zero, the vector cannot be normalized.
- if ( ! EqualsZero( length ) )
+ if(!EqualsZero(length))
{
MATH_INCREASE_BY(PerformanceMonitor::FLOAT_POINT_MULTIPLY, 3);
}
}
-void Vector4::Clamp( const Vector4& min, const Vector4& max )
+void Vector4::Clamp(const Vector4& min, const Vector4& max)
{
- Dali::ClampInPlace<float>( x, min.x, max.x );
- Dali::ClampInPlace<float>( y, min.y, max.y );
- Dali::ClampInPlace<float>( z, min.z, max.z );
- Dali::ClampInPlace<float>( w, min.w, max.w );
+ Dali::ClampInPlace<float>(x, min.x, max.x);
+ Dali::ClampInPlace<float>(y, min.y, max.y);
+ Dali::ClampInPlace<float>(z, min.z, max.z);
+ Dali::ClampInPlace<float>(w, min.w, max.w);
}
-std::ostream& operator<< (std::ostream& o, const Vector4& vector)
+std::ostream& operator<<(std::ostream& o, const Vector4& vector)
{
return o << "[" << vector.x << ", " << vector.y << ", " << vector.z << ", " << vector.w << "]";
}
-Vector4 Clamp( const Vector4& v, const float& min, const float& max )
+Vector4 Clamp(const Vector4& v, const float& min, const float& max)
{
- Vector4 result( v );
- result.Clamp( Vector4( min, min, min, min ), Vector4( max, max, max, max) );
+ Vector4 result(v);
+ result.Clamp(Vector4(min, min, min, min), Vector4(max, max, max, max));
return result;
}
*/
struct DALI_CORE_API Vector4
{
-// NOTE
-// xrs, ygt, zbp and waq must be consecutive in memory.
-// No other data must be added before xrs member.
-// No virtual methods must be added to this struct.
+ // NOTE
+ // xrs, ygt, zbp and waq must be consecutive in memory.
+ // No other data must be added before xrs member.
+ // No virtual methods must be added to this struct.
-// Construction
+ // Construction
/**
* @brief Default constructor, initializes the vector to 0.
{
}
-
/**
* @brief Conversion constructor from an array of four floats.
*
* @SINCE_1_0.0
* @param[in] vec2 Vector2 to copy from, z and w are initialized to 0
*/
- explicit Vector4( const Vector2& vec2 );
+ explicit Vector4(const Vector2& vec2);
/**
* @brief Conversion constructor from Vector3.
* @SINCE_1_0.0
* @param[in] vec3 Vector3 to copy from, w is initialized to 0
*/
- explicit Vector4( const Vector3& vec3 );
+ explicit Vector4(const Vector3& vec3);
-// Constants
+ // Constants
static const Vector4 ONE; ///< (1.0f,1.0f,1.0f,1.0f)
static const Vector4 XAXIS; ///< (1.0f,0.0f,0.0f,0.0f)
static const Vector4 YAXIS; ///< (0.0f,1.0f,0.0f,0.0f)
static const Vector4 ZAXIS; ///< (0.0f,0.0f,1.0f,0.0f)
static const Vector4 ZERO; ///< (0.0f, 0.0f, 0.0f, 0.0f)
-// API
+ // API
/**
* @brief Assignment operator.
* @param[in] vec2 A reference to assign from
* @return Itself
*/
- Vector4& operator=(const Vector2& vec2 );
+ Vector4& operator=(const Vector2& vec2);
/**
* @brief Assignment operator.
* @param[in] vec3 A reference to assign from
* @return Itself
*/
- Vector4& operator=(const Vector3& vec3 );
+ Vector4& operator=(const Vector3& vec3);
/**
* @brief Addition operator.
* @param[in] rhs Vector to add
* @return A vector containing the result of the addition
*/
- Vector4 operator+(const Vector4 & rhs) const
+ Vector4 operator+(const Vector4& rhs) const
{
Vector4 temp(*this);
{
Vector4 temp(*this);
- temp-=rhs;
+ temp -= rhs;
return temp;
}
* @param[in] rhs The vector to divide
* @return A vector containing the result of the division
*/
- Vector4 operator/(const Vector4 & rhs) const
+ Vector4 operator/(const Vector4& rhs) const
{
Vector4 temp(*this);
* @param[in] rhs The vector to test against
* @return True if the vectors are equal
*/
- bool operator==(const Vector4 &rhs) const;
+ bool operator==(const Vector4& rhs) const;
/**
* @brief Inequality operator.
* @param[in] rhs The vector to test against
* @return True if the vectors are not equal
*/
- bool operator!=(const Vector4 &rhs) const
+ bool operator!=(const Vector4& rhs) const
{
return !(*this == rhs);
}
*/
const float& operator[](const uint32_t index) const
{
- DALI_ASSERT_ALWAYS( index < 4 && "Vector element index out of bounds" );
+ DALI_ASSERT_ALWAYS(index < 4 && "Vector element index out of bounds");
return AsFloat()[index];
}
*/
float& operator[](const uint32_t index)
{
- DALI_ASSERT_ALWAYS( index < 4 && "Vector element index out of bounds" );
+ DALI_ASSERT_ALWAYS(index < 4 && "Vector element index out of bounds");
return AsFloat()[index];
}
* @param[in] min The minimum vector
* @param[in] max The maximum vector
*/
- void Clamp( const Vector4& min, const Vector4& max );
+ void Clamp(const Vector4& min, const Vector4& max);
/**
* @brief Returns the contents of the vector as an array of 4 floats.
* @return The vector contents as an array of 4 floats
* @note inlined for performance reasons (generates less code than a function call)
*/
- const float* AsFloat() const {return &x;}
+ const float* AsFloat() const
+ {
+ return &x;
+ }
/**
* @brief Returns the contents of the vector as an array of 4 floats.
* @return The vector contents as an array of 4 floats
* @note inlined for performance reasons (generates less code than a function call)
*/
- float* AsFloat() {return &x;}
+ float* AsFloat()
+ {
+ return &x;
+ }
-// Data
+ // Data
// NOTE
// xrs, ygt, zbp and waq must be consecutive in memory.
};
public:
-
- Vector4( const Vector4& ) = default; ///< Default copy constructor
- Vector4( Vector4&& ) = default; ///< Default move constructor
- Vector4& operator=( const Vector4& ) = default; ///< Default copy assignment operator
- Vector4& operator=( Vector4&& ) = default; ///< Default move assignment operator
+ Vector4(const Vector4&) = default; ///< Default copy constructor
+ Vector4(Vector4&&) = default; ///< Default move constructor
+ Vector4& operator=(const Vector4&) = default; ///< Default copy assignment operator
+ Vector4& operator=(Vector4&&) = default; ///< Default move assignment operator
};
/**
* @param[in] b A vector
* @return A vector containing the minimum of each component from a and b
*/
-inline Vector4 Min( const Vector4& a, const Vector4& b )
+inline Vector4 Min(const Vector4& a, const Vector4& b)
{
- return Vector4( a.x < b.x ? a.x : b.x,
- a.y < b.y ? a.y : b.y,
- a.z < b.z ? a.z : b.z,
- a.w < b.w ? a.w : b.w );
+ return Vector4(a.x < b.x ? a.x : b.x,
+ a.y < b.y ? a.y : b.y,
+ a.z < b.z ? a.z : b.z,
+ a.w < b.w ? a.w : b.w);
}
/**
* @param[in] b A vector
* @return A vector containing the maximum of each component from a and b
*/
-inline Vector4 Max( const Vector4& a, const Vector4& b )
+inline Vector4 Max(const Vector4& a, const Vector4& b)
{
- return Vector4( a.x > b.x ? a.x : b.x,
- a.y > b.y ? a.y : b.y,
- a.z > b.z ? a.z : b.z,
- a.w > b.w ? a.w : b.w );
+ return Vector4(a.x > b.x ? a.x : b.x,
+ a.y > b.y ? a.y : b.y,
+ a.z > b.z ? a.z : b.z,
+ a.w > b.w ? a.w : b.w);
}
/**
* @param[in] max The maximum value
* @return A vector containing the clamped components of v
*/
-DALI_CORE_API Vector4 Clamp( const Vector4& v, const float& min, const float& max );
+DALI_CORE_API Vector4 Clamp(const Vector4& v, const float& min, const float& max);
// Allow Vector4 to be treated as a POD type
-template <> struct TypeTraits< Vector4 > : public BasicTypes< Vector4 > { enum { IS_TRIVIAL_TYPE = true }; };
+template<>
+struct TypeTraits<Vector4> : public BasicTypes<Vector4>
+{
+ enum
+ {
+ IS_TRIVIAL_TYPE = true
+ };
+};
/**
* @}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
Any::Any()
-: mContainer( nullptr )
+: mContainer(nullptr)
{
}
{
// Call the implementation deletion function, which will invalidate mContainer
- if ( nullptr != mContainer )
+ if(nullptr != mContainer)
{
- mContainer->mDeleteFunc( mContainer );
+ mContainer->mDeleteFunc(mContainer);
mContainer = nullptr;
}
}
-Any& Any::operator=( const Any& any )
+Any& Any::operator=(const Any& any)
{
- if( &any != this )
+ if(&any != this)
{
- if( nullptr == any.mContainer )
+ if(nullptr == any.mContainer)
{
delete mContainer;
mContainer = nullptr;
{
AnyContainerBase* tmp = mContainer;
- if( nullptr != mContainer )
+ if(nullptr != mContainer)
{
// Check if two Any types have the same type. Avoids assignments of values with different types.
- if( mContainer->GetType() != any.GetType() )
+ if(mContainer->GetType() != any.GetType())
{
- AssertAlways( "Any::operator=( const Any& Any ). Trying to assign two values with different types." );
+ AssertAlways("Any::operator=( const Any& Any ). Trying to assign two values with different types.");
}
}
// Clone the correct templated object
- mContainer = any.mContainer->mCloneFunc( *any.mContainer );
+ mContainer = any.mContainer->mCloneFunc(*any.mContainer);
// Deletes previous container.
delete tmp;
const std::type_info& Any::GetType() const
{
- return mContainer ? mContainer->GetType() : typeid( void );
+ return mContainer ? mContainer->GetType() : typeid(void);
}
-void Any::AssertAlways( const char* assertMessage )
+void Any::AssertAlways(const char* assertMessage)
{
- DALI_LOG_ERROR_NOFN( assertMessage );
- throw Dali::DaliException( assertMessage, "" );
+ DALI_LOG_ERROR_NOFN(assertMessage);
+ throw Dali::DaliException(assertMessage, "");
}
-
} //namespace Dali
#define DALI_ANY_TYPE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// EXTERNAL INCLUDES
-#include <typeinfo> // operator typeid
-#include <cstddef> // NULL
+#include <cstddef> // NULL
+#include <typeinfo> // operator typeid
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
* @SINCE_1_0.0
* @param[in] assertMessage Assert message to report
*/
- DALI_CORE_API static void AssertAlways( const char* assertMessage );
+ DALI_CORE_API static void AssertAlways(const char* assertMessage);
/**
* @brief Constructs a Any type with the given value.
* @param[in] value The given value
*/
template<typename Type>
- Any( const Type& value )
- : mContainer( new AnyContainerImpl<Type>( value ) )
+ Any(const Type& value)
+ : mContainer(new AnyContainerImpl<Type>(value))
{
}
* @SINCE_1_0.0
* @param[in] any Any to be copied
*/
- Any( const Any& any )
+ Any(const Any& any)
{
// If container isn't empty then copy the container?
- if ( nullptr != any.mContainer )
+ if(nullptr != any.mContainer)
{
- mContainer = any.mContainer->mCloneFunc( *any.mContainer );
+ mContainer = any.mContainer->mCloneFunc(*any.mContainer);
}
else
{
*
*/
template<typename Type>
- Any& operator=( const Type& value )
+ Any& operator=(const Type& value)
{
// If the container is empty then assign the new value
- if ( nullptr == mContainer )
+ if(nullptr == mContainer)
{
- mContainer = new AnyContainerImpl< Type >( value );
+ mContainer = new AnyContainerImpl<Type>(value);
}
else
{
// Check to see if this type is compatible with current container?
- if ( mContainer->GetType() == typeid( Type ) )
+ if(mContainer->GetType() == typeid(Type))
{
// Same type so just set the new value
- static_cast< AnyContainerImpl< Type >* >( mContainer )->SetValue( value );
+ static_cast<AnyContainerImpl<Type>*>(mContainer)->SetValue(value);
}
else
{
// Incompatible types, so delete old container and assign a new one with this type and value
- mContainer->mDeleteFunc( mContainer );
- mContainer = new AnyContainerImpl< Type >( value );
+ mContainer->mDeleteFunc(mContainer);
+ mContainer = new AnyContainerImpl<Type>(value);
}
}
return *this;
* @exception DaliException If parameter any is of a different type.
*
*/
- DALI_CORE_API Any& operator=( const Any& any );
+ DALI_CORE_API Any& operator=(const Any& any);
/**
* @brief Gets a value of type Type from container.
* @param[in] type destination of type Type to write to
*/
template<typename Type>
- void Get( Type& type ) const
+ void Get(Type& type) const
{
type = Get<Type>();
}
template<typename Type>
const Type& Get() const
{
- if ( nullptr == mContainer )
+ if(nullptr == mContainer)
{
- AssertAlways( "Any::Get(). mContainer is NULL" );
+ AssertAlways("Any::Get(). mContainer is NULL");
}
- else if( mContainer->GetType() != typeid( Type ) ) // Check if the value has the same value than the Any type.
+ else if(mContainer->GetType() != typeid(Type)) // Check if the value has the same value than the Any type.
{
- AssertAlways( "Any::Get(). Trying to retrieve a value of a different type than the template one." );
+ AssertAlways("Any::Get(). Trying to retrieve a value of a different type than the template one.");
}
- return static_cast< AnyContainerImpl< Type >* >( mContainer )->GetValue();
+ return static_cast<AnyContainerImpl<Type>*>(mContainer)->GetValue();
}
/**
template<typename Type>
Type* GetPointer()
{
- if( nullptr == mContainer )
+ if(nullptr == mContainer)
{
return NULL;
}
- // Check if the value has the same value than the Any type.
- if( mContainer->GetType() != typeid( Type ) )
+ // Check if the value has the same value than the Any type.
+ if(mContainer->GetType() != typeid(Type))
{
- AssertAlways( "Any::GetPointer(). Trying to retrieve a pointer to a value of a different type than the template one." );
+ AssertAlways("Any::GetPointer(). Trying to retrieve a pointer to a value of a different type than the template one.");
}
- return static_cast< AnyContainerImpl< Type >* >( mContainer )->GetPointerToValue();
+ return static_cast<AnyContainerImpl<Type>*>(mContainer)->GetPointerToValue();
}
/**
template<typename Type>
const Type* GetPointer() const
{
- if( nullptr == mContainer )
+ if(nullptr == mContainer)
{
return NULL;
}
- // Check if the value has the same value than the Any type.
- if( mContainer->GetType() != typeid( Type ) )
+ // Check if the value has the same value than the Any type.
+ if(mContainer->GetType() != typeid(Type))
{
- AssertAlways( "Any::GetPointer(). Trying to retrieve a pointer to a value of a different type than the template one." );
+ AssertAlways("Any::GetPointer(). Trying to retrieve a pointer to a value of a different type than the template one.");
}
- return static_cast< AnyContainerImpl< Type >* >( mContainer )->GetPointerToValue();
+ return static_cast<AnyContainerImpl<Type>*>(mContainer)->GetPointerToValue();
}
/**
*/
bool Empty() const
{
- return ( nullptr == mContainer ) ? true : false;
+ return (nullptr == mContainer) ? true : false;
}
- struct AnyContainerBase; // Forward declaration for typedef
- using CloneFunc = AnyContainerBase* (*)( const AnyContainerBase& );
+ struct AnyContainerBase; // Forward declaration for typedef
+ using CloneFunc = AnyContainerBase* (*)(const AnyContainerBase&);
- using DeleteFunc = void ( * )( const AnyContainerBase* );
+ using DeleteFunc = void (*)(const AnyContainerBase*);
/**
* @brief Base container to hold type for match verification and instance cloning function.
* @param[in] cloneFunc Cloning function to replicate this container type
* @param[in] deleteFunc Deleting function to destroy this container type
*/
- AnyContainerBase( const std::type_info& type, CloneFunc cloneFunc, DeleteFunc deleteFunc )
- : mType( type ),
- mCloneFunc( cloneFunc ),
- mDeleteFunc( deleteFunc )
- {}
+ AnyContainerBase(const std::type_info& type, CloneFunc cloneFunc, DeleteFunc deleteFunc)
+ : mType(type),
+ mCloneFunc(cloneFunc),
+ mDeleteFunc(deleteFunc)
+ {
+ }
/**
* @brief Gets the typeid of this container.
return mType;
}
- const::std::type_info& mType; // typeID
- CloneFunc mCloneFunc; // cloning function for this container
- DeleteFunc mDeleteFunc; // deleting function for this container
+ const ::std::type_info& mType; // typeID
+ CloneFunc mCloneFunc; // cloning function for this container
+ DeleteFunc mDeleteFunc; // deleting function for this container
};
-
/**
* @brief Templated Clone function from container base.
*
template<typename Type>
struct AnyContainerImplCloner
{
- static AnyContainerBase* Clone( const AnyContainerBase& base )
+ static AnyContainerBase* Clone(const AnyContainerBase& base)
{
- return new AnyContainerImpl< Type >( static_cast< AnyContainerImpl< Type > >( base ) );
+ return new AnyContainerImpl<Type>(static_cast<AnyContainerImpl<Type> >(base));
}
};
template<typename Type>
struct AnyContainerImplDelete
{
- static void Delete( const AnyContainerBase* base )
+ static void Delete(const AnyContainerBase* base)
{
- delete ( static_cast< const AnyContainerImpl< Type >* > ( base ) );
+ delete(static_cast<const AnyContainerImpl<Type>*>(base));
}
};
class AnyContainerImpl : public AnyContainerBase
{
public:
-
/**
* @brief Constructor to create container holding value of type Type.
*
* @SINCE_1_0.0
* @param[in] value Value of Type
*/
- AnyContainerImpl( const Type& value )
- : AnyContainerBase( typeid( Type ),
- static_cast< CloneFunc >( &AnyContainerImplCloner< Type >::Clone ),
- static_cast< DeleteFunc >( &AnyContainerImplDelete< Type >::Delete ) ),
- mValue( value )
- {}
+ AnyContainerImpl(const Type& value)
+ : AnyContainerBase(typeid(Type),
+ static_cast<CloneFunc>(&AnyContainerImplCloner<Type>::Clone),
+ static_cast<DeleteFunc>(&AnyContainerImplDelete<Type>::Delete)),
+ mValue(value)
+ {
+ }
/**
* @brief Constructor to create new container of type from and existing container (cloning).
* @SINCE_1_0.0
* @param[in] base The reference to base container to copy from
*/
- AnyContainerImpl( const AnyContainerBase& base )
- : AnyContainerBase( typeid( Type ),
- static_cast< CloneFunc >( &AnyContainerImplCloner< Type >::Clone ),
- static_cast< DeleteFunc >( &AnyContainerImplDelete< Type >::Delete ) )
+ AnyContainerImpl(const AnyContainerBase& base)
+ : AnyContainerBase(typeid(Type),
+ static_cast<CloneFunc>(&AnyContainerImplCloner<Type>::Clone),
+ static_cast<DeleteFunc>(&AnyContainerImplDelete<Type>::Delete))
{
- mValue = static_cast< const AnyContainerImpl& >( base ).GetValue();
+ mValue = static_cast<const AnyContainerImpl&>(base).GetValue();
}
/**
* @SINCE_1_0.0
* @param[in] value Value of type Type
*/
- void SetValue( const Type& value )
+ void SetValue(const Type& value)
{
mValue = value;
}
*/
Type* GetPointerToValue()
{
- return static_cast< Type* >( &mValue );
+ return static_cast<Type*>(&mValue);
}
/**
*/
const Type* GetPointerToValue() const
{
- return static_cast< const Type* >( &mValue );
+ return static_cast<const Type*>(&mValue);
}
- private:
- Type mValue;
+ private:
+ Type mValue;
};
AnyContainerBase* mContainer;
-
};
/**
* @return Pointer to the Type held
*/
template<typename Type>
-inline Type* AnyCast( Any* any )
+inline Type* AnyCast(Any* any)
{
return any->GetPointer<Type>();
}
* @return const Pointer to the Type held
*/
template<typename Type>
-inline const Type* AnyCast( const Any* any )
+inline const Type* AnyCast(const Any* any)
{
return any->GetPointer<Type>();
}
* @return Type value of type Type
*/
template<typename Type>
-inline Type AnyCast( Any& any )
+inline Type AnyCast(Any& any)
{
return any.Get<Type>();
}
* @return Type value of type Type
*/
template<typename Type>
-inline Type AnyCast( const Any& any )
+inline Type AnyCast(const Any& any)
{
return any.Get<Type>();
}
* @return A reference to the Type value of type Type
*/
template<typename Type>
-inline Type& AnyCastReference( Any& any )
+inline Type& AnyCastReference(Any& any)
{
return any.Get<Type>();
}
* @return A const reference to the Type value of type Type
*/
template<typename Type>
-inline const Type& AnyCastReference( const Any& any )
+inline const Type& AnyCastReference(const Any& any)
{
return any.Get<Type>();
}
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
-#include <dali/internal/event/common/object-impl.h>
#include <dali/integration-api/debug.h>
+#include <dali/internal/event/common/object-impl.h>
namespace Dali
{
-
BaseHandle::BaseHandle(Dali::BaseObject* handle)
: mObjectHandle(handle)
{
BaseHandle& BaseHandle::operator=(const BaseHandle& rhs) = default;
-BaseHandle::BaseHandle( BaseHandle&& rhs ) = default;
+BaseHandle::BaseHandle(BaseHandle&& rhs) = default;
-BaseHandle& BaseHandle::operator=( BaseHandle&& rhs ) = default;
+BaseHandle& BaseHandle::operator=(BaseHandle&& rhs) = default;
bool BaseHandle::DoAction(const std::string& command, const Property::Map& attributes)
{
- return GetImplementation(*this).DoAction( command, attributes );
+ return GetImplementation(*this).DoAction(command, attributes);
}
const std::string& BaseHandle::GetTypeName() const
return mObjectHandle.Get();
}
-bool BaseHandle::DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor )
+bool BaseHandle::DoConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor)
{
- return GetImplementation(*this).DoConnectSignal( connectionTracker, signalName, functor );
+ return GetImplementation(*this).DoConnectSignal(connectionTracker, signalName, functor);
}
} // namespace Dali
class DALI_CORE_API BaseHandle
{
public:
-
/**
* @brief This constructor is used by Dali New() methods.
*
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- BaseHandle( BaseHandle&& rhs );
+ BaseHandle(BaseHandle&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- BaseHandle& operator=( BaseHandle&& rhs );
+ BaseHandle& operator=(BaseHandle&& rhs);
/**
* @brief Connects a void() functor to a specified signal.
* @return True if the signal was available
* @pre The signal must be available in this object.
*/
- template <class T>
- bool ConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, const T& functor )
+ template<class T>
+ bool ConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, const T& functor)
{
- return DoConnectSignal( connectionTracker, signalName, FunctorDelegate::New( functor ) );
+ return DoConnectSignal(connectionTracker, signalName, FunctorDelegate::New(functor));
}
/**
bool GetTypeInfo(Dali::TypeInfo& info) const;
public:
-
// BaseHandle accessors
/**
* @brief Pointer-to-member type.
* Objects can be implicitly converted to this for validity checks.
*/
- using BooleanType = void ( BaseHandle::* )() const;
+ using BooleanType = void (BaseHandle::*)() const;
/**
* @brief Converts an handle to a BooleanType.
Dali::RefObject* GetObjectPtr() const;
private:
-
/**
* @brief Not intended for application developers.
*
* @param[in] functorDelegate A newly allocated functor delegate (takes ownership)
* @return True if the signal was available
*/
- bool DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functorDelegate );
+ bool DoConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functorDelegate);
protected:
-
/**
* @brief Used by the safe bool idiom.
*
* in a boolean context without the usual harmful side effects.
* @SINCE_1_0.0
*/
- void ThisIsSaferThanReturningVoidStar() const {}
+ void ThisIsSaferThanReturningVoidStar() const
+ {
+ }
private:
-
IntrusivePtr<Dali::RefObject> mObjectHandle; ///< Object this handle points at.
-
};
/**
* @return Handle pointer to either a valid deriving handle or an uninitialized handle
* @pre The BaseHandle has been initialized.
*/
-template< class T >
-inline T DownCast( BaseHandle handle )
+template<class T>
+inline T DownCast(BaseHandle handle)
{
- return T::DownCast( handle );
+ return T::DownCast(handle);
}
// See also BaseHandle::BooleanType() conversion
* @param[in] rhs A reference to compare to
* @return True if the handle handles point to the same Dali resource, or if both are NULL
*/
-template <typename T>
+template<typename T>
inline bool operator==(const BaseHandle& lhs, const T& rhs)
{
// We depart from the safe bool idiom to allow Dali::BaseHandle derived classes to be compared
* @param[in] rhs A reference to compare to
* @return True if the handle handles point to the different Dali resources
*/
-template <typename T>
+template<typename T>
inline bool operator!=(const BaseHandle& lhs, const T& rhs)
{
// We depart from the safe bool idiom to allow Dali::BaseHandle derived classes to be compared
#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
#include <dali/integration-api/debug.h>
+#include <dali/internal/event/common/base-object-impl.h>
#include <dali/internal/event/common/object-registry-impl.h>
#include <dali/internal/event/common/stage-impl.h>
-#include <dali/internal/event/common/type-registry-impl.h>
#include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/common/base-object-impl.h>
+#include <dali/internal/event/common/type-registry-impl.h>
+#include <dali/public-api/object/type-registry.h>
namespace Dali
{
-
BaseObject::BaseObject()
-: mImpl( new Impl( *this ) )
+: mImpl(new Impl(*this))
{
}
void BaseObject::RegisterObject()
{
Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal();
- if ( tls )
+ if(tls)
{
- tls->GetEventThreadServices().RegisterObject( this );
+ tls->GetEventThreadServices().RegisterObject(this);
}
}
Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal();
// Guard to allow handle destruction after Core has been destroyed
- if( tls )
+ if(tls)
{
- tls->GetEventThreadServices().UnregisterObject( this );
+ tls->GetEventThreadServices().UnregisterObject(this);
}
}
{
Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get();
- if( registry )
+ if(registry)
{
return registry->DoActionTo(this, actionName, attributes);
}
{
Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get();
- if( registry )
+ if(registry)
{
Internal::TypeRegistry::TypeInfoPointer typeInfo = registry->GetTypeInfo(this);
- if( typeInfo )
+ if(typeInfo)
{
return typeInfo->GetName();
}
}
// Return an empty string if type-name not found.
- DALI_LOG_WARNING( "TypeName Not Found\n" );
+ DALI_LOG_WARNING("TypeName Not Found\n");
static std::string empty;
return empty;
}
Internal::TypeRegistry::TypeInfoPointer info = registry->GetTypeInfo(this);
if(info)
{
- typeInfo = Dali::TypeInfo( info.Get() );
+ typeInfo = Dali::TypeInfo(info.Get());
return true;
}
else
}
}
-bool BaseObject::DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor )
+bool BaseObject::DoConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor)
{
Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get();
- if( registry )
+ if(registry)
{
- return registry->ConnectSignal( this, connectionTracker, signalName, functor );
+ return registry->ConnectSignal(this, connectionTracker, signalName, functor);
}
return false;
}
} // namespace Dali
-
#include <memory>
// INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/object/property.h>
+#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/signals/functor-delegate.h>
namespace Dali
class DALI_CORE_API BaseObject : public Dali::RefObject
{
public:
-
/**
* @brief Connects a void() functor to a specified signal.
*
* @return True if the signal was available
* @pre The signal must be available in this object.
*/
- template <class T>
- bool ConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, const T& functor )
+ template<class T>
+ bool ConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, const T& functor)
{
- return DoConnectSignal( connectionTracker, signalName, FunctorDelegate::New( functor ) );
+ return DoConnectSignal(connectionTracker, signalName, FunctorDelegate::New(functor));
}
/**
bool GetTypeInfo(Dali::TypeInfo& info) const;
public: // Not intended for application developers
-
/**
* @brief Not intended for application developers.
*
* @param[in] functorDelegate A newly allocated functor delegate (takes ownership)
* @return True if the signal was available
*/
- bool DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functorDelegate );
+ bool DoConnectSignal(ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functorDelegate);
protected:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
// Not copyable or movable
- BaseObject(const BaseObject& rhs) = delete; ///< Deleted copy constructor
- BaseObject(BaseObject&& rhs) = delete; ///< Deleted move constructor
+ BaseObject(const BaseObject& rhs) = delete; ///< Deleted copy constructor
+ BaseObject(BaseObject&& rhs) = delete; ///< Deleted move constructor
BaseObject& operator=(const BaseObject& rhs) = delete; ///< Deleted copy assignment operator
- BaseObject& operator=(BaseObject&& rhs) = delete; ///< Deleted move assignment operator
+ BaseObject& operator=(BaseObject&& rhs) = delete; ///< Deleted move assignment operator
public:
-
class DALI_INTERNAL Impl;
private:
-
std::unique_ptr<Impl> mImpl;
};
*/
inline BaseObject& GetImplementation(Dali::BaseHandle& handle)
{
- DALI_ASSERT_ALWAYS( handle && "BaseObject handle is empty" );
+ DALI_ASSERT_ALWAYS(handle && "BaseObject handle is empty");
return handle.GetBaseObject();
}
*/
inline const BaseObject& GetImplementation(const Dali::BaseHandle& handle)
{
- DALI_ASSERT_ALWAYS( handle && "BaseObject handle is empty" );
+ DALI_ASSERT_ALWAYS(handle && "BaseObject handle is empty");
return handle.GetBaseObject();
}
*/
} // namespace Dali
-# endif // __DALI_BASE_OBJECT_H__
+#endif // __DALI_BASE_OBJECT_H__
#include <dali/public-api/object/handle.h>
// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/internal/event/animation/constraint-impl.h>
+#include <dali/internal/event/common/object-impl.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/object/property-conditions.h>
#include <dali/public-api/object/property-notification.h>
-#include <dali/internal/event/animation/constraint-impl.h>
-#include <dali/internal/event/common/object-impl.h>
-#include <dali/integration-api/debug.h>
namespace Dali
{
-
-
-Handle::Handle( Dali::Internal::Object* handle )
+Handle::Handle(Dali::Internal::Object* handle)
: BaseHandle(handle)
{
}
Handle Handle::New()
{
- return Handle( Internal::Object::New().Get() );
+ return Handle(Internal::Object::New().Get());
}
Handle::~Handle()
{
}
-Handle::Handle( const Handle& handle ) = default;
+Handle::Handle(const Handle& handle) = default;
-Handle& Handle::operator=( const Handle& rhs ) = default;
+Handle& Handle::operator=(const Handle& rhs) = default;
-Handle::Handle( Handle&& rhs ) = default;
+Handle::Handle(Handle&& rhs) = default;
-Handle& Handle::operator=( Handle&& rhs ) = default;
+Handle& Handle::operator=(Handle&& rhs) = default;
-Handle Handle::DownCast( BaseHandle handle )
+Handle Handle::DownCast(BaseHandle handle)
{
- return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
+ return Handle(dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()));
}
-bool Handle::Supports( Capability capability ) const
+bool Handle::Supports(Capability capability) const
{
- return GetImplementation(*this).Supports( capability );
+ return GetImplementation(*this).Supports(capability);
}
uint32_t Handle::GetPropertyCount() const
return GetImplementation(*this).GetPropertyCount();
}
-std::string Handle::GetPropertyName( Property::Index index ) const
+std::string Handle::GetPropertyName(Property::Index index) const
{
- return GetImplementation(*this).GetPropertyName( index );
+ return GetImplementation(*this).GetPropertyName(index);
}
-Property::Index Handle::GetPropertyIndex( Property::Key key ) const
+Property::Index Handle::GetPropertyIndex(Property::Key key) const
{
- return GetImplementation( *this ).GetPropertyIndex( key );
+ return GetImplementation(*this).GetPropertyIndex(key);
}
-bool Handle::IsPropertyWritable( Property::Index index ) const
+bool Handle::IsPropertyWritable(Property::Index index) const
{
- return GetImplementation(*this).IsPropertyWritable( index );
+ return GetImplementation(*this).IsPropertyWritable(index);
}
-bool Handle::IsPropertyAnimatable( Property::Index index ) const
+bool Handle::IsPropertyAnimatable(Property::Index index) const
{
- return GetImplementation(*this).IsPropertyAnimatable( index );
+ return GetImplementation(*this).IsPropertyAnimatable(index);
}
-bool Handle::IsPropertyAConstraintInput( Property::Index index ) const
+bool Handle::IsPropertyAConstraintInput(Property::Index index) const
{
- return GetImplementation(*this).IsPropertyAConstraintInput( index );
+ return GetImplementation(*this).IsPropertyAConstraintInput(index);
}
-Property::Type Handle::GetPropertyType( Property::Index index ) const
+Property::Type Handle::GetPropertyType(Property::Index index) const
{
- return GetImplementation(*this).GetPropertyType( index );
+ return GetImplementation(*this).GetPropertyType(index);
}
-void Handle::SetProperty( Property::Index index, const Property::Value& propertyValue )
+void Handle::SetProperty(Property::Index index, const Property::Value& propertyValue)
{
- GetImplementation(*this).SetProperty( index, propertyValue );
+ GetImplementation(*this).SetProperty(index, propertyValue);
}
-Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue )
+Property::Index Handle::RegisterProperty(const std::string& name, const Property::Value& propertyValue)
{
- return GetImplementation(*this).RegisterProperty( name, propertyValue );
+ return GetImplementation(*this).RegisterProperty(name, propertyValue);
}
-Property::Index Handle::RegisterProperty( Property::Index key, const std::string& name, const Property::Value& propertyValue )
+Property::Index Handle::RegisterProperty(Property::Index key, const std::string& name, const Property::Value& propertyValue)
{
- return GetImplementation( *this ).RegisterProperty( name, key, propertyValue );
+ return GetImplementation(*this).RegisterProperty(name, key, propertyValue);
}
-Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
+Property::Index Handle::RegisterProperty(const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode)
{
- return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
+ return GetImplementation(*this).RegisterProperty(name, propertyValue, accessMode);
}
-Property::Value Handle::GetProperty( Property::Index index ) const
+Property::Value Handle::GetProperty(Property::Index index) const
{
- return GetImplementation(*this).GetProperty( index );
+ return GetImplementation(*this).GetProperty(index);
}
-Property::Value Handle::GetCurrentProperty( Property::Index index ) const
+Property::Value Handle::GetCurrentProperty(Property::Index index) const
{
- return GetImplementation(*this).GetCurrentProperty( index );
+ return GetImplementation(*this).GetCurrentProperty(index);
}
-void Handle::SetProperties( const Property::Map& properties )
+void Handle::SetProperties(const Property::Map& properties)
{
- GetImplementation( *this ).SetProperties( properties );
+ GetImplementation(*this).SetProperties(properties);
}
-void Handle::GetProperties( Property::Map& properties )
+void Handle::GetProperties(Property::Map& properties)
{
- GetImplementation( *this ).GetProperties( properties );
+ GetImplementation(*this).GetProperties(properties);
}
-void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
+void Handle::GetPropertyIndices(Property::IndexContainer& indices) const
{
- GetImplementation(*this).GetPropertyIndices( indices );
+ GetImplementation(*this).GetPropertyIndices(indices);
}
-bool Handle::DoesCustomPropertyExist( Property::Index index )
+bool Handle::DoesCustomPropertyExist(Property::Index index)
{
- return GetImplementation( *this ).DoesCustomPropertyExist( index );
+ return GetImplementation(*this).DoesCustomPropertyExist(index);
}
-Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
- const PropertyCondition& condition )
+Dali::PropertyNotification Handle::AddPropertyNotification(Property::Index index,
+ const PropertyCondition& condition)
{
- return GetImplementation(*this).AddPropertyNotification( index, -1, condition );
+ return GetImplementation(*this).AddPropertyNotification(index, -1, condition);
}
-Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
- int componentIndex,
- const PropertyCondition& condition )
+Dali::PropertyNotification Handle::AddPropertyNotification(Property::Index index,
+ int componentIndex,
+ const PropertyCondition& condition)
{
- return GetImplementation(*this).AddPropertyNotification( index, componentIndex, condition );
+ return GetImplementation(*this).AddPropertyNotification(index, componentIndex, condition);
}
-void Handle::RemovePropertyNotification( Dali::PropertyNotification propertyNotification )
+void Handle::RemovePropertyNotification(Dali::PropertyNotification propertyNotification)
{
- GetImplementation(*this).RemovePropertyNotification( propertyNotification );
+ GetImplementation(*this).RemovePropertyNotification(propertyNotification);
}
void Handle::RemovePropertyNotifications()
GetImplementation(*this).RemoveConstraints();
}
-void Handle::RemoveConstraints( uint32_t tag )
+void Handle::RemoveConstraints(uint32_t tag)
{
- GetImplementation(*this).RemoveConstraints( tag );
+ GetImplementation(*this).RemoveConstraints(tag);
}
-IndirectValue Handle::operator[]( Property::Index index )
+IndirectValue Handle::operator[](Property::Index index)
{
// Will assert on access if handle is empty
return IndirectValue(*this, index);
}
-IndirectValue Handle::operator[]( const std::string& name )
+IndirectValue Handle::operator[](const std::string& name)
{
// Will assert immediately when GetPropertyIndex is called if handle is empty
return IndirectValue(*this, GetPropertyIndex(name));
Handle::PropertySetSignalType& Handle::PropertySetSignal()
{
- return GetImplementation( *this ).PropertySetSignal();
+ return GetImplementation(*this).PropertySetSignal();
}
-
namespace WeightObject
{
-
const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
Handle New()
{
Handle handle = Handle::New();
- handle.RegisterProperty( "weight", 0.0f );
+ handle.RegisterProperty("weight", 0.0f);
return handle;
}
*/
// EXTERNAL INCLUDES
-#include <string>
#include <cstdint> // uint32_t
+#include <string>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/object/indirect-value.h>
#include <dali/public-api/object/property-key.h>
+#include <dali/public-api/object/property-notification-declarations.h>
#include <dali/public-api/object/property-types.h>
#include <dali/public-api/object/property-value.h>
-#include <dali/public-api/object/property-notification-declarations.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/signals/dali-signal.h>
-
namespace Dali
{
/**
class DALI_CORE_API Handle : public BaseHandle
{
public:
-
/**
* @brief Enumeration for Handle's capabilities that can be queried using Handle::Supports().
* @SINCE_1_0.0
/**
* @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 ) >;
+ using PropertySetSignalType = Signal<void(Handle& handle, Property::Index index, Property::Value value)>;
public:
-
/**
* @brief This constructor is used by Dali New() methods.
*
* @SINCE_1_0.0
* @param[in] handle A pointer to a newly allocated Dali resource
*/
- Handle( Dali::Internal::Object* handle );
+ Handle(Dali::Internal::Object* handle);
/**
* @brief This constructor provides an uninitialized Dali::Handle.
* @tparam T The derived class to create
* @param[in] properties The properties to set
*/
- template< typename Type >
- static DALI_NO_EXPORT_API Type New( const Property::Map& properties )
+ template<typename Type>
+ static DALI_NO_EXPORT_API Type New(const Property::Map& properties)
{
Type handle = Type::New();
- handle.SetProperties( properties );
+ handle.SetProperties(properties);
return handle;
}
* @SINCE_1_0.0
* @param[in] handle A reference to the copied handle
*/
- Handle( const Handle& handle );
+ Handle(const Handle& handle);
/**
* @brief This assignment operator is required for (smart) pointer semantics.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- Handle& operator=( const Handle& rhs );
+ Handle& operator=(const Handle& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Handle( Handle&& rhs );
+ Handle(Handle&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- Handle& operator=( Handle&& rhs );
+ Handle& operator=(Handle&& rhs);
/**
* @brief Downcasts to a handle.
* @param[in] handle to An object
* @return handle or an uninitialized handle
*/
- static Handle DownCast( BaseHandle handle );
+ static Handle DownCast(BaseHandle handle);
/**
* @brief Queries whether an handle supports a given capability.
* @param[in] capability The queried capability
* @return True if the capability is supported
*/
- bool Supports( Capability capability ) const;
+ bool Supports(Capability capability) const;
// Properties
* @param[in] index The index of the property
* @return The name of the property
*/
- std::string GetPropertyName( Property::Index index ) const;
+ std::string GetPropertyName(Property::Index index) const;
/**
* @brief Query the index of a property using the given key.
* @return the matching property index of the key, or Property::INVALID_INDEX if no
* property matches the given key.
*/
- Property::Index GetPropertyIndex( Property::Key key ) const;
+ Property::Index GetPropertyIndex(Property::Key key) const;
/**
* @brief Queries whether a property can be set using SetProperty().
* @return True if the property is writable
* @pre Property::INVALID_INDEX < index.
*/
- bool IsPropertyWritable( Property::Index index ) const;
+ bool IsPropertyWritable(Property::Index index) const;
/**
* @brief Queries whether a writable property can be the target of an animation or constraint.
* @param[in] index The index of the property
* @return True if the property is animatable
*/
- bool IsPropertyAnimatable( Property::Index index ) const;
+ bool IsPropertyAnimatable(Property::Index index) const;
/**
* @brief Queries whether a property can be used as in input to a constraint.
* @param[in] index The index of the property
* @return True if the property can be used as a constraint input
*/
- bool IsPropertyAConstraintInput( Property::Index index ) const;
+ bool IsPropertyAConstraintInput(Property::Index index) const;
/**
* @brief Queries the type of a property.
* @param[in] index The index of the property
* @return The type of the property
*/
- Property::Type GetPropertyType( Property::Index index ) const;
+ Property::Type GetPropertyType(Property::Index index) const;
/**
* @brief Sets the value of an existing property.
* @param[in] propertyValue The new value of the property
* @pre The property types match i.e. propertyValue.GetType() is equal to GetPropertyType(index).
*/
- void SetProperty( Property::Index index, const Property::Value& propertyValue );
+ void SetProperty(Property::Index index, const Property::Value& propertyValue);
/**
* @brief Registers a new animatable property.
* - Property::ROTATION
* @note If a property with the desired name already exists, then the value given is just set.
*/
- Property::Index RegisterProperty( const std::string& name, const Property::Value& propertyValue );
+ Property::Index RegisterProperty(const std::string& name, const Property::Value& propertyValue);
/**
* @brief Register a new animatable property with an integer key.
* - Property::ROTATION
* @note If a property with the desired name already exists, then the value given is just set.
*/
- Property::Index RegisterProperty( Property::Index key,
- const std::string& name,
- const Property::Value& propertyValue );
+ Property::Index RegisterProperty(Property::Index key,
+ const std::string& name,
+ const Property::Value& propertyValue);
/**
* @brief Registers a new property.
* - Property::ROTATION
* @note If a property with the desired name already exists, then the value given is just set.
*/
- Property::Index RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode );
+ Property::Index RegisterProperty(const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode);
/**
* @brief Retrieves a property value.
* @param[in] index The index of the property
* @return The property value
*/
- Property::Value GetProperty( Property::Index index ) const;
+ Property::Value GetProperty(Property::Index index) const;
/**
* @brief Convenience function for obtaining a property of a known type.
* @return The property value
* @pre The property types match i.e. PropertyTypes::Get<T>() is equal to GetPropertyType(index).
*/
- template <typename T>
- T GetProperty( Property::Index index ) const
+ template<typename T>
+ T GetProperty(Property::Index index) const
{
Property::Value value = GetProperty(index);
- return T( value.Get<T>() );
+ return T(value.Get<T>());
}
/**
* @param[in] index The index of the property
* @return The property value
*/
- Property::Value GetCurrentProperty( Property::Index index ) const;
+ Property::Value GetCurrentProperty(Property::Index index) const;
/**
* @brief Convenience function for obtaining the current value of a property of a known type.
* @return The property value
* @pre The property types match i.e. PropertyTypes::Get<T>() is equal to GetPropertyType(index).
*/
- template <typename T>
- T GetCurrentProperty( Property::Index index ) const
+ template<typename T>
+ T GetCurrentProperty(Property::Index index) const
{
- Property::Value value = GetCurrentProperty( index );
+ Property::Value value = GetCurrentProperty(index);
- return T( value.Get<T>() );
+ return T(value.Get<T>());
}
/**
* @SINCE_1_9.27
* @param[in] properties The properties to set
*/
- void SetProperties( const Property::Map& properties );
+ void SetProperties(const Property::Map& properties);
/**
* @brief Retrieves all the properties and the values for this object
*
* @note The properties map will be cleared by this method first.
*/
- void GetProperties( Property::Map& properties );
+ void GetProperties(Property::Map& properties);
/**
* @brief Retrieves all the property indices for this object (including custom properties).
* @param[out] indices A container of property indices for this object
* @note The added container is cleared.
*/
- void GetPropertyIndices( Property::IndexContainer& indices ) const;
+ void GetPropertyIndices(Property::IndexContainer& indices) const;
/**
* @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] index The index of the property to test for
*/
- bool DoesCustomPropertyExist( Property::Index index );
+ bool DoesCustomPropertyExist(Property::Index index);
/**
* @brief Adds a property notification to this object.
* @param[in] condition The notification will be triggered when this condition is satisfied
* @return A handle to the newly created PropertyNotification
*/
- PropertyNotification AddPropertyNotification( Property::Index index,
- const PropertyCondition& condition );
+ PropertyNotification AddPropertyNotification(Property::Index index,
+ const PropertyCondition& condition);
/**
* @brief Adds a property notification to this object.
* @param[in] condition The notification will be triggered when this condition is satisfied
* @return A handle to the newly created PropertyNotification
*/
- PropertyNotification AddPropertyNotification( Property::Index index,
- int componentIndex,
- const PropertyCondition& condition );
+ PropertyNotification AddPropertyNotification(Property::Index index,
+ int componentIndex,
+ const PropertyCondition& condition);
/**
* @brief Removes a property notification from this object.
* @SINCE_1_0.0
* @param[in] propertyNotification The propertyNotification to be removed
*/
- void RemovePropertyNotification( Dali::PropertyNotification propertyNotification );
+ void RemovePropertyNotification(Dali::PropertyNotification propertyNotification);
/**
* @brief Removes all property notifications from this object.
* @param[in] tag The tag of the constraints which will be removed
* @pre The Object has been initialized.
*/
- void RemoveConstraints( uint32_t tag );
+ void RemoveConstraints(uint32_t tag);
/**
* @brief Index operator, using integer lookup.
* @param[in] index The index of the property to access.
* @return indirect value. Should have shorter scope than the handle
*/
- IndirectValue operator[]( Property::Index index );
+ IndirectValue operator[](Property::Index index);
/**
* @brief Index operator, using name lookup.
* @param[in] name The name of the property to access.
* @return indirect value. Should have shorter scope than the handle
*/
- IndirectValue operator[]( const std::string& name );
+ IndirectValue operator[](const std::string& name);
public: // Signals
/**
*/
namespace WeightObject
{
-
DALI_CORE_API extern const Property::Index WEIGHT; ///< name "weight", type FLOAT
/**
* limitations under the License.
*/
-
-#include <dali/public-api/object/indirect-value.h>
-#include <dali/public-api/object/handle.h>
#include <dali/internal/event/common/object-impl.h>
+#include <dali/public-api/object/handle.h>
+#include <dali/public-api/object/indirect-value.h>
namespace Dali
{
-
-IndirectValue::IndirectValue( Handle& handle, Property::Index index )
+IndirectValue::IndirectValue(Handle& handle, Property::Index index)
: mHandle(handle.GetObjectPtr()),
mIndex(index),
mExtension(nullptr)
{
}
-void IndirectValue::operator= (Property::Value value)
+void IndirectValue::operator=(Property::Value value)
{
Handle(static_cast<Dali::Internal::Object*>(mHandle.Get())).SetProperty(mIndex, value);
}
return Handle(static_cast<Dali::Internal::Object*>(mHandle.Get())).GetProperty(mIndex);
}
-IndirectValue& IndirectValue::operator=( IndirectValue&& ) = default;
-
-IndirectValue::IndirectValue( IndirectValue&& ) = default;
+IndirectValue& IndirectValue::operator=(IndirectValue&&) = default;
+IndirectValue::IndirectValue(IndirectValue&&) = default;
} // namespace Dali
*/
#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/public-api/object/property.h>
#include <dali/public-api/object/property-value.h>
+#include <dali/public-api/object/property.h>
#include <dali/public-api/object/ref-object.h>
namespace Dali
class Handle;
-
/**
* @brief Dali::IndirectValue is an intermediate object that enables a simpler
* syntax for addressing properties.
* @tparam Type The type of the associated property
* @return The associated property cast to the desired type
*/
- template <typename Type>
+ template<typename Type>
inline operator Type()
{
Property::Value value = GetProperty();
* Making this private to prevent construction of auto type or IndirectValue type.
* @param[in] rhs The object to move
*/
- DALI_INTERNAL IndirectValue( IndirectValue&& rhs );
+ DALI_INTERNAL IndirectValue(IndirectValue&& rhs);
/**
* @brief Move assignment operator.
* Making this private to prevent assignment to auto type or IndirectValue type.
* @param[in] rhs The object to move
*/
- DALI_INTERNAL IndirectValue& operator=( IndirectValue&& rhs );
+ DALI_INTERNAL IndirectValue& operator=(IndirectValue&& rhs);
/**
* @brief Accessor for handle property.
* @param[in] handle A reference to the associated handle
* @param[in] index The index to the associated property
*/
- DALI_INTERNAL IndirectValue( Handle& handle, Property::Index index );
+ DALI_INTERNAL IndirectValue(Handle& handle, Property::Index index);
+
private:
IntrusivePtr<Dali::RefObject> mHandle; ///< A handle to the property owner
- Property::Index mIndex; ///< Index of the property in the property owner.
+ Property::Index mIndex; ///< Index of the property in the property owner.
- struct Extension; ///< Reserved for future use
+ struct Extension; ///< Reserved for future use
Extension* mExtension; ///< Reserved for future use
/// @endcond
namespace Dali
{
-
ObjectRegistry::ObjectRegistry()
{
}
ObjectRegistry& ObjectRegistry::operator=(const ObjectRegistry& rhs) = default;
-ObjectRegistry::ObjectRegistry( ObjectRegistry&& rhs ) = default;
+ObjectRegistry::ObjectRegistry(ObjectRegistry&& rhs) = default;
-ObjectRegistry& ObjectRegistry::operator=( ObjectRegistry&& rhs ) = default;
+ObjectRegistry& ObjectRegistry::operator=(ObjectRegistry&& rhs) = default;
ObjectRegistry::ObjectCreatedSignalType& ObjectRegistry::ObjectCreatedSignal()
{
class DALI_CORE_API ObjectRegistry : public BaseHandle
{
public:
-
// Typedefs
/**
* @brief Object created signal.
* @SINCE_1_0.0
*/
- using ObjectCreatedSignalType = Signal<void( BaseHandle )>;
+ using ObjectCreatedSignalType = Signal<void(BaseHandle)>;
/**
* @brief Object destroyed signal.
* @SINCE_1_0.0
*/
- using ObjectDestroyedSignalType = Signal<void( const Dali::RefObject* )>;
+ using ObjectDestroyedSignalType = Signal<void(const Dali::RefObject*)>;
/**
* @brief Allows the creation of an empty objectRegistry handle.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- ObjectRegistry( ObjectRegistry&& rhs );
+ ObjectRegistry(ObjectRegistry&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- ObjectRegistry& operator=( ObjectRegistry&& rhs );
+ ObjectRegistry& operator=(ObjectRegistry&& rhs);
public: // Signals
-
/**
* @brief This signal is emitted when an object is created.
*
ObjectDestroyedSignalType& ObjectDestroyedSignal();
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Dali Get() method.
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace
{
}; // unnamed namespace
};
Property::Array::Array()
-: mImpl( new Impl )
+: mImpl(new Impl)
{
}
-Property::Array::Array( const std::initializer_list< Property::Value >& values )
+Property::Array::Array(const std::initializer_list<Property::Value>& values)
: Array()
{
- for( auto&& value : values )
+ for(auto&& value : values)
{
- PushBack( value );
+ PushBack(value);
}
}
-Property::Array::Array( const Property::Array& other )
-: mImpl( new Impl )
+Property::Array::Array(const Property::Array& other)
+: mImpl(new Impl)
{
mImpl->mArray = other.mImpl->mArray;
}
-Property::Array::Array( Property::Array&& other )
-: mImpl( other.mImpl )
+Property::Array::Array(Property::Array&& other)
+: mImpl(other.mImpl)
{
other.mImpl = nullptr;
}
Property::Array::SizeType Property::Array::Count() const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
return mImpl->mArray.size();
}
-void Property::Array::PushBack( const Value& value )
+void Property::Array::PushBack(const Value& value)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- mImpl->mArray.push_back( value );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
+ mImpl->mArray.push_back(value);
}
void Property::Array::Clear()
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
mImpl->mArray.clear();
}
-void Property::Array::Reserve( SizeType size )
+void Property::Array::Reserve(SizeType size)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
mImpl->mArray.reserve(size);
}
-void Property::Array::Resize( SizeType size )
+void Property::Array::Resize(SizeType size)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
mImpl->mArray.resize(size);
}
Property::Array::SizeType Property::Array::Capacity()
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
return mImpl->mArray.capacity();
}
-const Property::Value& Property::Array::operator[]( SizeType index ) const
+const Property::Value& Property::Array::operator[](SizeType index) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
// Note says no bounds checking is performed so we don't need to verify mImpl as Count() will return 0 anyway
- return mImpl->mArray[ index ];
+ return mImpl->mArray[index];
}
-Property::Value& Property::Array::operator[]( SizeType index )
+Property::Value& Property::Array::operator[](SizeType index)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
// Note says no bounds checking is performed so we don't need to verify mImpl as Count() will return 0 anyway
- return mImpl->mArray[ index ];
+ return mImpl->mArray[index];
}
-Property::Array& Property::Array::operator=( const Property::Array& other )
+Property::Array& Property::Array::operator=(const Property::Array& other)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- if( this != &other )
+ if(this != &other)
{
mImpl->mArray = other.mImpl->mArray;
}
return *this;
}
-Property::Array& Property::Array::operator=( Property::Array&& other )
+Property::Array& Property::Array::operator=(Property::Array&& other)
{
- if( this != &other )
+ if(this != &other)
{
delete mImpl;
- mImpl = other.mImpl;
+ mImpl = other.mImpl;
other.mImpl = nullptr;
}
return *this;
}
-std::ostream& operator<<( std::ostream& stream, const Property::Array& array )
+std::ostream& operator<<(std::ostream& stream, const Property::Array& array)
{
stream << "Array(" << array.Count() << ") = [";
- for( Property::Array::SizeType i=0; i<array.Count(); ++i )
+ for(Property::Array::SizeType i = 0; i < array.Count(); ++i)
{
- if( i>0 )
+ if(i > 0)
{
stream << ", ";
}
return stream;
}
-
} // namespace Dali
#define DALI_PROPERTY_ARRAY_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
* @SINCE_1_4.17
* @param[in] values An initializer_list of values
*/
- Array( const std::initializer_list< Value >& values );
+ Array(const std::initializer_list<Value>& values);
/**
* @brief Copy constructor.
* @SINCE_1_0.0
* @param[in] other The Array to copy from
*/
- Array( const Array& other );
+ Array(const Array& other);
/**
* @brief Move constructor.
* @param[in] other The Array to move from
* @note After the @a other array is used, it becomes invalid and is no longer usable.
*/
- Array( Array&& other );
+ Array(Array&& other);
/**
* @brief Non-virtual destructor.
* @SINCE_1_0.0
* @param[in] size The size to reserve
*/
- void Reserve( SizeType size );
+ void Reserve(SizeType size);
/**
* @brief Resizes to size.
* @SINCE_1_0.0
* @param[in] size The size to resize
*/
- void Resize( SizeType size );
+ void Resize(SizeType size);
/**
* @brief Retrieves the capacity of the array.
* @SINCE_1_0.0
* @param[in] value The value to add to the end of the array
*/
- void PushBack( const Value& value );
+ void PushBack(const Value& value);
/**
* @brief Add an element to the array.
* @param[in] value The value to add to the end of the array
* @return A reference to this object
*/
- inline Property::Array& Add( const Value& value )
+ inline Property::Array& Add(const Value& value)
{
- PushBack( value );
+ PushBack(value);
return *this;
}
* @param[in] index The element index to access. No bounds checking is performed
* @return The a reference to the element
*/
- const Value& GetElementAt( SizeType index ) const
+ const Value& GetElementAt(SizeType index) const
{
- return operator[]( index );
+ return operator[](index);
}
/**
* @param[in] index The element index to access. No bounds checking is performed
* @return The a reference to the element
*/
- Value& GetElementAt( SizeType index )
+ Value& GetElementAt(SizeType index)
{
- return operator[]( index );
+ return operator[](index);
}
/**
* @return The a reference to the element
*
*/
- const Value& operator[]( SizeType index ) const;
+ const Value& operator[](SizeType index) const;
/**
* @brief Operator to access an element.
* @return The a reference to the element
*
*/
- Value& operator[]( SizeType index );
+ Value& operator[](SizeType index);
/**
* @brief Assignment operator.
*
* @return The copied array.
*/
- Array& operator=( const Array& other );
+ Array& operator=(const Array& other);
/**
* @brief Move assignment operator.
*
* @note After the @a other array is used, it becomes invalid and is no longer usable.
*/
- Array& operator=( Array&& other );
+ Array& operator=(Array&& other);
/**
* @brief Output to stream.
* @SINCE_1_1.28
*/
- friend DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Array& array );
+ friend DALI_CORE_API std::ostream& operator<<(std::ostream& stream, const Property::Array& array);
private:
- struct DALI_INTERNAL Impl; ///< Private data
- Impl* mImpl; ///< Pointer to private data
+ struct DALI_INTERNAL Impl; ///< Private data
+ Impl* mImpl; ///< Pointer to private data
};
/**
* @param[in] array The array to insert
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Array& array );
+DALI_CORE_API std::ostream& operator<<(std::ostream& stream, const Property::Array& array);
/**
* @}
#include <dali/public-api/object/property-conditions.h>
// INTERNAL INCLUDES
-#include <dali/public-api/object/property-value.h>
#include <dali/internal/event/common/property-conditions-impl.h>
+#include <dali/public-api/object/property-value.h>
namespace Dali
{
-
PropertyCondition::PropertyCondition()
: BaseHandle(new Internal::PropertyCondition())
{
-
}
PropertyCondition::~PropertyCondition()
{
-
}
-PropertyCondition::PropertyCondition( const PropertyCondition& handle ) = default;
+PropertyCondition::PropertyCondition(const PropertyCondition& handle) = default;
-PropertyCondition& PropertyCondition::operator=( const PropertyCondition& rhs ) = default;
+PropertyCondition& PropertyCondition::operator=(const PropertyCondition& rhs) = default;
-PropertyCondition::PropertyCondition( PropertyCondition&& rhs ) = default;
+PropertyCondition::PropertyCondition(PropertyCondition&& rhs) = default;
-PropertyCondition& PropertyCondition::operator=( PropertyCondition&& rhs ) = default;
+PropertyCondition& PropertyCondition::operator=(PropertyCondition&& rhs) = default;
std::size_t PropertyCondition::GetArgumentCount() const
{
return GetImplementation(*this).arguments.Count();
}
-float PropertyCondition::GetArgument( std::size_t index ) const
+float PropertyCondition::GetArgument(std::size_t index) const
{
- return GetImplementation(*this).arguments[ index ];
+ return GetImplementation(*this).arguments[index];
}
-PropertyCondition LessThanCondition( float arg )
+PropertyCondition LessThanCondition(float arg)
{
- PropertyCondition condition;
- Internal::PropertyCondition& impl = GetImplementation( condition );
- impl.type = Internal::PropertyCondition::LessThan;
- impl.arguments.PushBack( arg );
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::LessThan;
+ impl.arguments.PushBack(arg);
return condition;
}
-PropertyCondition GreaterThanCondition( float arg )
+PropertyCondition GreaterThanCondition(float arg)
{
- PropertyCondition condition;
- Internal::PropertyCondition& impl = GetImplementation( condition );
- impl.type = Internal::PropertyCondition::GreaterThan;
- impl.arguments.PushBack( arg );
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::GreaterThan;
+ impl.arguments.PushBack(arg);
return condition;
}
-PropertyCondition InsideCondition( float arg0, float arg1 )
+PropertyCondition InsideCondition(float arg0, float arg1)
{
- PropertyCondition condition;
- Internal::PropertyCondition& impl = GetImplementation( condition );
- impl.type = Internal::PropertyCondition::Inside;
- impl.arguments.PushBack( arg0 );
- impl.arguments.PushBack( arg1 );
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::Inside;
+ impl.arguments.PushBack(arg0);
+ impl.arguments.PushBack(arg1);
return condition;
}
-PropertyCondition OutsideCondition( float arg0, float arg1 )
+PropertyCondition OutsideCondition(float arg0, float arg1)
{
- PropertyCondition condition;
- Internal::PropertyCondition& impl = GetImplementation( condition );
- impl.type = Internal::PropertyCondition::Outside;
- impl.arguments.PushBack( arg0 );
- impl.arguments.PushBack( arg1 );
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::Outside;
+ impl.arguments.PushBack(arg0);
+ impl.arguments.PushBack(arg1);
return condition;
}
-PropertyCondition StepCondition( float stepAmount, float referenceValue )
+PropertyCondition StepCondition(float stepAmount, float referenceValue)
{
- PropertyCondition condition;
- Internal::PropertyCondition& impl = GetImplementation( condition );
- impl.type = Internal::PropertyCondition::Step;
- impl.arguments.PushBack( referenceValue );
- impl.arguments.PushBack( 1.0f / stepAmount );
- impl.arguments.PushBack( 0.0f ); // current step
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::Step;
+ impl.arguments.PushBack(referenceValue);
+ impl.arguments.PushBack(1.0f / stepAmount);
+ impl.arguments.PushBack(0.0f); // current step
return condition;
}
-PropertyCondition VariableStepCondition( const Dali::Vector<float>& stepAmount )
+PropertyCondition VariableStepCondition(const Dali::Vector<float>& stepAmount)
{
- PropertyCondition condition;
- Internal::PropertyCondition& impl = GetImplementation( condition );
- impl.type = Internal::PropertyCondition::VariableStep;
- impl.arguments.PushBack( 0.0f ); // current step
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::VariableStep;
+ impl.arguments.PushBack(0.0f); // current step
Dali::Vector<float>::SizeType count = stepAmount.Count();
- impl.arguments.PushBack( float( count ) ); // store number of steps
- for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
+ impl.arguments.PushBack(float(count)); // store number of steps
+ for(Dali::Vector<float>::SizeType index = 0; index < count; ++index)
{
- impl.arguments.PushBack( stepAmount[index] );
+ impl.arguments.PushBack(stepAmount[index]);
}
return condition;
class DALI_CORE_API PropertyCondition : public BaseHandle
{
public:
-
/**
* @brief Constructor for condition clause.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] handle A reference to the copied handle
*/
- PropertyCondition( const PropertyCondition& handle );
+ PropertyCondition(const PropertyCondition& handle);
/**
* @brief This assignment operator is required for (smart) pointer semantics.
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
- PropertyCondition& operator=( const PropertyCondition& rhs );
+ PropertyCondition& operator=(const PropertyCondition& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- PropertyCondition( PropertyCondition&& rhs );
+ PropertyCondition(PropertyCondition&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- PropertyCondition& operator=( PropertyCondition&& rhs );
+ PropertyCondition& operator=(PropertyCondition&& rhs);
public:
-
/**
* @brief Retrieves the arguments that this condition uses.
*
* @return The arguments used for this condition
* @note The container will only be valid as long PropertyCondition is valid.
*/
- float GetArgument( std::size_t index ) const;
-
+ float GetArgument(std::size_t index) const;
};
/**
* @param[in] arg The argument for the condition
* @return A property condition function object
*/
-DALI_CORE_API PropertyCondition LessThanCondition( float arg );
+DALI_CORE_API PropertyCondition LessThanCondition(float arg);
/**
* @brief GreaterThanCondition compares whether property is greater than arg.
* @param[in] arg The argument for the condition
* @return A property condition function object
*/
-DALI_CORE_API PropertyCondition GreaterThanCondition( float arg );
+DALI_CORE_API PropertyCondition GreaterThanCondition(float arg);
/**
* @brief InsideCondition compares whether property is greater than arg0 and less than arg1.
* @param[in] arg1 The second argument for the condition
* @return A property condition function object
*/
-DALI_CORE_API PropertyCondition InsideCondition( float arg0, float arg1 );
+DALI_CORE_API PropertyCondition InsideCondition(float arg0, float arg1);
/**
* @brief OutsideCondition compares whether property is less than arg0 or greater than arg1.
* @param[in] arg1 The second argument for the condition
* @return A property condition function object
*/
-DALI_CORE_API PropertyCondition OutsideCondition( float arg0, float arg1 );
+DALI_CORE_API PropertyCondition OutsideCondition(float arg0, float arg1);
/**
* @brief Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount.
* @param[in] initialValue The initial value to step from
* @return A property condition function object
*/
-DALI_CORE_API PropertyCondition StepCondition( float stepAmount, float initialValue = 0.0f );
+DALI_CORE_API PropertyCondition StepCondition(float stepAmount, float initialValue = 0.0f);
/**
* @brief Receives notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending.
* @param[in] steps List of values to receive notifications for as a property crosses them
* @return A property condition function object
*/
-DALI_CORE_API PropertyCondition VariableStepCondition( const Dali::Vector<float>& steps );
+DALI_CORE_API PropertyCondition VariableStepCondition(const Dali::Vector<float>& steps);
/**
* @}
#define DALI_PROPERTY_INDEX_RANGES_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
* used to compare property indices.
* @SINCE_1_0.0
*/
+// clang-format off
enum PropertyRanges
{
- DEFAULT_OBJECT_PROPERTY_START_INDEX = 0, ///< For all objects deriving from Handle (including Actors). @SINCE_1_0.0
-
- DEFAULT_ACTOR_PROPERTY_START_INDEX = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< Start index for Actor. @SINCE_1_0.0
- DEFAULT_ACTOR_PROPERTY_MAX_COUNT = 10000, ///< Actor range: 0 to 9999 @SINCE_1_0.0
+ DEFAULT_OBJECT_PROPERTY_START_INDEX = 0, ///< For all objects deriving from Handle (including Actors). @SINCE_1_0.0
+ DEFAULT_ACTOR_PROPERTY_START_INDEX = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< Start index for Actor. @SINCE_1_0.0
+ DEFAULT_ACTOR_PROPERTY_MAX_COUNT = 10000, ///< Actor range: 0 to 9999 @SINCE_1_0.0
DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX = DEFAULT_ACTOR_PROPERTY_START_INDEX + DEFAULT_ACTOR_PROPERTY_MAX_COUNT, ///< Property start index for classes deriving directly from Actor. @SINCE_1_0.0
+ DEFAULT_PROPERTY_MAX_COUNT_PER_DERIVATION = 10000, ///< Second-level and onwards derived objects should increment their start index by this. @SINCE_1_0.0
- DEFAULT_PROPERTY_MAX_COUNT_PER_DERIVATION = 10000, ///< Second-level and onwards derived objects should increment their start index by this. @SINCE_1_0.0
-
- DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, ///< Used by PanGestureDetector. @SINCE_1_0.0
+ DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, ///< Used by PanGestureDetector. @SINCE_1_0.0
- DEFAULT_RENDERER_PROPERTY_START_INDEX = 9000000, ///< Start index for Renderer. @SINCE_1_1.44
- DEFAULT_RENDERER_PROPERTY_MAX_INDEX = DEFAULT_RENDERER_PROPERTY_START_INDEX + 100000, ///< Renderer range: 9000000 to 9100000 @SINCE_1_1.44
+ DEFAULT_RENDERER_PROPERTY_START_INDEX = 9000000, ///< Start index for Renderer. @SINCE_1_1.44
+ DEFAULT_RENDERER_PROPERTY_MAX_INDEX = DEFAULT_RENDERER_PROPERTY_START_INDEX + 100000, ///< Renderer range: 9000000 to 9100000 @SINCE_1_1.44
- PROPERTY_REGISTRATION_START_INDEX = 10000000, ///< The index when registering a property should start from this number. @SINCE_1_0.0
- DEFAULT_PROPERTY_MAX_COUNT = PROPERTY_REGISTRATION_START_INDEX, ///< Default Property Range: 0 to 9999999 @SINCE_1_0.0
+ PROPERTY_REGISTRATION_START_INDEX = 10000000, ///< The index when registering a property should start from this number. @SINCE_1_0.0
+ DEFAULT_PROPERTY_MAX_COUNT = PROPERTY_REGISTRATION_START_INDEX, ///< Default Property Range: 0 to 9999999 @SINCE_1_0.0
- PROPERTY_REGISTRATION_MAX_INDEX = 19999999, ///< The maximum index supported when registering a property @SINCE_1_0.0
+ PROPERTY_REGISTRATION_MAX_INDEX = 19999999, ///< The maximum index supported when registering a property @SINCE_1_0.0
- ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX = 20000000, ///< The index when registering an animatable property should start from this number. (SceneGraph properties per type) @SINCE_1_0.0
- ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX = 29999999, ///< The maximum index supported when registering an animatable property @SINCE_1_0.0
+ ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX = 20000000, ///< The index when registering an animatable property should start from this number. (SceneGraph properties per type) @SINCE_1_0.0
+ ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX = 29999999, ///< The maximum index supported when registering an animatable property @SINCE_1_0.0
- CHILD_PROPERTY_REGISTRATION_START_INDEX = 45000000, ///< The index when registering a child property should start from this number. (Event side properties per instance) @SINCE_1_1.35
- CHILD_PROPERTY_REGISTRATION_MAX_INDEX = 49999999, ///< The maximum index supported when registering a child property @SINCE_1_1.35
+ CHILD_PROPERTY_REGISTRATION_START_INDEX = 45000000, ///< The index when registering a child property should start from this number. (Event side properties per instance) @SINCE_1_1.35
+ 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
+ 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
+ CORE_PROPERTY_MAX_INDEX = PROPERTY_CUSTOM_MAX_INDEX, ///< The maximum index that Core properties can go up to @SINCE_1_1.45
};
+// clang-format on
/**
* @}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
PropertyInput::~PropertyInput()
{
}
#define DALI_PROPERTY_INPUT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
class DALI_CORE_API PropertyInput
{
public:
-
class Extension; ///< Forward declare future extension interface
/**
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// CLASS HEADER
#include <dali/public-api/object/property-key.h>
-
namespace Dali
{
-
-Property::Key::Key( const std::string& key )
-: type( Key::STRING ),
- indexKey( Property::INVALID_INDEX ),
- stringKey( key )
+Property::Key::Key(const std::string& key)
+: type(Key::STRING),
+ indexKey(Property::INVALID_INDEX),
+ stringKey(key)
{
}
-Property::Key::Key( Property::Index key )
-: type( Key::INDEX ),
- indexKey( key )
+Property::Key::Key(Property::Index key)
+: type(Key::INDEX),
+ indexKey(key)
{
}
-Property::Key::Key( const char * key )
-: type( Key::STRING ),
- indexKey( Property::INVALID_INDEX ),
- stringKey( key )
+Property::Key::Key(const char* key)
+: type(Key::STRING),
+ indexKey(Property::INVALID_INDEX),
+ stringKey(key)
{
}
-bool Property::Key::operator== (const std::string& rhs)
+bool Property::Key::operator==(const std::string& rhs)
{
- bool result=false;
+ bool result = false;
if(type == Key::STRING)
{
result = (stringKey == rhs);
return result;
}
-bool Property::Key::operator== ( const char* rhs )
+bool Property::Key::operator==(const char* rhs)
{
- return operator==( std::string( rhs ) );
+ return operator==(std::string(rhs));
}
-bool Property::Key::operator== (Property::Index rhs)
+bool Property::Key::operator==(Property::Index rhs)
{
- bool result=false;
+ bool result = false;
if(type == Key::INDEX)
{
result = (indexKey == rhs);
return result;
}
-bool Property::Key::operator== (const Key& rhs)
+bool Property::Key::operator==(const Key& rhs)
{
- bool result=false;
- if(type == Key::STRING && rhs.type == Key::STRING )
+ bool result = false;
+ if(type == Key::STRING && rhs.type == Key::STRING)
{
result = (stringKey == rhs.stringKey);
}
- else if( type == Key::INDEX && rhs.type == Key::INDEX )
+ else if(type == Key::INDEX && rhs.type == Key::INDEX)
{
result = (indexKey == rhs.indexKey);
}
return result;
}
-bool Property::Key::operator!= (const std::string& rhs)
+bool Property::Key::operator!=(const std::string& rhs)
{
return !operator==(rhs);
}
-bool Property::Key::operator!= ( const char* rhs )
+bool Property::Key::operator!=(const char* rhs)
{
return !operator==(rhs);
}
-bool Property::Key::operator!= (Property::Index rhs)
+bool Property::Key::operator!=(Property::Index rhs)
{
return !operator==(rhs);
}
-bool Property::Key::operator!= (const Key& rhs)
+bool Property::Key::operator!=(const Key& rhs)
{
return !operator==(rhs);
}
-std::ostream& operator<<( std::ostream& stream, const Property::Key& key )
+std::ostream& operator<<(std::ostream& stream, const Property::Key& key)
{
- if( key.type == Property::Key::INDEX )
+ if(key.type == Property::Key::INDEX)
{
stream << key.indexKey;
}
#define DALI_PROPERTY_KEY_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <sstream>
+#include <string>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
{
INDEX, ///< The key is a Property::Index
STRING ///< The key is a string
- } type; ///< The type of the key
+ } type; ///< The type of the key
- Property::Index indexKey; ///< The index key.
- std::string stringKey; ///< The string key.
+ Property::Index indexKey; ///< The index key.
+ std::string stringKey; ///< The string key.
/**
* @brief Constructor
*
* @param[in] key The string key
*/
- Key( const std::string& key );
+ Key(const std::string& key);
/**
* @brief Constructor
*
* @param[in] key The string key as a const char *
*/
- Key( const char * key );
+ Key(const char* key);
/**
* @brief Constructor
*
* @param[in] key The index key
*/
- Key( Property::Index key );
+ Key(Property::Index key);
/**
* @brief The equality operator
* @param[in] rhs A string key to compare against.
* @return true if the key compares, or false if it isn't equal or of the wrong type
*/
- bool operator== (const std::string& rhs);
+ bool operator==(const std::string& rhs);
/**
* @brief Constructor
* @param[in] key The string key as a const char *
* @return true if the key compares, or false if it isn't equal or of the wrong type
*/
- bool operator== ( const char * key );
+ bool operator==(const char* key);
/**
* @brief The equality operator
* @param[in] rhs An index key to compare against.
* @return true if the key compares, or false if it isn't equal or of the wrong type
*/
- bool operator== (Property::Index rhs);
+ bool operator==(Property::Index rhs);
/**
* @brief The equality operator
* @param[in] rhs A key to compare against.
* @return true if the keys are of the same type and have the same value
*/
- bool operator== (const Key& rhs);
+ bool operator==(const Key& rhs);
/**
* @brief The inequality operator
* @param[in] rhs A string key to compare against.
* @return true if the key is not equal or not a string key
*/
- bool operator!= (const std::string& rhs);
+ bool operator!=(const std::string& rhs);
/**
* @brief The inequality operator
* @param[in] rhs A const char* key to compare against.
* @return true if the key is not equal or not a string key
*/
- bool operator!= ( const char* rhs );
+ bool operator!=(const char* rhs);
/**
* @brief The inequality operator
* @param[in] rhs An index key to compare against.
* @return true if the key is not equal, or not an index key
*/
- bool operator!= (Property::Index rhs);
+ bool operator!=(Property::Index rhs);
/**
* @brief The inequality operator
* @param[in] rhs A key to compare against.
* @return true if the keys are not of the same type or are not equal
*/
- bool operator!= (const Key& rhs);
+ bool operator!=(const Key& rhs);
};
/**
* @param [in] key the key to convert
* @return The output stream operator.
*/
-DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Key& key );
-
+DALI_CORE_API std::ostream& operator<<(std::ostream& stream, const Property::Key& key);
/**
* @}
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace
{
-typedef std::vector< StringValuePair > StringValueContainer;
+typedef std::vector<StringValuePair> StringValueContainer;
using IndexValuePair = std::pair<Property::Index, Property::Value>;
using IndexValueContainer = std::vector<IndexValuePair>;
}; // unnamed namespace
-
struct Property::Map::Impl
{
StringValueContainer mStringValueContainer;
- IndexValueContainer mIndexValueContainer;
+ IndexValueContainer mIndexValueContainer;
};
Property::Map::Map()
-: mImpl( new Impl )
+: mImpl(new Impl)
{
}
-Property::Map::Map( const std::initializer_list< KeyValuePair >& values ) : Map()
+Property::Map::Map(const std::initializer_list<KeyValuePair>& values)
+: Map()
{
- for( auto&& value : values )
+ for(auto&& value : values)
{
const auto& key = value.first;
- switch( key.type )
+ switch(key.type)
{
case Property::Key::INDEX:
{
- Property::Map::Insert( key.indexKey, value.second );
+ Property::Map::Insert(key.indexKey, value.second);
break;
}
case Property::Key::STRING:
{
- Property::Map::Insert( key.stringKey, value.second );
+ Property::Map::Insert(key.stringKey, value.second);
break;
}
}
}
}
-Property::Map::Map( const Property::Map& other )
-: mImpl( new Impl )
+Property::Map::Map(const Property::Map& other)
+: mImpl(new Impl)
{
mImpl->mStringValueContainer = other.mImpl->mStringValueContainer;
- mImpl->mIndexValueContainer = other.mImpl->mIndexValueContainer;
+ mImpl->mIndexValueContainer = other.mImpl->mIndexValueContainer;
}
-Property::Map::Map( Property::Map&& other )
-: mImpl( other.mImpl )
+Property::Map::Map(Property::Map&& other)
+: mImpl(other.mImpl)
{
other.mImpl = nullptr;
}
Property::Map::SizeType Property::Map::Count() const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
return mImpl->mStringValueContainer.size() + mImpl->mIndexValueContainer.size();
}
bool Property::Map::Empty() const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
return mImpl->mStringValueContainer.empty() && mImpl->mIndexValueContainer.empty();
}
-void Property::Map::Insert( const char* key, const Value& value )
+void Property::Map::Insert(const char* key, const Value& value)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- mImpl->mStringValueContainer.push_back( std::make_pair( key, value ) );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
+ mImpl->mStringValueContainer.push_back(std::make_pair(key, value));
}
-void Property::Map::Insert( const std::string& key, const Value& value )
+void Property::Map::Insert(const std::string& key, const Value& value)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- mImpl->mStringValueContainer.push_back( std::make_pair( key, value ) );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
+ mImpl->mStringValueContainer.push_back(std::make_pair(key, value));
}
-void Property::Map::Insert( Property::Index key, const Value& value )
+void Property::Map::Insert(Property::Index key, const Value& value)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
- mImpl->mIndexValueContainer.push_back( std::make_pair( key, value ) );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
+ mImpl->mIndexValueContainer.push_back(std::make_pair(key, value));
}
-Property::Value& Property::Map::GetValue( SizeType position ) const
+Property::Value& Property::Map::GetValue(SizeType position) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
SizeType numStringKeys = mImpl->mStringValueContainer.size();
SizeType numIndexKeys = mImpl->mIndexValueContainer.size();
- DALI_ASSERT_ALWAYS( position < ( numStringKeys + numIndexKeys ) && "position out-of-bounds" );
+ DALI_ASSERT_ALWAYS(position < (numStringKeys + numIndexKeys) && "position out-of-bounds");
- if( position < numStringKeys )
+ if(position < numStringKeys)
{
- return mImpl->mStringValueContainer[ position ].second;
+ return mImpl->mStringValueContainer[position].second;
}
else
{
- return mImpl->mIndexValueContainer[ position-numStringKeys ].second;
+ return mImpl->mIndexValueContainer[position - numStringKeys].second;
}
}
-const std::string& Property::Map::GetKey( SizeType position ) const
+const std::string& Property::Map::GetKey(SizeType position) const
{
- DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetKey() is deprecated and will be removed from next release.\n" );
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetKey() is deprecated and will be removed from next release.\n");
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
SizeType numStringKeys = mImpl->mStringValueContainer.size();
- DALI_ASSERT_ALWAYS( position < numStringKeys && "position out-of-bounds" );
+ DALI_ASSERT_ALWAYS(position < numStringKeys && "position out-of-bounds");
- return mImpl->mStringValueContainer[ position ].first;
+ return mImpl->mStringValueContainer[position].first;
}
-Property::Key Property::Map::GetKeyAt( SizeType position ) const
+Property::Key Property::Map::GetKeyAt(SizeType position) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
SizeType numStringKeys = mImpl->mStringValueContainer.size();
SizeType numIndexKeys = mImpl->mIndexValueContainer.size();
- DALI_ASSERT_ALWAYS( position < ( numStringKeys + numIndexKeys ) && "position out-of-bounds" );
+ DALI_ASSERT_ALWAYS(position < (numStringKeys + numIndexKeys) && "position out-of-bounds");
- if( position < numStringKeys )
+ if(position < numStringKeys)
{
- Key key(mImpl->mStringValueContainer[ position ].first);
+ Key key(mImpl->mStringValueContainer[position].first);
return key;
}
else
{
- Key key( mImpl->mIndexValueContainer[ position-numStringKeys ].first );
+ Key key(mImpl->mIndexValueContainer[position - numStringKeys].first);
return key;
}
}
-StringValuePair& Property::Map::GetPair( SizeType position ) const
+StringValuePair& Property::Map::GetPair(SizeType position) const
{
- DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetPair() is deprecated and will be removed from next release.\n" );
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetPair() is deprecated and will be removed from next release.\n");
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
SizeType numStringKeys = mImpl->mStringValueContainer.size();
- DALI_ASSERT_ALWAYS( position < ( numStringKeys ) && "position out-of-bounds" );
+ DALI_ASSERT_ALWAYS(position < (numStringKeys) && "position out-of-bounds");
- return mImpl->mStringValueContainer[ position ];
+ return mImpl->mStringValueContainer[position];
}
-KeyValuePair Property::Map::GetKeyValue( SizeType position ) const
+KeyValuePair Property::Map::GetKeyValue(SizeType position) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
SizeType numStringKeys = mImpl->mStringValueContainer.size();
SizeType numIndexKeys = mImpl->mIndexValueContainer.size();
- DALI_ASSERT_ALWAYS( position < ( numStringKeys + numIndexKeys ) && "position out-of-bounds" );
+ DALI_ASSERT_ALWAYS(position < (numStringKeys + numIndexKeys) && "position out-of-bounds");
- if( position < numStringKeys )
+ if(position < numStringKeys)
{
- Key key(mImpl->mStringValueContainer[ position ].first);
- KeyValuePair keyValue(key, mImpl->mStringValueContainer[ position ].second );
+ Key key(mImpl->mStringValueContainer[position].first);
+ KeyValuePair keyValue(key, mImpl->mStringValueContainer[position].second);
return keyValue;
}
else
{
- Key key( mImpl->mIndexValueContainer[ position-numStringKeys ].first );
- KeyValuePair keyValue(key, mImpl->mIndexValueContainer[ position-numStringKeys ].second );
+ Key key(mImpl->mIndexValueContainer[position - numStringKeys].first);
+ KeyValuePair keyValue(key, mImpl->mIndexValueContainer[position - numStringKeys].second);
return keyValue;
}
}
-Property::Value* Property::Map::Find( const char* key ) const
+Property::Value* Property::Map::Find(const char* key) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- for( auto&& iter : mImpl->mStringValueContainer )
+ for(auto&& iter : mImpl->mStringValueContainer)
{
- if ( iter.first == key )
+ if(iter.first == key)
{
return &iter.second;
}
return nullptr; // Not found
}
-Property::Value* Property::Map::Find( const std::string& key ) const
+Property::Value* Property::Map::Find(const std::string& key) const
{
- return Find( key.c_str() );
+ return Find(key.c_str());
}
-Property::Value* Property::Map::Find( Property::Index key ) const
+Property::Value* Property::Map::Find(Property::Index key) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- for( auto&& iter : mImpl->mIndexValueContainer )
+ for(auto&& iter : mImpl->mIndexValueContainer)
{
- if ( iter.first == key )
+ if(iter.first == key)
{
return &iter.second;
}
return nullptr; // Not found
}
-Property::Value* Property::Map::Find( Property::Index indexKey, const std::string& stringKey ) const
+Property::Value* Property::Map::Find(Property::Index indexKey, const std::string& stringKey) const
{
- Property::Value* valuePtr = Find( indexKey );
- if( !valuePtr )
+ Property::Value* valuePtr = Find(indexKey);
+ if(!valuePtr)
{
- valuePtr = Find( stringKey );
+ valuePtr = Find(stringKey);
}
return valuePtr;
}
-Property::Value* Property::Map::Find( const std::string& key, Property::Type type ) const
+Property::Value* Property::Map::Find(const std::string& key, Property::Type type) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- for( auto&& iter : mImpl->mStringValueContainer )
+ for(auto&& iter : mImpl->mStringValueContainer)
{
- if( (iter.second.GetType() == type) && (iter.first == key) )
+ if((iter.second.GetType() == type) && (iter.first == key))
{
return &iter.second;
}
return nullptr; // Not found
}
-Property::Value* Property::Map::Find( Property::Index key, Property::Type type ) const
+Property::Value* Property::Map::Find(Property::Index key, Property::Type type) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- for( auto&& iter : mImpl->mIndexValueContainer )
+ for(auto&& iter : mImpl->mIndexValueContainer)
{
- if( (iter.second.GetType() == type) && (iter.first == key) )
+ if((iter.second.GetType() == type) && (iter.first == key))
{
return &iter.second;
}
void Property::Map::Clear()
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
mImpl->mStringValueContainer.clear();
mImpl->mIndexValueContainer.clear();
}
-void Property::Map::Merge( const Property::Map& from )
+void Property::Map::Merge(const Property::Map& from)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
// Ensure we're not attempting to merge with ourself
- if ( this != &from )
+ if(this != &from)
{
- if ( Count() )
+ if(Count())
{
- for( auto&& iter : from.mImpl->mStringValueContainer )
+ for(auto&& iter : from.mImpl->mStringValueContainer)
{
(*this)[iter.first] = iter.second;
}
- for( auto&& iter : from.mImpl->mIndexValueContainer )
+ for(auto&& iter : from.mImpl->mIndexValueContainer)
{
(*this)[iter.first] = iter.second;
}
}
}
-const Property::Value& Property::Map::operator[]( const std::string& key ) const
+const Property::Value& Property::Map::operator[](const std::string& key) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- for( auto&& iter : mImpl->mStringValueContainer )
+ for(auto&& iter : mImpl->mStringValueContainer)
{
- if ( iter.first == key )
+ if(iter.first == key)
{
return iter.second;
}
}
- DALI_ASSERT_ALWAYS( ! "Invalid Key" );
+ DALI_ASSERT_ALWAYS(!"Invalid Key");
}
-Property::Value& Property::Map::operator[]( const std::string& key )
+Property::Value& Property::Map::operator[](const std::string& key)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- for( auto&& iter : mImpl->mStringValueContainer )
+ for(auto&& iter : mImpl->mStringValueContainer)
{
- if ( iter.first == key )
+ if(iter.first == key)
{
return iter.second;
}
}
// Create and return reference to new value
- mImpl->mStringValueContainer.push_back( std::make_pair( key, Property::Value() ) );
+ mImpl->mStringValueContainer.push_back(std::make_pair(key, Property::Value()));
return (mImpl->mStringValueContainer.end() - 1)->second;
}
-const Property::Value& Property::Map::operator[]( Property::Index key ) const
+const Property::Value& Property::Map::operator[](Property::Index key) const
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- for( auto&& iter : mImpl->mIndexValueContainer )
+ for(auto&& iter : mImpl->mIndexValueContainer)
{
- if ( iter.first == key )
+ if(iter.first == key)
{
return iter.second;
}
}
- DALI_ASSERT_ALWAYS( ! "Invalid Key" );
+ DALI_ASSERT_ALWAYS(!"Invalid Key");
}
-Property::Value& Property::Map::operator[]( Property::Index key )
+Property::Value& Property::Map::operator[](Property::Index key)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- for( auto&& iter : mImpl->mIndexValueContainer )
+ for(auto&& iter : mImpl->mIndexValueContainer)
{
- if ( iter.first == key )
+ if(iter.first == key)
{
return iter.second;
}
}
// Create and return reference to new value
- mImpl->mIndexValueContainer.push_back( std::make_pair( key, Property::Value() ) );
+ mImpl->mIndexValueContainer.push_back(std::make_pair(key, Property::Value()));
return (mImpl->mIndexValueContainer.end() - 1)->second;
}
-Property::Map& Property::Map::operator=( const Property::Map& other )
+Property::Map& Property::Map::operator=(const Property::Map& other)
{
- DALI_ASSERT_DEBUG( mImpl && "Cannot use an object previously used as an r-value" );
+ DALI_ASSERT_DEBUG(mImpl && "Cannot use an object previously used as an r-value");
- if( this != &other )
+ if(this != &other)
{
mImpl->mStringValueContainer = other.mImpl->mStringValueContainer;
- mImpl->mIndexValueContainer = other.mImpl->mIndexValueContainer;
+ mImpl->mIndexValueContainer = other.mImpl->mIndexValueContainer;
}
return *this;
}
-Property::Map& Property::Map::operator=( Property::Map&& other )
+Property::Map& Property::Map::operator=(Property::Map&& other)
{
- if( this != &other )
+ if(this != &other)
{
delete mImpl;
- mImpl = other.mImpl;
+ mImpl = other.mImpl;
other.mImpl = nullptr;
}
return *this;
}
-std::ostream& operator<<( std::ostream& stream, const Property::Map& map )
+std::ostream& operator<<(std::ostream& stream, const Property::Map& map)
{
stream << "Map(" << map.Count() << ") = {";
- if ( map.mImpl )
+ if(map.mImpl)
{
int32_t count = 0;
// Output the String-Value pairs
- for( auto&& iter : map.mImpl->mStringValueContainer )
+ for(auto&& iter : map.mImpl->mStringValueContainer)
{
- if( count++ > 0 )
+ if(count++ > 0)
{
- stream<<", ";
+ stream << ", ";
}
- stream<< iter.first << ":" << iter.second;
+ stream << iter.first << ":" << iter.second;
}
// Output the Index-Value pairs
- for( auto&& iter : map.mImpl->mIndexValueContainer )
+ for(auto&& iter : map.mImpl->mIndexValueContainer)
{
- if( count++ > 0 )
+ if(count++ > 0)
{
- stream<<", ";
+ stream << ", ";
}
- stream<< iter.first << ":" << iter.second;
+ stream << iter.first << ":" << iter.second;
}
}
#define DALI_PROPERTY_MAP_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <sstream>
#include <initializer_list>
+#include <sstream>
+#include <string>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/property.h>
#include <dali/public-api/object/property-key.h>
#include <dali/public-api/object/property-value.h>
+#include <dali/public-api/object/property.h>
namespace Dali
{
* @SINCE_1_4.17
* @param[in] values An initializer_list of pairs of index and value.
*/
- Map( const std::initializer_list< KeyValuePair >& values );
+ Map(const std::initializer_list<KeyValuePair>& values);
/**
* @brief Copy constructor.
* @SINCE_1_0.0
* @param[in] other The Map to copy from
*/
- Map( const Map& other );
+ Map(const Map& other);
/**
* @brief Move constructor.
* @param[in] other The Map to move from
* @note After the @a other array is used, it becomes invalid and is no longer usable.
*/
- Map( Map&& other );
+ Map(Map&& other);
/**
* @brief Non-virtual destructor.
* @param[in] key The key to insert
* @param[in] value The value to insert
*/
- void Insert( const char* key, const Value& value );
+ void Insert(const char* key, const Value& value);
/**
* @brief Inserts the key-value pair in the Map, with the key type as string.
* @param[in] key The key to insert
* @param[in] value The value to insert
*/
- void Insert( const std::string& key, const Value& value );
+ void Insert(const std::string& key, const Value& value);
/**
* @brief Inserts the key-value pair in the Map, with the key type as index.
* @param[in] key The key to insert
* @param[in] value The value to insert
*/
- void Insert( Property::Index key, const Value& value );
-
+ void Insert(Property::Index key, const Value& value);
/**
* @brief Inserts the key-value pair in the Map, with the key type as string.
* @param value to insert
* @return a reference to this object
*/
- inline Property::Map& Add( const char* key, const Value& value )
+ inline Property::Map& Add(const char* key, const Value& value)
{
Insert(key, value);
return *this;
* @param value to insert
* @return a reference to this object
*/
- inline Property::Map& Add( const std::string& key, const Value& value )
+ inline Property::Map& Add(const std::string& key, const Value& value)
{
Insert(key, value);
return *this;
}
-
/**
* @brief Inserts the key-value pair in the Map, with the key type as index.
*
* @param value to insert
* @return a reference to this object
*/
- inline Property::Map& Add( Property::Index key, const Value& value )
+ inline Property::Map& Add(Property::Index key, const Value& value)
{
Insert(key, value);
return *this;
*
* @note Will assert if position >= Count()
*/
- Value& GetValue( SizeType position ) const;
+ Value& GetValue(SizeType position) const;
/**
* DEPRECATED_1_1.39 Position based retrieval is no longer supported after extending the key type to both Index and String.
*
* @note Will assert if position >= Count()
*/
- const std::string& GetKey( SizeType position ) const DALI_DEPRECATED_API;
+ const std::string& GetKey(SizeType position) const DALI_DEPRECATED_API;
/**
* @brief Retrieve the key at the specified position.
*
* @note Will assert if position >= Count()
*/
- Key GetKeyAt( SizeType position ) const;
+ Key GetKeyAt(SizeType position) const;
/**
* DEPRECATED_1_1.39 Position based retrieval is no longer supported after extending the key type to both Index and String.
*
* @note Will assert if position >= Count() or key at position is an index key.
*/
- StringValuePair& GetPair( SizeType position ) const DALI_DEPRECATED_API;
+ StringValuePair& GetPair(SizeType position) const DALI_DEPRECATED_API;
/**
* @brief Retrieve the key & the value at the specified position.
*
* @note Will assert if position >= Count()
*/
- KeyValuePair GetKeyValue( SizeType position ) const;
+ KeyValuePair GetKeyValue(SizeType position) const;
/**
* @brief Finds the value for the specified key if it exists.
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find( const char* key ) const;
+ Value* Find(const char* key) const;
/**
* @brief Finds the value for the specified key if it exists.
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find( const std::string& key ) const;
+ Value* Find(const std::string& key) const;
/**
* @brief Finds the value for the specified key if it exists.
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find( Property::Index key ) const;
+ Value* Find(Property::Index key) const;
/**
* @brief Finds the value for the specified keys if either exist.
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find( Property::Index indexKey, const std::string& stringKey ) const;
+ Value* Find(Property::Index indexKey, const std::string& stringKey) const;
/**
* @brief Finds the value for the specified key if it exists and its type is type.
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find( const std::string& key, Property::Type type ) const;
+ Value* Find(const std::string& key, Property::Type type) const;
/**
* @brief Finds the value for the specified key if it exists and its type is type.
*
* @return A const pointer to the value if it exists, NULL otherwise
*/
- Value* Find( Property::Index key, Property::Type type ) const;
+ Value* Find(Property::Index key, Property::Type type) const;
/**
* @brief Clears the map.
* @SINCE_1_0.0
* @param[in] from The map to merge from
*/
- void Merge( const Map& from );
+ void Merge(const Map& from);
/**
* @brief Const operator to access element with the specified string key.
*
* @note Will assert if invalid-key is given.
*/
- const Value& operator[]( const std::string& key ) const;
+ const Value& operator[](const std::string& key) const;
/**
* @brief Operator to access the element with the specified string key.
*
* @note If an element with the key does not exist, then it is created.
*/
- Value& operator[]( const std::string& key );
+ Value& operator[](const std::string& key);
/**
* @brief Const operator to access element with the specified index key.
*
* @note Will assert if invalid-key is given.
*/
- const Value& operator[]( Property::Index key ) const;
+ const Value& operator[](Property::Index key) const;
/**
* @brief Operator to access the element with the specified index key.
*
* @note If an element with the key does not exist, then it is created.
*/
- Value& operator[]( Property::Index key );
+ Value& operator[](Property::Index key);
/**
* @brief Assignment operator.
*
* @return The copied map
*/
- Map& operator=( const Map& other );
+ Map& operator=(const Map& other);
/**
* @brief Move assignment operator.
*
* @note The other array is an r-value so becomes invalid and is no longer usable.
*/
- Map& operator=( Map&& other );
+ Map& operator=(Map&& other);
/**
* @brief Output to stream.
* @SINCE_1_1.28
*/
- friend DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Map& map );
+ friend DALI_CORE_API std::ostream& operator<<(std::ostream& stream, const Property::Map& map);
private:
- struct DALI_INTERNAL Impl; ///< Private data
- Impl* mImpl; ///< Pointer to private data
+ struct DALI_INTERNAL Impl; ///< Private data
+ Impl* mImpl; ///< Pointer to private data
};
/**
* @param[in] map The map to insert
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Map& map );
+DALI_CORE_API std::ostream& operator<<(std::ostream& stream, const Property::Map& map);
/**
* @}
#define DALI_PROPERTY_NOTIFICATION_DECLARATIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
*/
-
// INTERNAL INCLUDES
#include <dali/public-api/signals/dali-signal.h>
* @brief Signal type for Dali::PropertyNotification::NotifySignal().
* @SINCE_1_0.0
*/
-using PropertyNotifySignalType = Signal<void( PropertyNotification& )>;
+using PropertyNotifySignalType = Signal<void(PropertyNotification&)>;
/**
* @}
#include <dali/public-api/object/property-notification.h>
// INTERNAL INCLUDES
-#include <dali/public-api/math/quaternion.h>
+#include <dali/internal/event/common/property-notification-impl.h>
#include <dali/public-api/math/degree.h>
+#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/radian.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/object/handle.h>
-#include <dali/internal/event/common/property-notification-impl.h>
#include <stdio.h>
namespace Dali
{
-
PropertyNotification::PropertyNotification()
{
}
{
}
-PropertyNotification PropertyNotification::DownCast( BaseHandle handle )
+PropertyNotification PropertyNotification::DownCast(BaseHandle handle)
{
- return PropertyNotification( dynamic_cast<Dali::Internal::PropertyNotification*>(handle.GetObjectPtr()) );
+ return PropertyNotification(dynamic_cast<Dali::Internal::PropertyNotification*>(handle.GetObjectPtr()));
}
PropertyNotification::~PropertyNotification()
PropertyNotification& PropertyNotification::operator=(const PropertyNotification& rhs) = default;
-PropertyNotification::PropertyNotification( PropertyNotification&& rhs ) = default;
+PropertyNotification::PropertyNotification(PropertyNotification&& rhs) = default;
-PropertyNotification& PropertyNotification::operator=( PropertyNotification&& rhs ) = default;
+PropertyNotification& PropertyNotification::operator=(PropertyNotification&& rhs) = default;
PropertyCondition PropertyNotification::GetCondition()
{
return GetImplementation(*this).GetTargetProperty();
}
-void PropertyNotification::SetNotifyMode( NotifyMode mode )
+void PropertyNotification::SetNotifyMode(NotifyMode mode)
{
- GetImplementation(*this).SetNotifyMode( mode );
+ GetImplementation(*this).SetNotifyMode(mode);
}
PropertyNotification::NotifyMode PropertyNotification::GetNotifyMode()
// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/object/property-notification-declarations.h>
#include <dali/public-api/object/property-conditions.h>
+#include <dali/public-api/object/property-notification-declarations.h>
#include <dali/public-api/object/property.h>
namespace Dali
*/
enum NotifyMode
{
- DISABLED, ///< Don't notify, regardless of result of Condition @SINCE_1_9.28
- NOTIFY_ON_TRUE, ///< Notify whenever condition changes from false to true. @SINCE_1_9.28
- NOTIFY_ON_FALSE, ///< Notify whenever condition changes from true to false. @SINCE_1_9.28
- NOTIFY_ON_CHANGED ///< Notify whenever condition changes (false to true, and true to false) @SINCE_1_9.28
+ DISABLED, ///< Don't notify, regardless of result of Condition @SINCE_1_9.28
+ NOTIFY_ON_TRUE, ///< Notify whenever condition changes from false to true. @SINCE_1_9.28
+ NOTIFY_ON_FALSE, ///< Notify whenever condition changes from true to false. @SINCE_1_9.28
+ NOTIFY_ON_CHANGED ///< Notify whenever condition changes (false to true, and true to false) @SINCE_1_9.28
};
public:
-
/**
* @brief Creates an uninitialized PropertyNotification; this can be initialized with PropertyNotification::New().
*
* @param[in] handle to An object
* @return handle to a PropertyNotification object or an uninitialized handle
*/
- static PropertyNotification DownCast( BaseHandle handle );
+ static PropertyNotification DownCast(BaseHandle handle);
/**
* @brief Destructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- PropertyNotification( PropertyNotification&& rhs );
+ PropertyNotification(PropertyNotification&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- PropertyNotification& operator=( PropertyNotification&& rhs );
+ PropertyNotification& operator=(PropertyNotification&& rhs);
/**
* @brief Gets the condition of this notification.
* @SINCE_1_0.0
* @param[in] mode Notification mode (Default is PropertyNotification::NOTIFY_ON_TRUE)
*/
- void SetNotifyMode( NotifyMode mode );
+ void SetNotifyMode(NotifyMode mode);
/**
* @brief Retrieves the current Notification mode.
PropertyNotifySignalType& NotifySignal();
public: // Not intended for use by Application developers
-
/// @cond internal
/**
* @brief This constructor is used by Dali New() methods.
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
namespace
{
-const char* const PROPERTY_TYPE_NAMES[] =
-{
+const char* const PROPERTY_TYPE_NAMES[] = {
"NONE",
"BOOLEAN",
"FLOAT",
"MAP",
"EXTENTS",
};
-const uint32_t PROPERTY_TYPE_NAMES_COUNT = static_cast<uint32_t>( sizeof( PROPERTY_TYPE_NAMES ) / sizeof( const char* ) );
-}
+const uint32_t PROPERTY_TYPE_NAMES_COUNT = static_cast<uint32_t>(sizeof(PROPERTY_TYPE_NAMES) / sizeof(const char*));
+} // namespace
namespace PropertyTypes
{
-
DALI_CORE_API const char* GetName(Property::Type type)
{
- if (type < PROPERTY_TYPE_NAMES_COUNT )
+ if(type < PROPERTY_TYPE_NAMES_COUNT)
{
return PROPERTY_TYPE_NAMES[type];
}
#define DALI_PROPERTY_TYPES_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/common/extents.h>
#include <dali/public-api/math/angle-axis.h>
#include <dali/public-api/math/degree.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/matrix3.h>
#include <dali/public-api/math/quaternion.h>
+#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/matrix3.h>
-#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/math/rect.h>
#include <dali/public-api/object/property.h>
namespace Dali
*/
namespace PropertyTypes
{
-
/**
* @brief Retrieves the name of a property type.
*
* @SINCE_1_0.0
* @return The property type
*/
-template <typename T>
-inline Property::Type Get() { return Property::NONE; }
-template <>
-inline Property::Type Get<bool>() { return Property::BOOLEAN; }
-template <>
-inline Property::Type Get<float>() { return Property::FLOAT; }
-template <>
-inline Property::Type Get<int>() { return Property::INTEGER; }
-template <>
-inline Property::Type Get<Vector2>() { return Property::VECTOR2; }
-template <>
-inline Property::Type Get<Vector3>() { return Property::VECTOR3; }
-template <>
-inline Property::Type Get<Vector4>() { return Property::VECTOR4; }
-template <>
-inline Property::Type Get<Matrix3>() { return Property::MATRIX3; }
-template <>
-inline Property::Type Get<Matrix>() { return Property::MATRIX; }
-template <>
-inline Property::Type Get<AngleAxis>() { return Property::ROTATION; } // Rotation has two representations
-template <>
-inline Property::Type Get<Quaternion>() { return Property::ROTATION; } // Rotation has two representations
-template <>
-inline Property::Type Get<std::string>() { return Property::STRING; }
-template <>
-inline Property::Type Get<Dali::Rect<int> >() { return Property::RECTANGLE; }
-template <>
-inline Property::Type Get<Property::Map>() { return Property::MAP; }
-template <>
-inline Property::Type Get<Property::Array>() { return Property::ARRAY; }
-template <>
-inline Property::Type Get<Extents>() { return Property::EXTENTS; }
-
+template<typename T>
+inline Property::Type Get()
+{
+ return Property::NONE;
+}
+template<>
+inline Property::Type Get<bool>()
+{
+ return Property::BOOLEAN;
+}
+template<>
+inline Property::Type Get<float>()
+{
+ return Property::FLOAT;
+}
+template<>
+inline Property::Type Get<int>()
+{
+ return Property::INTEGER;
+}
+template<>
+inline Property::Type Get<Vector2>()
+{
+ return Property::VECTOR2;
+}
+template<>
+inline Property::Type Get<Vector3>()
+{
+ return Property::VECTOR3;
+}
+template<>
+inline Property::Type Get<Vector4>()
+{
+ return Property::VECTOR4;
+}
+template<>
+inline Property::Type Get<Matrix3>()
+{
+ return Property::MATRIX3;
+}
+template<>
+inline Property::Type Get<Matrix>()
+{
+ return Property::MATRIX;
+}
+template<>
+inline Property::Type Get<AngleAxis>()
+{
+ return Property::ROTATION;
+} // Rotation has two representations
+template<>
+inline Property::Type Get<Quaternion>()
+{
+ return Property::ROTATION;
+} // Rotation has two representations
+template<>
+inline Property::Type Get<std::string>()
+{
+ return Property::STRING;
+}
+template<>
+inline Property::Type Get<Dali::Rect<int> >()
+{
+ return Property::RECTANGLE;
+}
+template<>
+inline Property::Type Get<Property::Map>()
+{
+ return Property::MAP;
+}
+template<>
+inline Property::Type Get<Property::Array>()
+{
+ return Property::ARRAY;
+}
+template<>
+inline Property::Type Get<Extents>()
+{
+ return Property::EXTENTS;
+}
}; // namespace PropertyTypes
#include <ostream>
// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
#include <dali/public-api/common/extents.h>
#include <dali/public-api/math/angle-axis.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/matrix3.h>
+#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/radian.h>
+#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/matrix3.h>
-#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/math/quaternion.h>
-#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/property-array.h>
+#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/property-types.h>
-#include <dali/integration-api/debug.h>
namespace Dali
{
-
namespace
{
/**
* Helper to check if the property value can be read as int/bool
*/
-inline bool IsIntegerType( Property::Type type )
+inline bool IsIntegerType(Property::Type type)
{
- return ( Property::BOOLEAN == type )||( Property::INTEGER == type );
-}
+ return (Property::BOOLEAN == type) || (Property::INTEGER == type);
}
+} // namespace
struct Property::Value::Impl
{
- Impl( bool booleanValue )
- : type( Property::BOOLEAN ),
- integerValue( booleanValue )
- { }
+ Impl(bool booleanValue)
+ : type(Property::BOOLEAN),
+ integerValue(booleanValue)
+ {
+ }
- Impl( float floatValue )
- : type( Property::FLOAT ),
- floatValue( floatValue )
- { }
+ Impl(float floatValue)
+ : type(Property::FLOAT),
+ floatValue(floatValue)
+ {
+ }
- Impl( int32_t integerValue )
- : type( Property::INTEGER ),
- integerValue( integerValue )
- { }
+ Impl(int32_t integerValue)
+ : type(Property::INTEGER),
+ integerValue(integerValue)
+ {
+ }
- Impl( const Vector2& vectorValue )
- : type( Property::VECTOR2 ),
- vector2Value( new Vector2( vectorValue ) )
- { }
+ Impl(const Vector2& vectorValue)
+ : type(Property::VECTOR2),
+ vector2Value(new Vector2(vectorValue))
+ {
+ }
- Impl( const Vector3& vectorValue )
- : type( Property::VECTOR3 ),
- vector3Value( new Vector3( vectorValue ) )
- { }
+ Impl(const Vector3& vectorValue)
+ : type(Property::VECTOR3),
+ vector3Value(new Vector3(vectorValue))
+ {
+ }
- Impl( const Vector4& vectorValue )
- : type( Property::VECTOR4 ),
- vector4Value( new Vector4( vectorValue ) )
- { }
+ Impl(const Vector4& vectorValue)
+ : type(Property::VECTOR4),
+ vector4Value(new Vector4(vectorValue))
+ {
+ }
- Impl( const Matrix3& matrixValue )
- : type( Property::MATRIX3 ),
- matrix3Value( new Matrix3( matrixValue ) )
+ Impl(const Matrix3& matrixValue)
+ : type(Property::MATRIX3),
+ matrix3Value(new Matrix3(matrixValue))
{
}
- Impl( const Matrix& matrixValue )
- : type( Property::MATRIX ),
- matrixValue( new Matrix( matrixValue ) )
+ Impl(const Matrix& matrixValue)
+ : type(Property::MATRIX),
+ matrixValue(new Matrix(matrixValue))
{
}
- Impl( const AngleAxis& angleAxisValue )
- : type( Property::ROTATION ),
- angleAxisValue( new AngleAxis(angleAxisValue) )
+ Impl(const AngleAxis& angleAxisValue)
+ : type(Property::ROTATION),
+ angleAxisValue(new AngleAxis(angleAxisValue))
{
}
- Impl( const Quaternion& quaternionValue )
- : type( Property::ROTATION ),
- angleAxisValue( new AngleAxis() )
+ Impl(const Quaternion& quaternionValue)
+ : type(Property::ROTATION),
+ angleAxisValue(new AngleAxis())
{
- quaternionValue.ToAxisAngle( angleAxisValue->axis, angleAxisValue->angle );
+ quaternionValue.ToAxisAngle(angleAxisValue->axis, angleAxisValue->angle);
}
- Impl( const std::string& stringValue )
- : type( Property::STRING ),
- stringValue( new std::string( stringValue ) )
+ Impl(const std::string& stringValue)
+ : type(Property::STRING),
+ stringValue(new std::string(stringValue))
{
}
- Impl( const Rect<int32_t>& rectValue )
- : type( Property::RECTANGLE ),
- rectValue( new Rect<int>( rectValue ) )
+ Impl(const Rect<int32_t>& rectValue)
+ : type(Property::RECTANGLE),
+ rectValue(new Rect<int>(rectValue))
{
}
- Impl( const Rect<float>& rectValue )
- : type( Property::VECTOR4 ),
- vector4Value( new Vector4( rectValue.x, rectValue.y, rectValue.width, rectValue.height ) )
+ Impl(const Rect<float>& rectValue)
+ : type(Property::VECTOR4),
+ vector4Value(new Vector4(rectValue.x, rectValue.y, rectValue.width, rectValue.height))
{
}
- Impl( const Property::Array& arrayValue )
- : type( Property::ARRAY ),
- arrayValue( new Property::Array( arrayValue ) )
+ Impl(const Property::Array& arrayValue)
+ : type(Property::ARRAY),
+ arrayValue(new Property::Array(arrayValue))
{
}
- Impl( Property::Array&& arrayValue )
- : type( Property::ARRAY ),
- arrayValue( new Property::Array( std::move( arrayValue ) ) )
+ Impl(Property::Array&& arrayValue)
+ : type(Property::ARRAY),
+ arrayValue(new Property::Array(std::move(arrayValue)))
{
}
- Impl( const Property::Map& mapValue )
- : type( Property::MAP ),
- mapValue( new Property::Map( mapValue ) )
+ Impl(const Property::Map& mapValue)
+ : type(Property::MAP),
+ mapValue(new Property::Map(mapValue))
{
}
- Impl( Property::Map&& mapValue )
- : type( Property::MAP ),
- mapValue( new Property::Map( std::move( mapValue ) ) )
+ Impl(Property::Map&& mapValue)
+ : type(Property::MAP),
+ mapValue(new Property::Map(std::move(mapValue)))
{
}
- Impl( const Extents& extentsValue )
- : type( Property::EXTENTS ),
- extentsValue( new Extents( extentsValue ) )
+ Impl(const Extents& extentsValue)
+ : type(Property::EXTENTS),
+ extentsValue(new Extents(extentsValue))
{
}
- Impl( const std::initializer_list< KeyValuePair >& values )
- : type( Property::MAP ),
- mapValue( new Property::Map( values ) )
+ Impl(const std::initializer_list<KeyValuePair>& values)
+ : type(Property::MAP),
+ mapValue(new Property::Map(values))
{
}
*/
~Impl()
{
- switch( type )
+ switch(type)
{
- case Property::NONE : // FALLTHROUGH
- case Property::BOOLEAN : // FALLTHROUGH
- case Property::FLOAT : // FALLTHROUGH
- case Property::INTEGER :
+ case Property::NONE: // FALLTHROUGH
+ case Property::BOOLEAN: // FALLTHROUGH
+ case Property::FLOAT: // FALLTHROUGH
+ case Property::INTEGER:
{
break; // nothing to do
}
- case Property::VECTOR2 :
+ case Property::VECTOR2:
{
delete vector2Value;
break;
}
public: // Data
-
Type type;
union
{
int32_t integerValue;
- float floatValue;
+ float floatValue;
// must use pointers for any class value pre c++ 11
- Vector2* vector2Value;
- Vector3* vector3Value;
- Vector4* vector4Value;
- Matrix3* matrix3Value;
- Matrix* matrixValue;
- AngleAxis* angleAxisValue;
- std::string* stringValue;
- Rect<int32_t>* rectValue;
+ Vector2* vector2Value;
+ Vector3* vector3Value;
+ Vector4* vector4Value;
+ Matrix3* matrix3Value;
+ Matrix* matrixValue;
+ AngleAxis* angleAxisValue;
+ std::string* stringValue;
+ Rect<int32_t>* rectValue;
Property::Array* arrayValue;
- Property::Map* mapValue;
- Extents* extentsValue;
+ Property::Map* mapValue;
+ Extents* extentsValue;
};
private:
-
// non-copyable
- Impl( const Impl& ) = delete;
- Impl& operator=( const Impl& ) = delete;
-
+ Impl(const Impl&) = delete;
+ Impl& operator=(const Impl&) = delete;
};
Property::Value::Value()
-: mImpl( nullptr )
+: mImpl(nullptr)
{
}
-Property::Value::Value( bool booleanValue )
-: mImpl( new Impl( booleanValue ) )
+Property::Value::Value(bool booleanValue)
+: mImpl(new Impl(booleanValue))
{
}
-Property::Value::Value( float floatValue )
-: mImpl( new Impl( floatValue ) )
+Property::Value::Value(float floatValue)
+: mImpl(new Impl(floatValue))
{
}
-Property::Value::Value( int32_t integerValue )
-: mImpl( new Impl( integerValue ) )
+Property::Value::Value(int32_t integerValue)
+: mImpl(new Impl(integerValue))
{
}
-Property::Value::Value( const Vector2& vectorValue )
-: mImpl( new Impl( vectorValue ) )
+Property::Value::Value(const Vector2& vectorValue)
+: mImpl(new Impl(vectorValue))
{
}
-Property::Value::Value( const Vector3& vectorValue )
-: mImpl( new Impl( vectorValue ) )
+Property::Value::Value(const Vector3& vectorValue)
+: mImpl(new Impl(vectorValue))
{
}
-Property::Value::Value( const Vector4& vectorValue )
-: mImpl( new Impl( vectorValue ) )
+Property::Value::Value(const Vector4& vectorValue)
+: mImpl(new Impl(vectorValue))
{
}
-Property::Value::Value( const Matrix3& matrixValue )
-: mImpl( new Impl( matrixValue ) )
+Property::Value::Value(const Matrix3& matrixValue)
+: mImpl(new Impl(matrixValue))
{
}
-Property::Value::Value( const Matrix& matrixValue )
-: mImpl( new Impl( matrixValue ) )
+Property::Value::Value(const Matrix& matrixValue)
+: mImpl(new Impl(matrixValue))
{
}
-Property::Value::Value( const Rect<int32_t>& rectValue )
-: mImpl( new Impl( rectValue ) )
+Property::Value::Value(const Rect<int32_t>& rectValue)
+: mImpl(new Impl(rectValue))
{
}
-Property::Value::Value( const Rect<float>& rectValue )
-: mImpl( new Impl( rectValue ) )
+Property::Value::Value(const Rect<float>& rectValue)
+: mImpl(new Impl(rectValue))
{
}
-Property::Value::Value( const AngleAxis& angleAxisValue )
-: mImpl( new Impl( angleAxisValue ) )
+Property::Value::Value(const AngleAxis& angleAxisValue)
+: mImpl(new Impl(angleAxisValue))
{
}
-Property::Value::Value( const Quaternion& quaternionValue )
-: mImpl( new Impl( quaternionValue ) )
+Property::Value::Value(const Quaternion& quaternionValue)
+: mImpl(new Impl(quaternionValue))
{
}
-Property::Value::Value( const std::string& stringValue )
-: mImpl( new Impl( stringValue ) )
+Property::Value::Value(const std::string& stringValue)
+: mImpl(new Impl(stringValue))
{
}
-Property::Value::Value( const char* stringValue )
-: mImpl( nullptr )
+Property::Value::Value(const char* stringValue)
+: mImpl(nullptr)
{
- if( stringValue ) // string constructor is undefined with nullptr
+ if(stringValue) // string constructor is undefined with nullptr
{
- mImpl = new Impl( std::string(stringValue) );
+ mImpl = new Impl(std::string(stringValue));
}
else
{
- mImpl = new Impl( std::string() );
+ mImpl = new Impl(std::string());
}
}
-Property::Value::Value( Property::Array& arrayValue )
-: mImpl( new Impl( arrayValue ) )
+Property::Value::Value(Property::Array& arrayValue)
+: mImpl(new Impl(arrayValue))
{
}
-Property::Value::Value( Property::Array&& arrayValue )
-: mImpl( new Impl( std::move( arrayValue ) ) )
+Property::Value::Value(Property::Array&& arrayValue)
+: mImpl(new Impl(std::move(arrayValue)))
{
}
-Property::Value::Value( Property::Map& mapValue )
-: mImpl( new Impl( mapValue ) )
+Property::Value::Value(Property::Map& mapValue)
+: mImpl(new Impl(mapValue))
{
}
-Property::Value::Value( Property::Map&& mapValue )
-: mImpl( new Impl( std::move( mapValue ) ) )
+Property::Value::Value(Property::Map&& mapValue)
+: mImpl(new Impl(std::move(mapValue)))
{
}
-Property::Value::Value( const Extents& extentsValue )
-: mImpl( new Impl( extentsValue ) )
+Property::Value::Value(const Extents& extentsValue)
+: mImpl(new Impl(extentsValue))
{
}
-Property::Value::Value( const std::initializer_list< KeyValuePair >& values )
-: mImpl( new Impl( values ) )
+Property::Value::Value(const std::initializer_list<KeyValuePair>& values)
+: mImpl(new Impl(values))
{
}
-Property::Value::Value( Type type )
-: mImpl( nullptr )
+Property::Value::Value(Type type)
+: mImpl(nullptr)
{
- switch (type)
+ switch(type)
{
case Property::BOOLEAN:
{
- mImpl = new Impl( false );
+ mImpl = new Impl(false);
break;
}
case Property::FLOAT:
{
- mImpl = new Impl( 0.f );
+ mImpl = new Impl(0.f);
break;
}
case Property::INTEGER:
{
- mImpl = new Impl( 0 );
+ mImpl = new Impl(0);
break;
}
case Property::VECTOR2:
{
- mImpl = new Impl( Vector2::ZERO );
+ mImpl = new Impl(Vector2::ZERO);
break;
}
case Property::VECTOR3:
{
- mImpl = new Impl( Vector3::ZERO );
+ mImpl = new Impl(Vector3::ZERO);
break;
}
case Property::VECTOR4:
{
- mImpl = new Impl( Vector4::ZERO );
+ mImpl = new Impl(Vector4::ZERO);
break;
}
case Property::RECTANGLE:
{
- mImpl = new Impl( Rect<int32_t>(0,0,0,0) );
+ mImpl = new Impl(Rect<int32_t>(0, 0, 0, 0));
break;
}
case Property::ROTATION:
{
- mImpl = new Impl( AngleAxis() );
+ mImpl = new Impl(AngleAxis());
break;
}
case Property::STRING:
{
- mImpl = new Impl( std::string() );
+ mImpl = new Impl(std::string());
break;
}
case Property::MATRIX:
{
- mImpl = new Impl( Matrix() );
+ mImpl = new Impl(Matrix());
break;
}
case Property::MATRIX3:
{
- mImpl = new Impl( Matrix3() );
+ mImpl = new Impl(Matrix3());
break;
}
case Property::ARRAY:
{
- mImpl = new Impl( Property::Array() );
+ mImpl = new Impl(Property::Array());
break;
}
case Property::MAP:
{
- mImpl = new Impl( Property::Map() );
+ mImpl = new Impl(Property::Map());
break;
}
case Property::EXTENTS:
{
- mImpl = new Impl( Extents() );
+ mImpl = new Impl(Extents());
break;
}
case Property::NONE:
}
}
-Property::Value::Value( const Property::Value& value )
-: mImpl( nullptr )
+Property::Value::Value(const Property::Value& value)
+: mImpl(nullptr)
{
// reuse assignment operator
- operator=( value );
+ operator=(value);
}
-Property::Value::Value( Property::Value&& value )
-: mImpl( value.mImpl )
+Property::Value::Value(Property::Value&& value)
+: mImpl(value.mImpl)
{
value.mImpl = nullptr;
}
-Property::Value& Property::Value::operator=( const Property::Value& value )
+Property::Value& Property::Value::operator=(const Property::Value& value)
{
- if ( this == &value )
+ if(this == &value)
{
// skip self assignment
return *this;
}
// if we are assigned an empty value, just drop impl
- if( !value.mImpl )
+ if(!value.mImpl)
{
delete mImpl;
mImpl = nullptr;
return *this;
}
// first check if the type is the same, no need to change impl, just assign
- if( mImpl && ( mImpl->type == value.mImpl->type ) )
+ if(mImpl && (mImpl->type == value.mImpl->type))
{
- switch( mImpl->type )
+ switch(mImpl->type)
{
case Property::BOOLEAN:
{
else
{
// different type, release old impl and create new
- Impl* newImpl( nullptr );
- switch ( value.mImpl->type )
+ Impl* newImpl(nullptr);
+ switch(value.mImpl->type)
{
case Property::BOOLEAN:
{
- newImpl = new Impl( bool( value.mImpl->integerValue ) );
+ newImpl = new Impl(bool(value.mImpl->integerValue));
break;
}
case Property::FLOAT:
{
- newImpl = new Impl( value.mImpl->floatValue );
+ newImpl = new Impl(value.mImpl->floatValue);
break;
}
case Property::INTEGER:
{
- newImpl = new Impl( value.mImpl->integerValue );
+ newImpl = new Impl(value.mImpl->integerValue);
break;
}
case Property::VECTOR2:
{
- newImpl = new Impl( *value.mImpl->vector2Value ); // type cannot change in mImpl so vector is allocated
+ newImpl = new Impl(*value.mImpl->vector2Value); // type cannot change in mImpl so vector is allocated
break;
}
case Property::VECTOR3:
{
- newImpl = new Impl( *value.mImpl->vector3Value ); // type cannot change in mImpl so vector is allocated
+ newImpl = new Impl(*value.mImpl->vector3Value); // type cannot change in mImpl so vector is allocated
break;
}
case Property::VECTOR4:
{
- newImpl = new Impl( *value.mImpl->vector4Value ); // type cannot change in mImpl so vector is allocated
+ newImpl = new Impl(*value.mImpl->vector4Value); // type cannot change in mImpl so vector is allocated
break;
}
case Property::RECTANGLE:
{
- newImpl = new Impl( *value.mImpl->rectValue ); // type cannot change in mImpl so rect is allocated
+ newImpl = new Impl(*value.mImpl->rectValue); // type cannot change in mImpl so rect is allocated
break;
}
case Property::ROTATION:
{
- newImpl = new Impl( *value.mImpl->angleAxisValue ); // type cannot change in mImpl so quaternion is allocated
+ newImpl = new Impl(*value.mImpl->angleAxisValue); // type cannot change in mImpl so quaternion is allocated
break;
}
case Property::MATRIX3:
{
- newImpl = new Impl( *value.mImpl->matrix3Value ); // type cannot change in mImpl so matrix is allocated
+ newImpl = new Impl(*value.mImpl->matrix3Value); // type cannot change in mImpl so matrix is allocated
break;
}
case Property::MATRIX:
{
- newImpl = new Impl( *value.mImpl->matrixValue ); // type cannot change in mImpl so matrix is allocated
+ newImpl = new Impl(*value.mImpl->matrixValue); // type cannot change in mImpl so matrix is allocated
break;
}
case Property::STRING:
{
- newImpl = new Impl( *value.mImpl->stringValue ); // type cannot change in mImpl so string is allocated
+ newImpl = new Impl(*value.mImpl->stringValue); // type cannot change in mImpl so string is allocated
break;
}
case Property::ARRAY:
{
- newImpl = new Impl( *value.mImpl->arrayValue ); // type cannot change in mImpl so array is allocated
+ newImpl = new Impl(*value.mImpl->arrayValue); // type cannot change in mImpl so array is allocated
break;
}
case Property::MAP:
{
- newImpl = new Impl( *value.mImpl->mapValue ); // type cannot change in mImpl so map is allocated
+ newImpl = new Impl(*value.mImpl->mapValue); // type cannot change in mImpl so map is allocated
break;
}
case Property::EXTENTS:
{
- newImpl = new Impl( *value.mImpl->extentsValue ); // type cannot change in mImpl so extents is allocated
+ newImpl = new Impl(*value.mImpl->extentsValue); // type cannot change in mImpl so extents is allocated
break;
}
case Property::NONE:
return *this;
}
-Property::Value& Property::Value::operator=( Property::Value&& value )
+Property::Value& Property::Value::operator=(Property::Value&& value)
{
- if( this != &value )
+ if(this != &value)
{
delete mImpl;
- mImpl = value.mImpl;
+ mImpl = value.mImpl;
value.mImpl = nullptr;
}
Property::Type Property::Value::GetType() const
{
- Property::Type type( Property::NONE );
- if( mImpl )
+ Property::Type type(Property::NONE);
+ if(mImpl)
{
type = mImpl->type;
}
return type;
}
-bool Property::Value::Get( bool& booleanValue ) const
+bool Property::Value::Get(bool& booleanValue) const
{
bool converted = false;
- if( mImpl && IsIntegerType( mImpl->type ) )
+ if(mImpl && IsIntegerType(mImpl->type))
{
booleanValue = mImpl->integerValue;
- converted = true;
+ converted = true;
}
return converted;
}
-bool Property::Value::Get( float& floatValue ) const
+bool Property::Value::Get(float& floatValue) const
{
bool converted = false;
- if( mImpl )
+ if(mImpl)
{
- if( mImpl->type == FLOAT )
+ if(mImpl->type == FLOAT)
{
floatValue = mImpl->floatValue;
- converted = true;
+ converted = true;
}
- else if( IsIntegerType( mImpl->type ) )
+ else if(IsIntegerType(mImpl->type))
{
- floatValue = static_cast< float >( mImpl->integerValue );
- converted = true;
+ floatValue = static_cast<float>(mImpl->integerValue);
+ converted = true;
}
}
return converted;
}
-bool Property::Value::Get( int32_t& integerValue ) const
+bool Property::Value::Get(int32_t& integerValue) const
{
bool converted = false;
- if( mImpl )
+ if(mImpl)
{
- if( IsIntegerType( mImpl->type ) )
+ if(IsIntegerType(mImpl->type))
{
integerValue = mImpl->integerValue;
- converted = true;
+ converted = true;
}
- else if( mImpl->type == FLOAT )
+ else if(mImpl->type == FLOAT)
{
- integerValue = static_cast< int32_t >( mImpl->floatValue );
- converted = true;
+ integerValue = static_cast<int32_t>(mImpl->floatValue);
+ converted = true;
}
}
return converted;
}
-bool Property::Value::Get( Vector2& vectorValue ) const
+bool Property::Value::Get(Vector2& vectorValue) const
{
bool converted = false;
- if( mImpl )
+ if(mImpl)
{
// type cannot change in mImpl so vector is allocated
- if( mImpl->type == VECTOR2 || mImpl->type == VECTOR3 || mImpl->type == VECTOR4 )
+ if(mImpl->type == VECTOR2 || mImpl->type == VECTOR3 || mImpl->type == VECTOR4)
{
vectorValue = *(mImpl->vector2Value); // if Vector3 or 4 only x and y are assigned
- converted = true;
+ converted = true;
}
}
return converted;
}
-bool Property::Value::Get( Vector3& vectorValue ) const
+bool Property::Value::Get(Vector3& vectorValue) const
{
bool converted = false;
- if( mImpl )
+ if(mImpl)
{
// type cannot change in mImpl so vector is allocated
- if ( mImpl->type == VECTOR3 || mImpl->type == VECTOR4 )
+ if(mImpl->type == VECTOR3 || mImpl->type == VECTOR4)
{
vectorValue = *(mImpl->vector3Value); // if Vector4 only x,y,z are assigned
- converted = true;
+ converted = true;
}
- else if( mImpl->type == VECTOR2 )
+ else if(mImpl->type == VECTOR2)
{
vectorValue = *(mImpl->vector2Value);
- converted = true;
+ converted = true;
}
}
return converted;
}
-bool Property::Value::Get( Vector4& vectorValue ) const
+bool Property::Value::Get(Vector4& vectorValue) const
{
bool converted = false;
- if( mImpl )
+ if(mImpl)
{
- if( mImpl->type == VECTOR4 ) // type cannot change in mImpl so vector is allocated
+ if(mImpl->type == VECTOR4) // type cannot change in mImpl so vector is allocated
{
vectorValue = *(mImpl->vector4Value);
- converted = true;
+ converted = true;
}
- else if( mImpl->type == VECTOR2 )
+ else if(mImpl->type == VECTOR2)
{
vectorValue = *(mImpl->vector2Value);
- converted = true;
+ converted = true;
}
- else if( mImpl->type == VECTOR3 )
+ else if(mImpl->type == VECTOR3)
{
vectorValue = *(mImpl->vector3Value);
- converted = true;
+ converted = true;
}
}
return converted;
}
-bool Property::Value::Get( Matrix3& matrixValue ) const
+bool Property::Value::Get(Matrix3& matrixValue) const
{
bool converted = false;
- if( mImpl && (mImpl->type == MATRIX3) ) // type cannot change in mImpl so matrix is allocated
+ if(mImpl && (mImpl->type == MATRIX3)) // type cannot change in mImpl so matrix is allocated
{
matrixValue = *(mImpl->matrix3Value);
- converted = true;
+ converted = true;
}
return converted;
}
-bool Property::Value::Get( Matrix& matrixValue ) const
+bool Property::Value::Get(Matrix& matrixValue) const
{
bool converted = false;
- if( mImpl && (mImpl->type == MATRIX) ) // type cannot change in mImpl so matrix is allocated
+ if(mImpl && (mImpl->type == MATRIX)) // type cannot change in mImpl so matrix is allocated
{
matrixValue = *(mImpl->matrixValue);
- converted = true;
+ converted = true;
}
return converted;
}
-bool Property::Value::Get( Rect<int32_t>& rectValue ) const
+bool Property::Value::Get(Rect<int32_t>& rectValue) const
{
bool converted = false;
- if( mImpl && (mImpl->type == RECTANGLE) ) // type cannot change in mImpl so rect is allocated
+ if(mImpl && (mImpl->type == RECTANGLE)) // type cannot change in mImpl so rect is allocated
{
rectValue = *(mImpl->rectValue);
converted = true;
return converted;
}
-bool Property::Value::Get( AngleAxis& angleAxisValue ) const
+bool Property::Value::Get(AngleAxis& angleAxisValue) const
{
bool converted = false;
- if( mImpl && (mImpl->type == ROTATION) ) // type cannot change in mImpl so angleAxis is allocated
+ if(mImpl && (mImpl->type == ROTATION)) // type cannot change in mImpl so angleAxis is allocated
{
angleAxisValue = *(mImpl->angleAxisValue);
- converted = true;
+ converted = true;
}
return converted;
}
-bool Property::Value::Get( Quaternion& quaternionValue ) const
+bool Property::Value::Get(Quaternion& quaternionValue) const
{
bool converted = false;
- if( mImpl && (mImpl->type == ROTATION) ) // type cannot change in mImpl so angleAxis is allocated
+ if(mImpl && (mImpl->type == ROTATION)) // type cannot change in mImpl so angleAxis is allocated
{
- quaternionValue = Quaternion(mImpl->angleAxisValue->angle, mImpl->angleAxisValue->axis );
- converted = true;
+ quaternionValue = Quaternion(mImpl->angleAxisValue->angle, mImpl->angleAxisValue->axis);
+ converted = true;
}
return converted;
}
-bool Property::Value::Get( std::string& stringValue ) const
+bool Property::Value::Get(std::string& stringValue) const
{
bool converted = false;
- if( mImpl && (mImpl->type == STRING) ) // type cannot change in mImpl so string is allocated
+ if(mImpl && (mImpl->type == STRING)) // type cannot change in mImpl so string is allocated
{
- stringValue.assign( *(mImpl->stringValue) );
+ stringValue.assign(*(mImpl->stringValue));
converted = true;
}
return converted;
}
-bool Property::Value::Get( Property::Array& arrayValue ) const
+bool Property::Value::Get(Property::Array& arrayValue) const
{
bool converted = false;
- if( mImpl && (mImpl->type == ARRAY) ) // type cannot change in mImpl so array is allocated
+ if(mImpl && (mImpl->type == ARRAY)) // type cannot change in mImpl so array is allocated
{
arrayValue = *(mImpl->arrayValue);
- converted = true;
+ converted = true;
}
return converted;
}
-bool Property::Value::Get( Property::Map& mapValue ) const
+bool Property::Value::Get(Property::Map& mapValue) const
{
bool converted = false;
- if( mImpl && (mImpl->type == MAP) ) // type cannot change in mImpl so map is allocated
+ if(mImpl && (mImpl->type == MAP)) // type cannot change in mImpl so map is allocated
{
- mapValue = *(mImpl->mapValue);
+ mapValue = *(mImpl->mapValue);
converted = true;
}
return converted;
Property::Array* Property::Value::GetArray() const
{
Property::Array* array = nullptr;
- if( mImpl && (mImpl->type == ARRAY) ) // type cannot change in mImpl so array is allocated
+ if(mImpl && (mImpl->type == ARRAY)) // type cannot change in mImpl so array is allocated
{
array = mImpl->arrayValue;
}
Property::Map* Property::Value::GetMap() const
{
Property::Map* map = nullptr;
- if( mImpl && (mImpl->type == MAP) ) // type cannot change in mImpl so map is allocated
+ if(mImpl && (mImpl->type == MAP)) // type cannot change in mImpl so map is allocated
{
map = mImpl->mapValue;
}
return map;
}
-bool Property::Value::Get( Extents& extentsValue ) const
+bool Property::Value::Get(Extents& extentsValue) const
{
bool converted = false;
- if( mImpl )
+ if(mImpl)
{
- if( mImpl->type == EXTENTS )
+ if(mImpl->type == EXTENTS)
{
extentsValue = *(mImpl->extentsValue);
- converted = true;
+ converted = true;
}
- else if( mImpl->type == VECTOR4 )
+ else if(mImpl->type == VECTOR4)
{
- extentsValue.start = static_cast< uint16_t >( mImpl->vector4Value->x );
- extentsValue.end = static_cast< uint16_t >( mImpl->vector4Value->y );
- extentsValue.top = static_cast< uint16_t >( mImpl->vector4Value->z );
- extentsValue.bottom = static_cast< uint16_t >( mImpl->vector4Value->w );
- converted = true;
+ extentsValue.start = static_cast<uint16_t>(mImpl->vector4Value->x);
+ extentsValue.end = static_cast<uint16_t>(mImpl->vector4Value->y);
+ extentsValue.top = static_cast<uint16_t>(mImpl->vector4Value->z);
+ extentsValue.bottom = static_cast<uint16_t>(mImpl->vector4Value->w);
+ converted = true;
}
}
return converted;
}
-std::ostream& operator<<( std::ostream& stream, const Property::Value& value )
+std::ostream& operator<<(std::ostream& stream, const Property::Value& value)
{
- if( value.mImpl )
+ if(value.mImpl)
{
- const Property::Value::Impl& impl( *value.mImpl );
+ const Property::Value::Impl& impl(*value.mImpl);
- switch( impl.type )
+ switch(impl.type)
{
case Dali::Property::BOOLEAN:
{
}
case Dali::Property::INTEGER:
{
- stream << impl.integerValue;
- break;
+ stream << impl.integerValue;
+ break;
}
case Dali::Property::VECTOR2:
{
return stream;
}
-
} // namespace Dali
*/
// EXTERNAL INCLUDES
+#include <initializer_list>
#include <iosfwd>
#include <type_traits>
#include <utility>
-#include <initializer_list>
// INTERNAL INCLUDES
-#include <dali/public-api/object/property.h>
#include <dali/public-api/math/rect.h>
-
+#include <dali/public-api/object/property.h>
namespace Dali
{
class DALI_CORE_API Property::Value
{
public:
-
/**
* @brief Default constructor.
*
* @SINCE_1_0.0
* @param[in] boolValue A boolean value
*/
- Value( bool boolValue );
+ Value(bool boolValue);
/**
* @brief Creates an integer property value.
* @SINCE_1_0.0
* @param[in] integerValue An integer value
*/
- Value( int32_t integerValue );
+ Value(int32_t integerValue);
/**
* @brief Creates a float property value.
* @SINCE_1_0.0
* @param[in] floatValue A floating-point value
*/
- Value( float floatValue );
+ Value(float floatValue);
/**
* @brief Creates a Vector2 property value.
* @SINCE_1_0.0
* @param[in] vectorValue A vector of 2 floating-point values
*/
- Value( const Vector2& vectorValue );
+ Value(const Vector2& vectorValue);
/**
* @brief Creates a Vector3 property value.
* @SINCE_1_0.0
* @param[in] vectorValue A vector of 3 floating-point values
*/
- Value( const Vector3& vectorValue );
+ Value(const Vector3& vectorValue);
/**
* @brief Creates a Vector4 property value.
* @SINCE_1_0.0
* @param[in] vectorValue A vector of 4 floating-point values
*/
- Value( const Vector4& vectorValue );
+ Value(const Vector4& vectorValue);
/**
* @brief Creates a Matrix3 property value.
* @SINCE_1_0.0
* @param[in] matrixValue A matrix of 3x3 floating-point values
*/
- Value( const Matrix3& matrixValue );
+ Value(const Matrix3& matrixValue);
/**
* @brief Creates a Matrix property value.
* @SINCE_1_0.0
* @param[in] matrixValue A matrix of 4x4 floating-point values
*/
- Value( const Matrix& matrixValue );
+ Value(const Matrix& matrixValue);
/**
* @brief Creates a Vector4 property value.
* @SINCE_1_0.0
* @param[in] vectorValue A vector of 4 integer values
*/
- Value( const Rect<int32_t>& vectorValue );
+ Value(const Rect<int32_t>& vectorValue);
/**
* @brief Creates a Vector4 property value.
* @SINCE_1_9.14
* @param[in] vectorValue A vector of 4 float values
*/
- Value( const Rect<float>& vectorValue );
+ Value(const Rect<float>& vectorValue);
/**
* @brief Creates an orientation property value.
* @SINCE_1_0.0
* @param[in] angleAxis An angle-axis representing the rotation
*/
- Value( const AngleAxis& angleAxis );
+ Value(const AngleAxis& angleAxis);
/**
* @brief Creates an orientation property value.
* @SINCE_1_0.0
* @param[in] quaternion A quaternion representing the rotation
*/
- Value( const Quaternion& quaternion );
+ Value(const Quaternion& quaternion);
/**
* @brief Creates an string property value.
* @SINCE_1_0.0
* @param[in] stringValue A string
*/
- Value( const std::string& stringValue );
+ Value(const std::string& stringValue);
/**
* @brief Creates a string property value.
* @SINCE_1_0.0
* @param[in] stringValue A string
*/
- Value( const char* stringValue );
+ Value(const char* stringValue);
/**
* @brief Creates an array property value.
* @SINCE_1_0.0
* @param[in] arrayValue An array
*/
- Value( Property::Array& arrayValue );
+ Value(Property::Array& arrayValue);
/**
* @brief Creates an array property value.
* @SINCE_1_4.16
* @param[in] arrayValue An r-value array
*/
- Value( Property::Array&& arrayValue );
+ Value(Property::Array&& arrayValue);
/**
* @brief Creates a map property value.
* @SINCE_1_0.0
* @param[in] mapValue A map
*/
- Value( Property::Map& mapValue );
+ Value(Property::Map& mapValue);
/**
* @brief Creates a map property value.
* @SINCE_1_4.16
* @param[in] mapValue An r-value map
*/
- Value( Property::Map&& mapValue );
+ Value(Property::Map&& mapValue);
/**
* @brief Create a map property value from an initializer_list.
* @SINCE_1_4.16
* @param [in] values An initializer_list of pairs of index and value.
*/
- Value( const std::initializer_list< KeyValuePair >& values );
+ Value(const std::initializer_list<KeyValuePair>& values);
/**
* @brief Creates an extents property value.
* @SINCE_1_2.62
* @param[in] extentsValue A collection of 4 uint16_t values
*/
- Value( const Extents& extentsValue );
+ Value(const Extents& extentsValue);
/**
* @brief Creates an enumeration property value.
* @SINCE_1_4.36
* @param[in] enumValue An enumeration value
*/
- template< typename T, typename std::enable_if< std::is_enum< T >::value >::type* = nullptr >
- Value( T enumValue ) : Value( static_cast< int32_t >( enumValue ) )
+ template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
+ Value(T enumValue)
+ : Value(static_cast<int32_t>(enumValue))
{
}
* @SINCE_1_0.0
* @param[in] type The property value type
*/
- explicit Value( Type type );
+ explicit Value(Type type);
/**
* @brief Copy constructor.
* @SINCE_1_0.0
* @param[in] value The property value to copy
*/
- Value( const Value& value );
+ Value(const Value& value);
/**
* @brief Move constructor.
* @SINCE_1_4.16
* @param[in] value The property value to move from
*/
- Value( Value&& value );
+ Value(Value&& value);
/**
* @brief Assigns a property value.
* @param[in] value The property value to assign from
* @return a reference to this
*/
- Value& operator=( const Value& value );
+ Value& operator=(const Value& value);
/**
* @brief Move assignment operator.
* @param[in] value The property value to move from
* @return a reference to this
*/
- Value& operator=( Value&& value );
+ Value& operator=(Value&& value);
/**
* @brief Non-virtual destructor.
* @SINCE_1_4.36
* @return A value of type T
*/
- template< typename T, typename std::enable_if< ! std::is_enum< T >::value >::type* = nullptr >
+ template<typename T, typename std::enable_if<!std::is_enum<T>::value>::type* = nullptr>
T DALI_INTERNAL Get() const
{
T temp = T(); // value (zero) initialize
- Get( temp );
+ Get(temp);
return temp;
}
* @SINCE_1_4.36
* @return A value of type T
*/
- template< typename T, typename std::enable_if< std::is_enum< T >::value >::type* = nullptr >
+ template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
T DALI_INTERNAL Get() const
{
int32_t temp = 0; // value (zero) initialize
- Get( temp );
- return static_cast< T >( temp );
+ Get(temp);
+ return static_cast<T>(temp);
}
/**
* @return @c true if the value is successfully retrieved, @c false if the type is different
* @pre GetType() is any enumeration
*/
- template< typename T, typename std::enable_if< std::is_enum< T >::value >::type* = nullptr >
- bool DALI_INTERNAL Get( T& enumValue ) const
+ template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
+ bool DALI_INTERNAL Get(T& enumValue) const
{
int32_t temp = 0;
- if( ! Get( temp ) )
+ if(!Get(temp))
{
return false;
}
- enumValue = static_cast< T >( temp );
+ enumValue = static_cast<T>(temp);
return true;
}
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to bool.
*/
- bool Get( bool& boolValue ) const;
+ bool Get(bool& boolValue) const;
/**
* @brief Retrieves a floating-point value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to float.
*/
- bool Get( float& floatValue ) const;
+ bool Get(float& floatValue) const;
/**
* @brief Retrieves an integer value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to int.
*/
- bool Get( int32_t& integerValue ) const;
+ bool Get(int32_t& integerValue) const;
/**
* @brief Retrieves an integer rectangle.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Rect<int>.
*/
- bool Get( Rect<int32_t>& rect ) const;
+ bool Get(Rect<int32_t>& rect) const;
/**
* @brief Retrieves a vector value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Vector2.
*/
- bool Get( Vector2& vectorValue ) const;
+ bool Get(Vector2& vectorValue) const;
/**
* @brief Retrieves a vector value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Vector3.
*/
- bool Get( Vector3& vectorValue ) const;
+ bool Get(Vector3& vectorValue) const;
/**
* @brief Retrieves a vector value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Vector4.
*/
- bool Get( Vector4& vectorValue ) const;
+ bool Get(Vector4& vectorValue) const;
/**
* @brief Retrieves a matrix3 value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Matrix3.
*/
- bool Get( Matrix3& matrixValue ) const;
+ bool Get(Matrix3& matrixValue) const;
/**
* @brief Retrieves a matrix value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Matrix.
*/
- bool Get( Matrix& matrixValue ) const;
+ bool Get(Matrix& matrixValue) const;
/**
* @brief Retrieves an angle-axis value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to AngleAxis.
*/
- bool Get( AngleAxis& angleAxisValue ) const;
+ bool Get(AngleAxis& angleAxisValue) const;
/**
* @brief Retrieves a quaternion value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Quaternion.
*/
- bool Get( Quaternion& quaternionValue ) const;
+ bool Get(Quaternion& quaternionValue) const;
/**
* @brief Retrieves an string property value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to string.
*/
- bool Get( std::string& stringValue ) const;
+ bool Get(std::string& stringValue) const;
/**
* @brief Retrieves an array property value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() returns Property::ARRAY.
*/
- bool Get( Property::Array& arrayValue ) const;
+ bool Get(Property::Array& arrayValue) const;
/**
* @brief Retrieves an map property value.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() returns Property::MAP.
*/
- bool Get( Property::Map& mapValue ) const;
+ bool Get(Property::Map& mapValue) const;
/**
* @brief Retrieves the Array API of the Property::Value without copying the contents of the map.
* @return @c true if the value is successfully retrieved, @c false if the type is not convertible
* @pre GetType() is a type convertible to Extents.
*/
- bool Get( Extents& extentsValue ) const;
+ bool Get(Extents& extentsValue) const;
/**
* @brief Output to stream.
* @SINCE_1_0.0
*/
- friend DALI_CORE_API std::ostream& operator<<( std::ostream& ouputStream, const Property::Value& value );
+ friend DALI_CORE_API std::ostream& operator<<(std::ostream& ouputStream, const Property::Value& value);
private:
-
struct DALI_INTERNAL Impl;
- Impl* mImpl; ///< Pointer to the implementation
-
+ Impl* mImpl; ///< Pointer to the implementation
};
/**
* @param[in] value The value to insert
* @return The output stream operator
*/
-DALI_CORE_API std::ostream& operator<<( std::ostream& ouputStream, const Property::Value& value );
+DALI_CORE_API std::ostream& operator<<(std::ostream& ouputStream, const Property::Value& value);
/**
* @}
namespace Dali
{
-
Property::Property(Handle& obj, Property::Index propIndex)
: object(obj),
propertyIndex(propIndex),
propertyIndex(Property::INVALID_INDEX),
componentIndex(Property::INVALID_COMPONENT_INDEX)
{
- propertyIndex = object.GetPropertyIndex( propertyName );
+ propertyIndex = object.GetPropertyIndex(propertyName);
}
Property::Property(Handle& obj, const std::string& propertyName, int32_t compIndex)
propertyIndex(Property::INVALID_INDEX),
componentIndex(compIndex)
{
- propertyIndex = object.GetPropertyIndex( propertyName );
+ propertyIndex = object.GetPropertyIndex(propertyName);
}
Property::~Property()
*/
// EXTERNAL INCLUDES
+#include <cstdint> // int32_t
#include <string>
#include <utility>
-#include <cstdint> // int32_t
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
*/
using Index = int32_t;
- static constexpr int32_t INVALID_INDEX{-1}; ///< -1 is not a valid property index
- static constexpr int32_t INVALID_KEY{-1}; ///< -1 is not a valid property key
+ static constexpr int32_t INVALID_INDEX{-1}; ///< -1 is not a valid property index
+ static constexpr int32_t INVALID_KEY{-1}; ///< -1 is not a valid property key
static constexpr int32_t INVALID_COMPONENT_INDEX{-1}; ///< -1 is not a valid property index
using IndexContainer = Dali::Vector<Index>; ///< A vector of property indices @SINCE_1_0.0
*/
enum Type
{
- NONE, ///< No type @SINCE_1_0.0
-
- BOOLEAN, ///< A boolean type @SINCE_1_0.0
- FLOAT, ///< A float type @SINCE_1_0.0
- INTEGER, ///< An integer type @SINCE_1_0.0
- VECTOR2, ///< a vector array of size=2 with float precision @SINCE_1_0.0
- VECTOR3, ///< a vector array of size=3 with float precision @SINCE_1_0.0
- VECTOR4, ///< a vector array of size=4 with float precision @SINCE_1_0.0
- MATRIX3, ///< a 3x3 matrix @SINCE_1_0.0
- MATRIX, ///< a 4x4 matrix @SINCE_1_0.0
- RECTANGLE, ///< an integer array of size=4 @SINCE_1_0.0
- ROTATION, ///< either a quaternion or an axis angle rotation @SINCE_1_0.0
- STRING, ///< A string type @SINCE_1_0.0
- ARRAY, ///< an array of Property::Value @SINCE_1_0.0
- MAP, ///< a string key to Property:value mapping @SINCE_1_0.0
- EXTENTS ///< a collection of 4 x uint16_t @SINCE_1_2.62
+ NONE, ///< No type @SINCE_1_0.0
+
+ BOOLEAN, ///< A boolean type @SINCE_1_0.0
+ FLOAT, ///< A float type @SINCE_1_0.0
+ INTEGER, ///< An integer type @SINCE_1_0.0
+ VECTOR2, ///< a vector array of size=2 with float precision @SINCE_1_0.0
+ VECTOR3, ///< a vector array of size=3 with float precision @SINCE_1_0.0
+ VECTOR4, ///< a vector array of size=4 with float precision @SINCE_1_0.0
+ MATRIX3, ///< a 3x3 matrix @SINCE_1_0.0
+ MATRIX, ///< a 4x4 matrix @SINCE_1_0.0
+ RECTANGLE, ///< an integer array of size=4 @SINCE_1_0.0
+ ROTATION, ///< either a quaternion or an axis angle rotation @SINCE_1_0.0
+ STRING, ///< A string type @SINCE_1_0.0
+ ARRAY, ///< an array of Property::Value @SINCE_1_0.0
+ MAP, ///< a string key to Property:value mapping @SINCE_1_0.0
+ EXTENTS ///< a collection of 4 x uint16_t @SINCE_1_2.62
};
/**
*/
enum AccessMode
{
- READ_ONLY, ///< if the property is read-only @SINCE_1_0.0
- READ_WRITE, ///< If the property is read/writeable @SINCE_1_0.0
- ANIMATABLE, ///< If the property can be animated or constrained @SINCE_1_0.0
- ACCESS_MODE_COUNT ///< The number of access modes @SINCE_1_0.0
+ READ_ONLY, ///< if the property is read-only @SINCE_1_0.0
+ READ_WRITE, ///< If the property is read/writeable @SINCE_1_0.0
+ ANIMATABLE, ///< If the property can be animated or constrained @SINCE_1_0.0
+ ACCESS_MODE_COUNT ///< The number of access modes @SINCE_1_0.0
};
-
/**
* @brief Creates a Property instance.
*
* @param[in] object A valid handle to the target object
* @param[in] propertyIndex The index of a property
*/
- Property( Handle& object, Property::Index propertyIndex );
-
+ Property(Handle& object, Property::Index propertyIndex);
/**
* @brief Creates a Property instance.
* @param[in] propertyIndex The index of a property.
* @param[in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
*/
- Property( Handle& object, Property::Index propertyIndex, int32_t componentIndex );
+ Property(Handle& object, Property::Index propertyIndex, int32_t componentIndex);
/**
* @brief Creates a Property instance.
* @note This performs a property index query and is therefore slower than
* constructing a Property directly with the index.
*/
- Property( Handle& object, const std::string& propertyName );
+ Property(Handle& object, const std::string& propertyName);
/**
* @brief Creates a Property instance.
* @note This performs a property index query and is therefore slower than
* constructing a Property directly with the index.
*/
- Property( Handle& object, const std::string& propertyName, int32_t componentIndex );
+ Property(Handle& object, const std::string& propertyName, int32_t componentIndex);
/**
* @brief Non-virtual destructor; Property is not intended as a base class.
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
void RefObject::Reference()
{
+ // clang-format off
// The inline assembly below was tested on an ARMv8 64 bit platform on
// 2015-02-06 and found to run in 11.8 nanoseconds, whereas
// __sync_add_and_fetch( address, 1 ) required 18.8 nanoseconds.
__sync_add_and_fetch( &mCount, 1 );
#endif
+ // clang-format on
}
void RefObject::Unreference()
{
+ // clang-format off
+
// The output register:
int32_t newValue;
{
delete this;
}
+ // clang-format on
}
uint32_t RefObject::ReferenceCount()
}
} // namespace Dali
-
-
#define DALI_REF_OBJECT_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
class DALI_CORE_API RefObject
{
public:
-
/**
* @brief Increments the object's reference count.
* @SINCE_1_0.0
uint32_t ReferenceCount();
protected:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
RefObject& operator=(const RefObject& rhs);
private:
-
volatile uint32_t mCount; ///< Reference count
};
namespace Dali
{
-
TypeInfo::TypeInfo()
{
}
TypeInfo& TypeInfo::operator=(const TypeInfo& rhs) = default;
-TypeInfo::TypeInfo( TypeInfo&& rhs ) = default;
+TypeInfo::TypeInfo(TypeInfo&& rhs) = default;
-TypeInfo& TypeInfo::operator=( TypeInfo&& rhs ) = default;
+TypeInfo& TypeInfo::operator=(TypeInfo&& rhs) = default;
const std::string& TypeInfo::GetName() const
{
std::string TypeInfo::GetActionName(size_t index)
{
- return GetImplementation(*this).GetActionName( static_cast<uint32_t>( index ) );
+ return GetImplementation(*this).GetActionName(static_cast<uint32_t>(index));
}
size_t TypeInfo::GetSignalCount() const
std::string TypeInfo::GetSignalName(size_t index)
{
- return GetImplementation(*this).GetSignalName( static_cast<uint32_t>( index ) );
+ return GetImplementation(*this).GetSignalName(static_cast<uint32_t>(index));
}
size_t TypeInfo::GetPropertyCount() const
return GetImplementation(*this).GetPropertyCount();
}
-void TypeInfo::GetPropertyIndices( Property::IndexContainer& indices ) const
+void TypeInfo::GetPropertyIndices(Property::IndexContainer& indices) const
{
indices.Clear(); // We do not want to clear the container if called internally, so only clear here
- GetImplementation(*this).GetPropertyIndices( indices );
+ GetImplementation(*this).GetPropertyIndices(indices);
}
-const std::string& TypeInfo::GetPropertyName( Property::Index index ) const
+const std::string& TypeInfo::GetPropertyName(Property::Index index) const
{
- return GetImplementation(*this).GetRegisteredPropertyName( index );
+ return GetImplementation(*this).GetRegisteredPropertyName(index);
}
-Property::Index TypeInfo::GetChildPropertyIndex( const std::string& name ) const
+Property::Index TypeInfo::GetChildPropertyIndex(const std::string& name) const
{
- return GetImplementation(*this).GetChildPropertyIndex( name );
+ return GetImplementation(*this).GetChildPropertyIndex(name);
}
-const std::string& TypeInfo::GetChildPropertyName( Property::Index index ) const
+const std::string& TypeInfo::GetChildPropertyName(Property::Index index) const
{
- return GetImplementation(*this).GetChildPropertyName( index );
+ return GetImplementation(*this).GetChildPropertyName(index);
}
-Property::Type TypeInfo::GetChildPropertyType( Property::Index index ) const
+Property::Type TypeInfo::GetChildPropertyType(Property::Index index) const
{
- return GetImplementation(*this).GetChildPropertyType( index );
+ return GetImplementation(*this).GetChildPropertyType(index);
}
-void TypeInfo::GetChildPropertyIndices( Property::IndexContainer& indices ) const
+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 );
+ GetImplementation(*this).GetChildPropertyIndices(indices);
}
TypeInfo::TypeInfo(Internal::TypeInfo* internal)
#include <cstdint> // uint32_t
// INTERNAL INCLUDES
-#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/object/base-handle.h>
namespace Dali
{
namespace Internal DALI_INTERNAL
{
- class TypeInfo;
+class TypeInfo;
};
/**
class DALI_CORE_API TypeInfo : public BaseHandle
{
public:
-
using CreateFunction = BaseHandle (*)(); ///< Function signature for creating an instance of the associated object type. @SINCE_1_0.0
using ActionFunction = bool (*)(BaseObject*, const std::string&, const Property::Map&); ///< Function signature for creating scriptable actions @SINCE_1_0.0
* @param[in] value The new value of the property for the object specified
* @see PropertyRegistration.
*/
- using SetPropertyFunction = void (*)( BaseObject* object, Property::Index index, const Property::Value& value );
+ using SetPropertyFunction = void (*)(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* @brief Callback to get the value of an event-thread only property.
* @return The current value of the property for the object specified
* @see PropertyRegistration.
*/
- using GetPropertyFunction = Property::Value (*)( BaseObject* object, Property::Index index );
+ using GetPropertyFunction = Property::Value (*)(BaseObject* object, Property::Index index);
/**
* @brief Allows the creation of an empty TypeInfo handle.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- TypeInfo( TypeInfo&& rhs );
+ TypeInfo(TypeInfo&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- TypeInfo& operator=( TypeInfo&& rhs );
+ TypeInfo& operator=(TypeInfo&& rhs);
/**
* @brief Retrieves the type name for this type.
* @param[out] indices Container of property indices
* @note The container will be cleared
*/
- void GetPropertyIndices( Property::IndexContainer& indices ) const;
+ void GetPropertyIndices(Property::IndexContainer& indices) const;
/**
* @brief Retrieves all the child property indices for this type.
* @param[out] indices Container of property indices
* @note The container will be cleared
*/
- void GetChildPropertyIndices( Property::IndexContainer& indices ) const;
+ void GetChildPropertyIndices(Property::IndexContainer& indices) const;
/**
* @brief Given a property index, retrieve the property name associated with it.
* @exception DaliException If index is not valid.
* @note this method only works for custom registered properties
*/
- const std::string& GetPropertyName( Property::Index index ) const;
-
+ const std::string& GetPropertyName(Property::Index index) const;
/**
* @brief Given a child property name, retrieve the property index associated with it,
* @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;
+ Property::Index GetChildPropertyIndex(const std::string& name) const;
/**
* @brief Given a child property index, retrieve the property name associated with it.
* @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;
+ const std::string& GetChildPropertyName(Property::Index index) const;
/**
* @brief Given a child property index, retrieve the property name associated with it.
* @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;
-
-
+ Property::Type GetChildPropertyType(Property::Index index) const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Dali Get() method.
*/
explicit DALI_INTERNAL TypeInfo(Internal::TypeInfo* typeInfo);
/// @endcond
-
};
/**
* These internal macros exist as to perform the compile-time check on the enumeration order, the __COUNTER__ macro is used twice.
* Using it twice within the same macro would result in two different values.
*/
-#define DALI_TOKEN_PASTE_EXPAND( x, y ) x ## y
-#define DALI_TOKEN_PASTE( x, y ) DALI_TOKEN_PASTE_EXPAND(x, y)
+#define DALI_TOKEN_PASTE_EXPAND(x, y) x##y
+#define DALI_TOKEN_PASTE(x, y) DALI_TOKEN_PASTE_EXPAND(x, y)
-#define DALI_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex ) \
- Dali::PropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Dali::Property::valueType, &objectType::SetProperty, &objectType::GetProperty ); \
- static_assert( ( objectNamespace::objectType::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX ) == count );
+#define DALI_PROPERTY_REGISTRATION_INTERNAL(count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex) \
+ Dali::PropertyRegistration DALI_TOKEN_PASTE(property, count)(typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Dali::Property::valueType, &objectType::SetProperty, &objectType::GetProperty); \
+ static_assert((objectNamespace::objectType::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX) == count);
-#define DALI_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY( count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex ) \
- Dali::PropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Dali::Property::valueType, NULL, &objectType::GetProperty ); \
- static_assert( ( objectNamespace::objectType::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX ) == count );
+#define DALI_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY(count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex) \
+ Dali::PropertyRegistration DALI_TOKEN_PASTE(property, count)(typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Dali::Property::valueType, NULL, &objectType::GetProperty); \
+ static_assert((objectNamespace::objectType::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX) == count);
-#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex) \
- Dali::AnimatablePropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Dali::Property::valueType );
+#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL(count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex) \
+ Dali::AnimatablePropertyRegistration DALI_TOKEN_PASTE(property, count)(typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, Dali::Property::valueType);
-#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, value, enumIndex) \
- Dali::AnimatablePropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, value );
+#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT_INTERNAL(count, typeRegistrationObject, objectNamespace, objectType, text, value, enumIndex) \
+ Dali::AnimatablePropertyRegistration DALI_TOKEN_PASTE(property, count)(typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, value);
-#define DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex) \
- Dali::AnimatablePropertyComponentRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, objectNamespace::objectType::Property::baseEnumIndex, componentIndex );
+#define DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL(count, typeRegistrationObject, objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex) \
+ Dali::AnimatablePropertyComponentRegistration DALI_TOKEN_PASTE(property, count)(typeRegistrationObject, text, objectNamespace::objectType::Property::enumIndex, objectNamespace::objectType::Property::baseEnumIndex, componentIndex);
-#define DALI_CHILD_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex ) \
- Dali::ChildPropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace::objectType::ChildProperty::enumIndex, Property::valueType );
+#define DALI_CHILD_PROPERTY_REGISTRATION_INTERNAL(count, typeRegistrationObject, objectNamespace, objectType, text, valueType, enumIndex) \
+ Dali::ChildPropertyRegistration DALI_TOKEN_PASTE(property, count)(typeRegistrationObject, text, objectNamespace::objectType::ChildProperty::enumIndex, Property::valueType);
-#define DALI_SIGNAL_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, textVariable ) \
- const char* const textVariable = text; \
- Dali::SignalConnectorType DALI_TOKEN_PASTE( signalConnector, count ) ( typeRegistrationObject, text, &objectNamespace::Internal::objectType::DoConnectSignal );
-
-#define DALI_ACTION_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectNamespace, objectType, text, textVariable ) \
- const char* const textVariable = text; \
- Dali::TypeAction DALI_TOKEN_PASTE( signalConnector, count ) ( typeRegistrationObject, text, &objectNamespace::Internal::objectType::DoAction );
+#define DALI_SIGNAL_REGISTRATION_INTERNAL(count, typeRegistrationObject, objectNamespace, objectType, text, textVariable) \
+ const char* const textVariable = text; \
+ Dali::SignalConnectorType DALI_TOKEN_PASTE(signalConnector, count)(typeRegistrationObject, text, &objectNamespace::Internal::objectType::DoConnectSignal);
+#define DALI_ACTION_REGISTRATION_INTERNAL(count, typeRegistrationObject, objectNamespace, objectType, text, textVariable) \
+ const char* const textVariable = text; \
+ Dali::TypeAction DALI_TOKEN_PASTE(signalConnector, count)(typeRegistrationObject, text, &objectNamespace::Internal::objectType::DoAction);
/**
* @brief These macros are used to define properties for implementations of CustomActor.
* Using these macros have certain prerequisites on how the property enumeration is defined.
* Please see the Programming Guide (within the generated Doxygen) for full details.
*/
-#define DALI_TYPE_REGISTRATION_BEGIN( thisType, baseType, createFunction ) \
- Dali::TypeRegistration typeRegistration( typeid( thisType ), typeid( baseType ), createFunction );
-
-#define DALI_TYPE_REGISTRATION_BEGIN_CREATE( thisType, baseType, createFunction, createAtStartup ) \
- Dali::TypeRegistration typeRegistration( typeid( thisType ), typeid( baseType ), createFunction, createAtStartup );
+#define DALI_TYPE_REGISTRATION_BEGIN(thisType, baseType, createFunction) \
+ Dali::TypeRegistration typeRegistration(typeid(thisType), typeid(baseType), createFunction);
-#define DALI_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex )
+#define DALI_TYPE_REGISTRATION_BEGIN_CREATE(thisType, baseType, createFunction, createAtStartup) \
+ Dali::TypeRegistration typeRegistration(typeid(thisType), typeid(baseType), createFunction, createAtStartup);
-#define DALI_PROPERTY_REGISTRATION_READ_ONLY( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY( __COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex )
+#define DALI_PROPERTY_REGISTRATION(objectNamespace, objectType, text, valueType, enumIndex) \
+ DALI_PROPERTY_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex)
-#define DALI_ANIMATABLE_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex )
+#define DALI_PROPERTY_REGISTRATION_READ_ONLY(objectNamespace, objectType, text, valueType, enumIndex) \
+ DALI_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY(__COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex)
-#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( objectNamespace, objectType, text, value, enumIndex ) \
- DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, value, enumIndex )
+#define DALI_ANIMATABLE_PROPERTY_REGISTRATION(objectNamespace, objectType, text, valueType, enumIndex) \
+ DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex)
-#define DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex ) \
- DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex )
+#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(objectNamespace, objectType, text, value, enumIndex) \
+ DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, text, value, enumIndex)
-#define DALI_CHILD_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
- DALI_CHILD_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex )
+#define DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex) \
+ DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, text, enumIndex, baseEnumIndex, componentIndex)
-#define DALI_SIGNAL_REGISTRATION( objectNamespace, objectType, text, textVariable ) \
- DALI_SIGNAL_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, textVariable )
+#define DALI_CHILD_PROPERTY_REGISTRATION(objectNamespace, objectType, text, valueType, enumIndex) \
+ DALI_CHILD_PROPERTY_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, text, valueType, enumIndex)
-#define DALI_ACTION_REGISTRATION( objectNamespace, objectType, text, textVariable ) \
- DALI_ACTION_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, text, textVariable )
+#define DALI_SIGNAL_REGISTRATION(objectNamespace, objectType, text, textVariable) \
+ DALI_SIGNAL_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, text, textVariable)
-#define DALI_TYPE_REGISTRATION_END( ) // This macro exists for consistency and readability.
+#define DALI_ACTION_REGISTRATION(objectNamespace, objectType, text, textVariable) \
+ DALI_ACTION_REGISTRATION_INTERNAL(__COUNTER__, typeRegistration, objectNamespace, objectType, text, textVariable)
+#define DALI_TYPE_REGISTRATION_END() // This macro exists for consistency and readability.
#endif // DALI_TYPE_REGISTRY_HELPER_H
// EXTERNAL INCLUDES
// INTERNAL INCLUDES
-#include <dali/public-api/object/property-index-ranges.h>
#include <dali/internal/event/common/type-registry-impl.h>
#include <dali/internal/event/object/default-property-metadata.h>
+#include <dali/public-api/object/property-index-ranges.h>
namespace Dali
{
-
TypeRegistry::TypeRegistry()
{
}
TypeRegistry& TypeRegistry::operator=(const TypeRegistry& rhs) = default;
-TypeRegistry::TypeRegistry( TypeRegistry&& rhs ) = default;
+TypeRegistry::TypeRegistry(TypeRegistry&& rhs) = default;
-TypeRegistry& TypeRegistry::operator=( TypeRegistry&& rhs ) = default;
+TypeRegistry& TypeRegistry::operator=(TypeRegistry&& rhs) = default;
TypeRegistry TypeRegistry::Get()
{
return TypeRegistry(Internal::TypeRegistry::Get());
}
-Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::string &uniqueTypeName )
+Dali::TypeInfo TypeRegistry::GetTypeInfo(const std::string& uniqueTypeName)
{
- return Dali::TypeInfo( GetImplementation(*this).GetTypeInfo( uniqueTypeName ).Get() );
+ return Dali::TypeInfo(GetImplementation(*this).GetTypeInfo(uniqueTypeName).Get());
}
-Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::type_info& registerType )
+Dali::TypeInfo TypeRegistry::GetTypeInfo(const std::type_info& registerType)
{
- return Dali::TypeInfo( GetImplementation(*this).GetTypeInfo( registerType ).Get() );
+ return Dali::TypeInfo(GetImplementation(*this).GetTypeInfo(registerType).Get());
}
size_t TypeRegistry::GetTypeNameCount() const
std::string TypeRegistry::GetTypeName(size_t index) const
{
- return GetImplementation(*this).GetTypeName( static_cast<uint32_t>( index ) );
+ return GetImplementation(*this).GetTypeName(static_cast<uint32_t>(index));
}
TypeRegistry::TypeRegistry(Internal::TypeRegistry* internal)
{
}
-TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
- TypeInfo::CreateFunction f )
- : mReference(Internal::TypeRegistry::Get())
+TypeRegistration::TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f)
+: mReference(Internal::TypeRegistry::Get())
{
- Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
+ Internal::TypeRegistry* impl = Internal::TypeRegistry::Get();
- mName = impl->Register( registerType, baseType, f, false );
+ mName = impl->Register(registerType, baseType, f, false);
}
-TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
- TypeInfo::CreateFunction f, bool callCreateOnInit )
- : mReference(Internal::TypeRegistry::Get())
+TypeRegistration::TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f, bool callCreateOnInit)
+: mReference(Internal::TypeRegistry::Get())
{
- Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
+ Internal::TypeRegistry* impl = Internal::TypeRegistry::Get();
- mName = impl->Register( registerType, baseType, f, callCreateOnInit );
+ mName = impl->Register(registerType, baseType, f, callCreateOnInit);
}
-TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
- TypeInfo::CreateFunction f, const DefaultPropertyMetadata& defaultProperties )
+TypeRegistration::TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f, const DefaultPropertyMetadata& defaultProperties)
{
- Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
+ Internal::TypeRegistry* impl = Internal::TypeRegistry::Get();
- mName = impl->Register( registerType, baseType, f, false, defaultProperties.propertyTable, defaultProperties.propertyCount );
+ mName = impl->Register(registerType, baseType, f, false, defaultProperties.propertyTable, defaultProperties.propertyCount);
}
-TypeRegistration::TypeRegistration( const std::string& name, const std::type_info& baseType,
- TypeInfo::CreateFunction f )
- : mReference(Internal::TypeRegistry::Get())
+TypeRegistration::TypeRegistration(const std::string& name, const std::type_info& baseType, TypeInfo::CreateFunction f)
+: mReference(Internal::TypeRegistry::Get())
{
- Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
+ Internal::TypeRegistry* impl = Internal::TypeRegistry::Get();
- mName = impl->Register( name, baseType, f, false );
+ mName = impl->Register(name, baseType, f, false);
}
-
const std::string TypeRegistration::RegisteredName() const
{
return mName;
}
-SignalConnectorType::SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func )
+SignalConnectorType::SignalConnectorType(TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func)
{
- Internal::TypeRegistry::Get()->RegisterSignal( typeRegistration, name, func );
+ Internal::TypeRegistry::Get()->RegisterSignal(typeRegistration, name, func);
}
-TypeAction::TypeAction( TypeRegistration ®istered, const std::string &name, TypeInfo::ActionFunction f)
+TypeAction::TypeAction(TypeRegistration& registered, const std::string& name, TypeInfo::ActionFunction f)
{
- Internal::TypeRegistry::Get()->RegisterAction( registered, name, f );
+ Internal::TypeRegistry::Get()->RegisterAction(registered, name, f);
}
-PropertyRegistration::PropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc )
+PropertyRegistration::PropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc)
{
- DALI_ASSERT_ALWAYS( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) );
+ DALI_ASSERT_ALWAYS((index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterProperty( registered, name, index, type, setFunc, getFunc );
+ Internal::TypeRegistry::Get()->RegisterProperty(registered, name, index, type, setFunc, getFunc);
}
-AnimatablePropertyRegistration::AnimatablePropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type )
+AnimatablePropertyRegistration::AnimatablePropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type)
{
- DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) );
+ DALI_ASSERT_ALWAYS((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterAnimatableProperty( registered, name, index, type );
+ Internal::TypeRegistry::Get()->RegisterAnimatableProperty(registered, name, index, type);
}
-AnimatablePropertyRegistration::AnimatablePropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value )
+AnimatablePropertyRegistration::AnimatablePropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value)
{
- DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) );
+ DALI_ASSERT_ALWAYS((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterAnimatableProperty( registered, name, index, value );
+ Internal::TypeRegistry::Get()->RegisterAnimatableProperty(registered, name, index, value);
}
-AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex)
+AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex)
{
- DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) );
+ DALI_ASSERT_ALWAYS((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterAnimatablePropertyComponent( registered, name, index, baseIndex, componentIndex );
+ Internal::TypeRegistry::Get()->RegisterAnimatablePropertyComponent(registered, name, index, baseIndex, componentIndex);
}
-ChildPropertyRegistration::ChildPropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type )
+ChildPropertyRegistration::ChildPropertyRegistration(TypeRegistration& 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 ) );
+ DALI_ASSERT_ALWAYS((index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterChildProperty( registered, name, index, type );
+ Internal::TypeRegistry::Get()->RegisterChildProperty(registered, name, index, type);
}
-ChildPropertyRegistration::ChildPropertyRegistration( const std::string& registered, const std::string& name, Property::Index index, Property::Type 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 ) );
+ DALI_ASSERT_ALWAYS((index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterChildProperty( registered, name, index, type );
+ Internal::TypeRegistry::Get()->RegisterChildProperty(registered, name, index, type);
}
-
} // namespace Dali
*/
// EXTERNAL INCLUDES
-#include <typeinfo>
#include <cstdint> // uint32_t
+#include <typeinfo>
// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- TypeRegistry( TypeRegistry&& rhs );
+ TypeRegistry(TypeRegistry&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- TypeRegistry& operator=( TypeRegistry&& rhs );
+ TypeRegistry& operator=(TypeRegistry&& rhs);
/**
* @brief Gets TypeInfo for a registered type.
* @param[in] uniqueTypeName A unique type name
* @return TypeInfo if the type exists, otherwise an empty handle
*/
- TypeInfo GetTypeInfo( const std::string &uniqueTypeName );
+ TypeInfo GetTypeInfo(const std::string& uniqueTypeName);
/**
* @brief Gets TypeInfo for a registered type.
* @param[in] registerType The registered type info
* @return TypeInfo if the type exists, otherwise an empty handle
*/
- TypeInfo GetTypeInfo( const std::type_info& registerType );
+ TypeInfo GetTypeInfo(const std::type_info& registerType);
/**
* @brief Gets type name count.
std::string GetTypeName(size_t index) const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Dali Get() method.
* @SINCE_1_0.0
* @param[in] typeRegistry A pointer to a Dali resource
*/
- explicit DALI_INTERNAL TypeRegistry(Internal::TypeRegistry*typeRegistry);
+ explicit DALI_INTERNAL TypeRegistry(Internal::TypeRegistry* typeRegistry);
/// @endcond
};
* @param[in] baseType The base type info of registerType
* @param[in] f registerType Instance creation function
*/
- TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
- TypeInfo::CreateFunction f );
+ TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f);
/**
* @brief Constructor registers the type creation function.
* @param[in] f registerType instance creation function
* @param[in] callCreateOnInit If true the creation function is called as part of Dali initialization
*/
- TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
- TypeInfo::CreateFunction f, bool callCreateOnInit );
+ TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f, bool callCreateOnInit);
/**
* @brief Constructor registers the type creation function.
* @param[in] f registerType instance creation function
* @param[in] defaultProperties the default property meta-data
*/
- TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
- TypeInfo::CreateFunction f, const DefaultPropertyMetadata& defaultProperties );
+ TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f, const DefaultPropertyMetadata& defaultProperties);
/**
* @brief Constructor registers the type creation function for a named class or type.
* @param[in] baseType the base type info of registerType
* @param[in] f registerType instance creation function
*/
- TypeRegistration( const std::string& name, const std::type_info& baseType,
- TypeInfo::CreateFunction f );
+ TypeRegistration(const std::string& name, const std::type_info& baseType, TypeInfo::CreateFunction f);
/**
* @brief The name the type is registered under (derived from type_info).
private:
TypeRegistry mReference; ///< Reference to the type registry
- std::string mName; ///< Name of the type
+ std::string mName; ///< Name of the type
};
/**
* @param[in] name The signal name
* @param[in] func The signal connector function
*/
- SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func );
+ SignalConnectorType(TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func);
};
/**
* @param[in] name The action name
* @param[in] f The action function
*/
- TypeAction( TypeRegistration ®istered, const std::string &name, TypeInfo::ActionFunction f);
+ TypeAction(TypeRegistration& registered, const std::string& name, TypeInfo::ActionFunction f);
};
/**
class DALI_CORE_API PropertyRegistration
{
public:
-
/**
* @brief This constructor registers the property with the registered type.
*
* @note "getFunc" MUST be provided.
*
*/
- PropertyRegistration( TypeRegistration& registered,
- const std::string& name, Property::Index index, Property::Type type,
- TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc );
+ PropertyRegistration(TypeRegistration& registered,
+ const std::string& name,
+ Property::Index index,
+ Property::Type type,
+ TypeInfo::SetPropertyFunction setFunc,
+ TypeInfo::GetPropertyFunction getFunc);
};
/**
class DALI_CORE_API AnimatablePropertyRegistration
{
public:
-
/**
* @brief This constructor registers the animatable property with the registered type.
*
* @param[in] type The property value type
* @pre "registered" must be registered with the TypeRegistry.
*/
- AnimatablePropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type );
+ AnimatablePropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type);
/**
* @brief This constructor registers the animatable property with the registered default value.
* @param[in] value The property default value
* @pre "registered" must be registered with the TypeRegistry.
*/
- AnimatablePropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value );
+ AnimatablePropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value);
};
/**
class DALI_CORE_API AnimatablePropertyComponentRegistration
{
public:
-
/**
* @brief This constructor registers a component of an animatable property where
* the base animatable property must be a property that supports property component
* @param[in] componentIndex The index of the component (e.g. 0 for the x component of a Vector2 property and 1 for the y component of a Vector2 property)
* @pre "registered" must be registered with the TypeRegistry.
*/
- AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex );
+ AnimatablePropertyComponentRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex);
};
/**
class DALI_CORE_API ChildPropertyRegistration
{
public:
-
/**
* @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.
* @param[in] type The property value type
* @pre "registered" must be registered with the TypeRegistry.
*/
- ChildPropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type );
+ 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
* @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 );
+ ChildPropertyRegistration(const std::string& registered, const std::string& name, Property::Index index, Property::Type type);
};
-
/**
* @}
*/
namespace Dali
{
-
struct WeakHandleBase::Impl : public BaseObject::Impl::Observer
{
// Construction
Impl()
- : mObject( nullptr )
+ : mObject(nullptr)
{
}
// Construction
- Impl( BaseHandle& handle )
- : mObject( nullptr )
+ Impl(BaseHandle& handle)
+ : mObject(nullptr)
{
- if( handle )
+ if(handle)
{
- mObject = static_cast<Dali::BaseObject*>( handle.GetObjectPtr() );
- if( mObject )
+ mObject = static_cast<Dali::BaseObject*>(handle.GetObjectPtr());
+ if(mObject)
{
- BaseObject::Impl::Get( *mObject ).AddObserver( *this );
+ BaseObject::Impl::Get(*mObject).AddObserver(*this);
}
}
}
void Reset()
{
- if( mObject )
+ if(mObject)
{
- BaseObject::Impl::Get( *mObject ).RemoveObserver( *this );
+ BaseObject::Impl::Get(*mObject).RemoveObserver(*this);
mObject = nullptr;
}
}
/**
* From BaseObject::Impl::Observer
*/
- void ObjectDestroyed( BaseObject& object ) override
+ void ObjectDestroyed(BaseObject& object) override
{
mObject = nullptr;
}
};
WeakHandleBase::WeakHandleBase()
-: mImpl( new Impl() )
+: mImpl(new Impl())
{
}
-WeakHandleBase::WeakHandleBase( BaseHandle& handle )
-: mImpl( new Impl( handle ) )
+WeakHandleBase::WeakHandleBase(BaseHandle& handle)
+: mImpl(new Impl(handle))
{
}
}
WeakHandleBase::WeakHandleBase(const WeakHandleBase& handle)
-: mImpl( nullptr )
+: mImpl(nullptr)
{
BaseHandle object = handle.GetBaseHandle();
- mImpl = new Impl(object);
+ mImpl = new Impl(object);
}
-WeakHandleBase& WeakHandleBase::operator=( const WeakHandleBase& rhs )
+WeakHandleBase& WeakHandleBase::operator=(const WeakHandleBase& rhs)
{
- if( this != &rhs )
+ if(this != &rhs)
{
delete mImpl;
BaseHandle handle = rhs.GetBaseHandle();
- mImpl = new Impl(handle);
+ mImpl = new Impl(handle);
}
return *this;
}
-WeakHandleBase::WeakHandleBase( WeakHandleBase&& rhs )
-: mImpl( rhs.mImpl )
+WeakHandleBase::WeakHandleBase(WeakHandleBase&& rhs)
+: mImpl(rhs.mImpl)
{
rhs.mImpl = nullptr;
}
-WeakHandleBase& WeakHandleBase::operator=( WeakHandleBase&& rhs )
+WeakHandleBase& WeakHandleBase::operator=(WeakHandleBase&& rhs)
{
- if (this != &rhs)
+ if(this != &rhs)
{
delete mImpl;
- mImpl = rhs.mImpl;
+ mImpl = rhs.mImpl;
rhs.mImpl = nullptr;
}
return *this;
}
-bool WeakHandleBase::operator==( const WeakHandleBase& rhs ) const
+bool WeakHandleBase::operator==(const WeakHandleBase& rhs) const
{
return this->mImpl->mObject == rhs.mImpl->mObject;
}
-bool WeakHandleBase::operator!=( const WeakHandleBase& rhs ) const
+bool WeakHandleBase::operator!=(const WeakHandleBase& rhs) const
{
- return !( *this == rhs );
+ return !(*this == rhs);
}
BaseHandle WeakHandleBase::GetBaseHandle() const
{
- return mImpl ? BaseHandle( mImpl->mObject ) : BaseHandle();
+ return mImpl ? BaseHandle(mImpl->mObject) : BaseHandle();
}
void WeakHandleBase::Reset()
mImpl->Reset();
}
-
-} // Dali
+} // namespace Dali
*/
// INTERNAL INCLUDES
-#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/actors/custom-actor.h>
+#include <dali/public-api/object/base-handle.h>
namespace Dali
{
*/
class DALI_CORE_API WeakHandleBase
{
-
public:
-
/**
* @brief Default constructor which provides an uninitialized Dali::WeakHandleBase.
* @SINCE_1_2.60
* @SINCE_1_2.60
* @param [in] handle A reference to the handle of the DALi object
*/
- WeakHandleBase( BaseHandle& handle );
+ WeakHandleBase(BaseHandle& handle);
/**
* @brief Destructor to free resources.
* @param [in] rhs A reference to the copied WeakHandleBase
* @return A reference to this WeakHandleBase
*/
- WeakHandleBase& operator=( const WeakHandleBase& rhs );
+ WeakHandleBase& operator=(const WeakHandleBase& rhs);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- WeakHandleBase( WeakHandleBase&& rhs );
+ WeakHandleBase(WeakHandleBase&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- WeakHandleBase& operator=( WeakHandleBase&& rhs );
+ WeakHandleBase& operator=(WeakHandleBase&& rhs);
/**
* @brief Equality operator overload.
*/
void Reset();
-
protected:
-
/// @cond internal
struct Impl;
Impl* mImpl;
/// @endcond
};
-
/**
* @brief Weak handle for the given type of DALi object.
* @SINCE_1_2.60
* @see WeakHandleBase
*/
-template < class T >
+template<class T>
class WeakHandle : public WeakHandleBase
{
public:
-
/**
* @copydoc Dali::WeakHandleBase::WeakHandleBase()
*/
/**
* @copydoc Dali::WeakHandleBase::WeakHandleBase( BaseHandle& )
*/
- WeakHandle( T& handle )
- : WeakHandleBase( handle )
+ WeakHandle(T& handle)
+ : WeakHandleBase(handle)
{
}
/**
* @copydoc Dali::WeakHandleBase::~WeakHandleBase()
*/
- ~WeakHandle() {}
+ ~WeakHandle()
+ {
+ }
/**
* @copydoc Dali::WeakHandleBase::WeakHandleBase(const WeakHandleBase&)
*/
WeakHandle(const WeakHandle& handle)
- : WeakHandleBase( handle )
+ : WeakHandleBase(handle)
{
}
/**
* @copydoc Dali::WeakHandleBase::operator=(const WeakHandleBase& rhs)
*/
- WeakHandle& operator=( const WeakHandle& rhs )
+ WeakHandle& operator=(const WeakHandle& rhs)
{
WeakHandleBase::operator=(rhs);
return *this;
/**
* @copydoc Dali::WeakHandleBase::WeakHandleBase(WeakHandleBase&& rhs)
*/
- WeakHandle( WeakHandle&& rhs ) = default;
+ WeakHandle(WeakHandle&& rhs) = default;
/**
* @copydoc Dali::WeakHandleBase::operator=(WeakHandleBase&& rhs)
*/
- WeakHandle& operator=( WeakHandle&& rhs ) = default;
+ WeakHandle& operator=(WeakHandle&& rhs) = default;
/**
* @copydoc Dali::WeakHandleBase::operator==()
*/
T GetHandle() const
{
- BaseHandle handle( WeakHandleBase::GetBaseHandle() );
- if( handle )
+ BaseHandle handle(WeakHandleBase::GetBaseHandle());
+ if(handle)
{
- return DownCast< T >( handle );
+ return DownCast<T>(handle);
}
else
{
namespace Dali
{
-
RenderTaskList::RenderTaskList()
{
}
-RenderTaskList RenderTaskList::DownCast( BaseHandle handle )
+RenderTaskList RenderTaskList::DownCast(BaseHandle handle)
{
- return RenderTaskList( dynamic_cast<Dali::Internal::RenderTaskList*>( handle.GetObjectPtr() ) );
+ return RenderTaskList(dynamic_cast<Dali::Internal::RenderTaskList*>(handle.GetObjectPtr()));
}
RenderTaskList::~RenderTaskList()
RenderTaskList& RenderTaskList::operator=(const RenderTaskList& rhs) = default;
-RenderTaskList::RenderTaskList( RenderTaskList&& rhs ) = default;
+RenderTaskList::RenderTaskList(RenderTaskList&& rhs) = default;
-RenderTaskList& RenderTaskList::operator=( RenderTaskList&& rhs ) = default;
+RenderTaskList& RenderTaskList::operator=(RenderTaskList&& rhs) = default;
RenderTask RenderTaskList::CreateTask()
{
- return RenderTask( GetImplementation(*this).CreateTask().Get() );
+ return RenderTask(GetImplementation(*this).CreateTask().Get());
}
-void RenderTaskList::RemoveTask( RenderTask task )
+void RenderTaskList::RemoveTask(RenderTask task)
{
- if( task ) // don't crash if called with empty task handle
+ if(task) // don't crash if called with empty task handle
{
- GetImplementation(*this).RemoveTask( GetImplementation( task ) );
+ GetImplementation(*this).RemoveTask(GetImplementation(task));
}
}
return GetImplementation(*this).GetTaskCount();
}
-RenderTask RenderTaskList::GetTask( uint32_t index ) const
+RenderTask RenderTaskList::GetTask(uint32_t index) const
{
- return RenderTask( GetImplementation(*this).GetTask( index ).Get() );
+ return RenderTask(GetImplementation(*this).GetTask(index).Get());
}
-RenderTaskList::RenderTaskList( Internal::RenderTaskList* internal )
-: BaseHandle( internal )
+RenderTaskList::RenderTaskList(Internal::RenderTaskList* internal)
+: BaseHandle(internal)
{
}
} // namespace Dali
-
class DALI_CORE_API RenderTaskList : public BaseHandle
{
public:
-
/**
* @brief Creates an empty RenderTaskList handle.
*
* @param[in] handle A handle to an object
* @return A handle to a RenderTaskList or an uninitialized handle
*/
- static RenderTaskList DownCast( BaseHandle handle );
+ static RenderTaskList DownCast(BaseHandle handle);
/**
* @brief Destructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- RenderTaskList( RenderTaskList&& rhs );
+ RenderTaskList(RenderTaskList&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- RenderTaskList& operator=( RenderTaskList&& rhs );
+ RenderTaskList& operator=(RenderTaskList&& rhs);
/**
* @brief Creates a new RenderTask.
* @SINCE_1_0.0
* @param[in] task The render-task to remove.
*/
- void RemoveTask( RenderTask task );
+ void RemoveTask(RenderTask task);
/**
* @brief Queries the number of render-tasks in the list.
* @return A handle to the render-task
* @pre index should be in range i.e. less than GetTaskCount().
*/
- RenderTask GetTask( uint32_t index ) const;
+ RenderTask GetTask(uint32_t index) const;
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Dali New() methods.
* @SINCE_1_0.0
* @param [in] renderTask A pointer to a newly allocated render-task
*/
- explicit DALI_INTERNAL RenderTaskList( Internal::RenderTaskList* renderTask );
+ explicit DALI_INTERNAL RenderTaskList(Internal::RenderTaskList* renderTask);
/// @endcond
};
#include <dali/public-api/render-tasks/render-task.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/constants.h>
-#include <dali/public-api/rendering/frame-buffer.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
+#include <dali/public-api/common/constants.h>
+#include <dali/public-api/rendering/frame-buffer.h>
namespace Dali
{
-
-static bool DefaultScreenToFrameBufferFunction( Vector2& coordinates )
+static bool DefaultScreenToFrameBufferFunction(Vector2& coordinates)
{
return false;
}
-static bool FullScreenFrameBufferFunction( Vector2& coordinates )
+static bool FullScreenFrameBufferFunction(Vector2& coordinates)
{
// Don't need to modify frameBufferCoords
return true;
const bool RenderTask::DEFAULT_EXCLUSIVE = false;
const bool RenderTask::DEFAULT_INPUT_ENABLED = true;
-const Vector4 RenderTask::DEFAULT_CLEAR_COLOR = Vector4( 0.0f, 0.0f, 0.0f, 1.0f ); // cannot use Color::Black because it may or may not be initialized yet
+const Vector4 RenderTask::DEFAULT_CLEAR_COLOR = Vector4(0.0f, 0.0f, 0.0f, 1.0f); // cannot use Color::Black because it may or may not be initialized yet
const bool RenderTask::DEFAULT_CLEAR_ENABLED = false;
const bool RenderTask::DEFAULT_CULL_MODE = true;
const uint32_t RenderTask::DEFAULT_REFRESH_RATE = REFRESH_ALWAYS;
{
}
-RenderTask RenderTask::DownCast( BaseHandle handle )
+RenderTask RenderTask::DownCast(BaseHandle handle)
{
- return RenderTask( dynamic_cast<Dali::Internal::RenderTask*>( handle.GetObjectPtr() ) );
+ return RenderTask(dynamic_cast<Dali::Internal::RenderTask*>(handle.GetObjectPtr()));
}
RenderTask::~RenderTask()
RenderTask& RenderTask::operator=(const RenderTask& rhs) = default;
-RenderTask::RenderTask( RenderTask&& rhs ) = default;
+RenderTask::RenderTask(RenderTask&& rhs) = default;
-RenderTask& RenderTask::operator=( RenderTask&& rhs ) = default;
+RenderTask& RenderTask::operator=(RenderTask&& rhs) = default;
-void RenderTask::SetSourceActor( Actor actor )
+void RenderTask::SetSourceActor(Actor actor)
{
// NULL handle is allowed
- Internal::Actor* actorImpl( nullptr );
- if ( actor )
+ Internal::Actor* actorImpl(nullptr);
+ if(actor)
{
- actorImpl = &GetImplementation( actor );
+ actorImpl = &GetImplementation(actor);
}
- GetImplementation(*this).SetSourceActor( actorImpl );
+ GetImplementation(*this).SetSourceActor(actorImpl);
}
Actor RenderTask::GetSourceActor() const
return Dali::Actor(GetImplementation(*this).GetSourceActor());
}
-void RenderTask::SetExclusive( bool exclusive )
+void RenderTask::SetExclusive(bool exclusive)
{
- GetImplementation(*this).SetExclusive( exclusive );
+ GetImplementation(*this).SetExclusive(exclusive);
}
bool RenderTask::IsExclusive() const
return GetImplementation(*this).IsExclusive();
}
-void RenderTask::SetCameraActor( CameraActor cameraActor )
+void RenderTask::SetCameraActor(CameraActor cameraActor)
{
// NULL handle is allowed
- Internal::CameraActor* actorImpl( nullptr );
- if ( cameraActor )
+ Internal::CameraActor* actorImpl(nullptr);
+ if(cameraActor)
{
- actorImpl = &GetImplementation( cameraActor );
+ actorImpl = &GetImplementation(cameraActor);
}
- GetImplementation(*this).SetCameraActor( actorImpl );
+ GetImplementation(*this).SetCameraActor(actorImpl);
}
CameraActor RenderTask::GetCameraActor() const
return Dali::CameraActor(GetImplementation(*this).GetCameraActor());
}
-void RenderTask::SetFrameBuffer( FrameBuffer frameBuffer )
+void RenderTask::SetFrameBuffer(FrameBuffer frameBuffer)
{
- Internal::FrameBuffer* frameBufferPtr( nullptr );
- if( frameBuffer )
+ Internal::FrameBuffer* frameBufferPtr(nullptr);
+ if(frameBuffer)
{
- frameBufferPtr = &GetImplementation( frameBuffer );
+ frameBufferPtr = &GetImplementation(frameBuffer);
}
- GetImplementation(*this).SetFrameBuffer( frameBufferPtr );
+ GetImplementation(*this).SetFrameBuffer(frameBufferPtr);
}
FrameBuffer RenderTask::GetFrameBuffer() const
{
- Internal::FrameBuffer* frameBufferPtr( GetImplementation(*this).GetFrameBuffer() );
- return FrameBuffer( frameBufferPtr );
+ Internal::FrameBuffer* frameBufferPtr(GetImplementation(*this).GetFrameBuffer());
+ return FrameBuffer(frameBufferPtr);
}
-void RenderTask::SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction )
+void RenderTask::SetScreenToFrameBufferFunction(ScreenToFrameBufferFunction conversionFunction)
{
- GetImplementation(*this).SetScreenToFrameBufferFunction( conversionFunction );
+ GetImplementation(*this).SetScreenToFrameBufferFunction(conversionFunction);
}
RenderTask::ScreenToFrameBufferFunction RenderTask::GetScreenToFrameBufferFunction() const
return GetImplementation(*this).GetScreenToFrameBufferFunction();
}
-void RenderTask::SetScreenToFrameBufferMappingActor( Dali::Actor mappingActor )
+void RenderTask::SetScreenToFrameBufferMappingActor(Dali::Actor mappingActor)
{
- GetImplementation(*this).SetScreenToFrameBufferMappingActor( mappingActor );
+ GetImplementation(*this).SetScreenToFrameBufferMappingActor(mappingActor);
}
Dali::Actor RenderTask::GetScreenToFrameBufferMappingActor() const
return GetImplementation(*this).GetScreenToFrameBufferMappingActor();
}
-void RenderTask::SetViewportPosition( Vector2 position )
+void RenderTask::SetViewportPosition(Vector2 position)
{
- GetImplementation(*this).SetViewportPosition( position );
+ GetImplementation(*this).SetViewportPosition(position);
}
Vector2 RenderTask::GetCurrentViewportPosition() const
return GetImplementation(*this).GetCurrentViewportPosition();
}
-void RenderTask::SetViewportSize( Vector2 size )
+void RenderTask::SetViewportSize(Vector2 size)
{
- GetImplementation(*this).SetViewportSize( size );
+ GetImplementation(*this).SetViewportSize(size);
}
Vector2 RenderTask::GetCurrentViewportSize() const
return GetImplementation(*this).GetCurrentViewportSize();
}
-void RenderTask::SetViewport( Viewport viewport )
+void RenderTask::SetViewport(Viewport viewport)
{
- GetImplementation(*this).SetViewport( viewport );
+ GetImplementation(*this).SetViewport(viewport);
}
Viewport RenderTask::GetViewport() const
{
Viewport result;
- GetImplementation(*this).GetViewport( result );
+ GetImplementation(*this).GetViewport(result);
return result;
}
-void RenderTask::SetClearColor( const Vector4& color )
+void RenderTask::SetClearColor(const Vector4& color)
{
- GetImplementation(*this).SetClearColor( color );
+ GetImplementation(*this).SetClearColor(color);
}
Vector4 RenderTask::GetClearColor() const
return GetImplementation(*this).GetClearColor();
}
-void RenderTask::SetClearEnabled( bool enabled )
+void RenderTask::SetClearEnabled(bool enabled)
{
- GetImplementation(*this).SetClearEnabled( enabled );
+ GetImplementation(*this).SetClearEnabled(enabled);
}
bool RenderTask::GetClearEnabled() const
return GetImplementation(*this).GetClearEnabled();
}
-void RenderTask::SetCullMode( bool mode )
+void RenderTask::SetCullMode(bool mode)
{
- GetImplementation(*this).SetCullMode( mode );
+ GetImplementation(*this).SetCullMode(mode);
}
bool RenderTask::GetCullMode() const
return GetImplementation(*this).GetCullMode();
}
-void RenderTask::SetRefreshRate( uint32_t refreshRate )
+void RenderTask::SetRefreshRate(uint32_t refreshRate)
{
- GetImplementation(*this).SetRefreshRate( refreshRate );
+ GetImplementation(*this).SetRefreshRate(refreshRate);
}
uint32_t RenderTask::GetRefreshRate() const
return GetImplementation(*this).FinishedSignal();
}
-void RenderTask::SetInputEnabled( bool enabled )
+void RenderTask::SetInputEnabled(bool enabled)
{
- GetImplementation(*this).SetInputEnabled( enabled );
+ GetImplementation(*this).SetInputEnabled(enabled);
}
bool RenderTask::GetInputEnabled() const
return GetImplementation(*this).GetInputEnabled();
}
-bool RenderTask::WorldToViewport(const Vector3 &position, float& viewportX, float& viewportY) const
+bool RenderTask::WorldToViewport(const Vector3& position, float& viewportX, float& viewportY) const
{
return GetImplementation(*this).WorldToViewport(position, viewportX, viewportY);
}
-bool RenderTask::ViewportToLocal(Actor actor, float viewportX, float viewportY, float &localX, float &localY) const
+bool RenderTask::ViewportToLocal(Actor actor, float viewportX, float viewportY, float& localX, float& localY) const
{
- if( actor )
+ if(actor)
{
- Internal::Actor* actorImpl( &GetImplementation( actor ) );
- return GetImplementation(*this).ViewportToLocal( actorImpl, viewportX, viewportY, localX, localY );
+ Internal::Actor* actorImpl(&GetImplementation(actor));
+ return GetImplementation(*this).ViewportToLocal(actorImpl, viewportX, viewportY, localX, localY);
}
else
{
}
}
-
-RenderTask::RenderTask( Internal::RenderTask* internal )
+RenderTask::RenderTask(Internal::RenderTask* internal)
: Handle(internal)
{
}
class DALI_CORE_API RenderTask : public Handle
{
public:
-
/**
* @brief Enumeration for instances of properties belonging to the RenderTask class.
* @SINCE_1_0.0
* @brief Typedef for signals sent by this class.
* @SINCE_1_0.0
*/
- using RenderTaskSignalType = Signal<void( RenderTask& )>;
+ using RenderTaskSignalType = Signal<void(RenderTask&)>;
/**
* @brief A pointer to a function for converting screen to frame-buffer coordinates.
* @param[in,out] coordinates The screen coordinates to convert where (0,0) is the top-left of the screen
* @return True if the conversion was successful, otherwise coordinates should be unmodified
*/
- using ScreenToFrameBufferFunction = bool ( * )( Vector2& );
+ using ScreenToFrameBufferFunction = bool (*)(Vector2&);
/**
* @brief A pointer to a function for converting screen to frame-buffer coordinates.
* @param[in,out] coordinates The screen coordinates to convert where (0,0) is the top-left of the screen
* @return True if the conversion was successful, otherwise coordinates should be unmodified
*/
- using ConstScreenToFrameBufferFunction = bool ( *const )( Vector2& );
+ using ConstScreenToFrameBufferFunction = bool (*const)(Vector2&);
/**
* @brief The default conversion function returns false for any screen coordinates.
* @param[in] handle A handle to an object
* @return A handle to a RenderTask or an uninitialized handle
*/
- static RenderTask DownCast( BaseHandle handle );
+ static RenderTask DownCast(BaseHandle handle);
/**
* @brief Destructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- RenderTask( RenderTask&& rhs );
+ RenderTask(RenderTask&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- RenderTask& operator=( RenderTask&& rhs );
+ RenderTask& operator=(RenderTask&& rhs);
/**
* @brief Sets the actors to be rendered.
* @param[in] actor This actor and its children will be rendered.
* If actor is an empty handle, then nothing will be rendered
*/
- void SetSourceActor( Actor actor );
+ void SetSourceActor(Actor actor);
/**
* @brief Retrieves the actors to be rendered.
* @SINCE_1_0.0
* @param[in] exclusive True if the source actors will only be rendered by this render-task
*/
- void SetExclusive( bool exclusive );
+ void SetExclusive(bool exclusive);
/**
* @brief Queries whether the RenderTask has exclusive access to the source actors.
* @SINCE_1_0.0
* @param[in] enabled True if the render-task should be considered for input handling
*/
- void SetInputEnabled( bool enabled );
+ void SetInputEnabled(bool enabled);
/**
* @brief Queries whether the render-task should be considered for input handling.
* @SINCE_1_0.0
* @param[in] cameraActor The scene is viewed from the perspective of this actor
*/
- void SetCameraActor( CameraActor cameraActor );
+ void SetCameraActor(CameraActor cameraActor);
/**
* @brief Retrieves the actor from which the scene is viewed.
* @SINCE_1_1.38
* @param[in] frameBuffer A valid FrameBuffer handle to enable off-screen rendering, or an uninitialized handle to disable it
*/
- void SetFrameBuffer( FrameBuffer frameBuffer );
+ void SetFrameBuffer(FrameBuffer frameBuffer);
/**
* @brief Retrieves the frame-buffer used as a render target.
* @SINCE_1_0.0
* @param[in] conversionFunction The conversion function
*/
- void SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction );
+ void SetScreenToFrameBufferFunction(ScreenToFrameBufferFunction conversionFunction);
/**
* @brief Retrieves the function used to convert screen coordinates to frame-buffer coordinates.
* @param[in] mappingActor The actor used for conversion
* @note The mapping actor needs to be rendered by the default render task to make the mapping work properly.
*/
- void SetScreenToFrameBufferMappingActor( Actor mappingActor );
+ void SetScreenToFrameBufferMappingActor(Actor mappingActor);
/**
* @brief Retrieves the actor used to convert screen coordinates to frame-buffer coordinates.
* @param[in] position The viewports position (x,y)
* @note Unlike the glViewport method, the x & y coordinates refer to the top-left of the viewport rectangle.
*/
- void SetViewportPosition( Vector2 position );
+ void SetViewportPosition(Vector2 position);
/**
* @brief Retrieves the GL viewport position used when rendering.
* @SINCE_1_0.0
* @param[in] size The viewports size (width,height)
*/
- void SetViewportSize( Vector2 size );
+ void SetViewportSize(Vector2 size);
/**
* @brief Retrieves the GL viewport size used when rendering.
* @param[in] viewport The new viewport
* @note Unlike the glViewport method, the x & y coordinates refer to the top-left of the viewport rectangle.
*/
- void SetViewport( Viewport viewport );
+ void SetViewport(Viewport viewport);
/**
* @brief Retrieves the GL viewport used when rendering.
* @SINCE_1_0.0
* @param[in] color The new clear color
*/
- void SetClearColor( const Vector4& color );
+ void SetClearColor(const Vector4& color);
/**
* @brief Retrieves the clear color used when SetClearEnabled(true) is used.
* be (partially) cleared before rendering the second.
*
*/
- void SetClearEnabled( bool enabled );
+ void SetClearEnabled(bool enabled);
/**
* @brief Queries whether the render-task will clear the results of previous render-tasks.
* @note If the shader uses @ref Shader::Hint::MODIFIES_GEOMETRY then culling optimizations are disabled.
* @see Shader::Hint
*/
- void SetCullMode( bool cullMode );
+ void SetCullMode(bool cullMode);
/**
* @brief Gets the cull mode.
* @SINCE_1_0.0
* @param[in] refreshRate The new refresh rate
*/
- void SetRefreshRate( uint32_t refreshRate );
+ void SetRefreshRate(uint32_t refreshRate);
/**
* @brief Queries the refresh-rate of the RenderTask.
* @param[out] viewportY The viewport y position
* @return true if the position has a screen coordinate
*/
- bool WorldToViewport(const Vector3 &position, float& viewportX, float& viewportY) const;
+ bool WorldToViewport(const Vector3& position, float& viewportX, float& viewportY) const;
/**
* @brief Gets actor local coordinates for given viewport coordinates.
* @param[out] localY The local y position
* @return true if the screen position has a local coordinate
*/
- bool ViewportToLocal(Actor actor, float viewportX, float viewportY, float &localX, float &localY) const;
+ bool ViewportToLocal(Actor actor, float viewportX, float viewportY, float& localX, float& localY) const;
public: // Signals
-
/**
* @brief If the refresh rate is REFRESH_ONCE, connect to this signal to be notified when a RenderTask has finished.
* @SINCE_1_0.0
RenderTaskSignalType& FinishedSignal();
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Dali New() methods.
* @SINCE_1_0.0
* @param[in] renderTask A pointer to a newly allocated render-task
*/
- explicit DALI_INTERNAL RenderTask( Internal::RenderTask* renderTask );
+ explicit DALI_INTERNAL RenderTask(Internal::RenderTask* renderTask);
/// @endcond
};
#include <type_traits>
// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h> // DALI_LOG_WARNING_NOFN
+#include <dali/integration-api/debug.h> // DALI_LOG_WARNING_NOFN
#include <dali/internal/event/rendering/frame-buffer-impl.h> // Dali::Internal::FrameBuffer
-#include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
+#include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
namespace Dali
{
-
namespace
{
/// Bool operator for FrameBuffer::Attachment::Mask.
/// in cpp as only used in this file
-bool operator&( FrameBuffer::Attachment::Mask lhs, FrameBuffer::Attachment::Mask rhs )
+bool operator&(FrameBuffer::Attachment::Mask lhs, FrameBuffer::Attachment::Mask rhs)
{
- using UnderlyingType = typename std::underlying_type< FrameBuffer::Attachment::Mask >::type;
- return static_cast<bool>( static_cast<UnderlyingType>( lhs ) & static_cast<UnderlyingType>( rhs ) );
+ using UnderlyingType = typename std::underlying_type<FrameBuffer::Attachment::Mask>::type;
+ return static_cast<bool>(static_cast<UnderlyingType>(lhs) & static_cast<UnderlyingType>(rhs));
}
} // unnamed namespace
-FrameBuffer FrameBuffer::New( uint32_t width, uint32_t height )
+FrameBuffer FrameBuffer::New(uint32_t width, uint32_t height)
{
- return New( width, height, FrameBuffer::Attachment::COLOR );
+ return New(width, height, FrameBuffer::Attachment::COLOR);
}
-FrameBuffer FrameBuffer::New( uint32_t width, uint32_t height, Attachment::Mask attachments )
+FrameBuffer FrameBuffer::New(uint32_t width, uint32_t height, Attachment::Mask attachments)
{
- Internal::FrameBufferPtr frameBuffer = Internal::FrameBuffer::New( width, height, attachments );
- if( attachments & FrameBuffer::Attachment::COLOR )
+ Internal::FrameBufferPtr frameBuffer = Internal::FrameBuffer::New(width, height, attachments);
+ if(attachments & FrameBuffer::Attachment::COLOR)
{
- Internal::TexturePtr texture = Internal::Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGB888, width, height );
- frameBuffer->AttachColorTexture( texture, 0u, 0u );
+ Internal::TexturePtr texture = Internal::Texture::New(Dali::TextureType::TEXTURE_2D, Pixel::RGB888, width, height);
+ frameBuffer->AttachColorTexture(texture, 0u, 0u);
}
- return FrameBuffer( frameBuffer.Get() );
+ return FrameBuffer(frameBuffer.Get());
}
FrameBuffer::FrameBuffer()
{
}
-FrameBuffer::FrameBuffer( const FrameBuffer& handle ) = default;
+FrameBuffer::FrameBuffer(const FrameBuffer& handle) = default;
-FrameBuffer FrameBuffer::DownCast( BaseHandle handle )
+FrameBuffer FrameBuffer::DownCast(BaseHandle handle)
{
- return FrameBuffer( dynamic_cast<Dali::Internal::FrameBuffer*>(handle.GetObjectPtr()));
+ return FrameBuffer(dynamic_cast<Dali::Internal::FrameBuffer*>(handle.GetObjectPtr()));
}
-FrameBuffer& FrameBuffer::operator=( const FrameBuffer& handle ) = default;
+FrameBuffer& FrameBuffer::operator=(const FrameBuffer& handle) = default;
-FrameBuffer::FrameBuffer( Internal::FrameBuffer* pointer )
-: BaseHandle( pointer )
+FrameBuffer::FrameBuffer(Internal::FrameBuffer* pointer)
+: BaseHandle(pointer)
{
}
-FrameBuffer::FrameBuffer( FrameBuffer&& rhs ) = default;
+FrameBuffer::FrameBuffer(FrameBuffer&& rhs) = default;
-FrameBuffer& FrameBuffer::operator=( FrameBuffer&& rhs ) = default;
+FrameBuffer& FrameBuffer::operator=(FrameBuffer&& rhs) = default;
-void FrameBuffer::AttachColorTexture( Texture& texture )
+void FrameBuffer::AttachColorTexture(Texture& texture)
{
- AttachColorTexture( texture, 0u, 0u );
+ AttachColorTexture(texture, 0u, 0u);
}
-void FrameBuffer::AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer )
+void FrameBuffer::AttachColorTexture(Texture& texture, uint32_t mipmapLevel, uint32_t layer)
{
- if( texture )
+ if(texture)
{
- Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
- GetImplementation(*this).AttachColorTexture( texturePtr, mipmapLevel, layer );
+ Internal::TexturePtr texturePtr(&GetImplementation(texture));
+ GetImplementation(*this).AttachColorTexture(texturePtr, mipmapLevel, layer);
}
}
Texture FrameBuffer::GetColorTexture()
{
Internal::Texture* texturePtr = GetImplementation(*this).GetColorTexture(0);
- return Dali::Texture( texturePtr );
+ return Dali::Texture(texturePtr);
}
} //namespace Dali
class DALI_CORE_API FrameBuffer : public BaseHandle
{
public:
-
/**
* @brief The initial attachments to create the FrameBuffer with.
* @note The color attachment can also be created on calling AttachColorTexture().
*/
enum Mask
{
- NONE = 0, ///< No attachments are created initially. @SINCE_1_1.45
- DEPTH = 1 << 0, ///< Depth buffer is created. @SINCE_1_1.45
- STENCIL = 1 << 1, ///< Stencil buffer is created. @SINCE_1_1.45
- DEPTH_STENCIL = DEPTH | STENCIL, ///< Depth and stencil buffer are created. @SINCE_1_1.45
- COLOR = 1 << 2, ///< Color texture is created. @SINCE_1_4.0
- COLOR_DEPTH = COLOR | DEPTH, ///< Color texture and depth buffer are created. @SINCE_1_4.0
- COLOR_STENCIL = COLOR | STENCIL, ///< Color texture and stencil buffer are created. @SINCE_1_4.0
+ NONE = 0, ///< No attachments are created initially. @SINCE_1_1.45
+ DEPTH = 1 << 0, ///< Depth buffer is created. @SINCE_1_1.45
+ STENCIL = 1 << 1, ///< Stencil buffer is created. @SINCE_1_1.45
+ DEPTH_STENCIL = DEPTH | STENCIL, ///< Depth and stencil buffer are created. @SINCE_1_1.45
+ COLOR = 1 << 2, ///< Color texture is created. @SINCE_1_4.0
+ COLOR_DEPTH = COLOR | DEPTH, ///< Color texture and depth buffer are created. @SINCE_1_4.0
+ COLOR_STENCIL = COLOR | STENCIL, ///< Color texture and stencil buffer are created. @SINCE_1_4.0
COLOR_DEPTH_STENCIL = COLOR_DEPTH | STENCIL ///< Color, depth and stencil buffer are created. @SINCE_1_4.0
};
};
* @param[in] height The height of the FrameBuffer and the color texture
* @return A handle to a newly allocated FrameBuffer
*/
- static FrameBuffer New( uint32_t width, uint32_t height );
+ static FrameBuffer New(uint32_t width, uint32_t height);
/**
* @brief Creates a new FrameBuffer with specific attachments.
* @param[in] attachments Enumeration of the attachments to create
* @return A handle to a newly allocated FrameBuffer
*/
- static FrameBuffer New( uint32_t width, uint32_t height, Attachment::Mask attachments );
+ static FrameBuffer New(uint32_t width, uint32_t height, Attachment::Mask attachments);
/**
* @brief Default constructor, creates an empty handle.
* @SINCE_1_1.43
* @param[in] handle Handle to an object
*/
- FrameBuffer( const FrameBuffer& handle );
+ FrameBuffer(const FrameBuffer& handle);
/**
* @brief Downcasts to a FrameBuffer.
* @param[in] handle Handle to an object
* @return FrameBuffer handle or an uninitialized handle
*/
- static FrameBuffer DownCast( BaseHandle handle );
+ static FrameBuffer DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- FrameBuffer& operator=( const FrameBuffer& handle );
+ FrameBuffer& operator=(const FrameBuffer& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- FrameBuffer( FrameBuffer&& rhs );
+ FrameBuffer(FrameBuffer&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- FrameBuffer& operator=( FrameBuffer&& rhs );
+ FrameBuffer& operator=(FrameBuffer&& rhs);
/**
* @brief Attach the base LOD of a 2D texture to the framebuffer for color rendering.
* @note The texture has to have same size as that of FrameBuffer
* otherwise it won't be attached.
*/
- void AttachColorTexture( Texture& texture );
+ void AttachColorTexture(Texture& texture);
/**
* @brief Attach a texture to the framebuffer for color rendering.
* @note The mipmapped texture has to have same size as that of FrameBuffer
* otherwise it won't be attached.
*/
- void AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer );
+ void AttachColorTexture(Texture& texture, uint32_t mipmapLevel, uint32_t layer);
/**
* @brief Gets the first color texture used as output in the FrameBuffer.
Texture GetColorTexture();
public:
-
/**
* @brief The constructor.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] pointer A pointer to a newly allocated FrameBuffer
*/
- explicit DALI_INTERNAL FrameBuffer( Internal::FrameBuffer* pointer );
+ explicit DALI_INTERNAL FrameBuffer(Internal::FrameBuffer* pointer);
};
/**
*/
// CLASS HEADER
-#include <dali/public-api/rendering/geometry.h> // Dali::Geometry
+#include <dali/public-api/rendering/geometry.h> // Dali::Geometry
// INTERNAL INCLUDES
#include <dali/internal/event/rendering/geometry-impl.h> // Dali::Internal::Geometry
namespace Dali
{
-
Geometry Geometry::New()
{
Internal::GeometryPtr geometry = Internal::Geometry::New();
- return Geometry( geometry.Get() );
+ return Geometry(geometry.Get());
}
Geometry::Geometry()
{
}
-Geometry::Geometry( const Geometry& handle ) = default;
+Geometry::Geometry(const Geometry& handle) = default;
-Geometry Geometry::DownCast( BaseHandle handle )
+Geometry Geometry::DownCast(BaseHandle handle)
{
- return Geometry( dynamic_cast<Dali::Internal::Geometry*>(handle.GetObjectPtr()));
+ return Geometry(dynamic_cast<Dali::Internal::Geometry*>(handle.GetObjectPtr()));
}
-Geometry& Geometry::operator=( const Geometry& handle ) = default;
+Geometry& Geometry::operator=(const Geometry& handle) = default;
-Geometry::Geometry( Geometry&& rhs ) = default;
+Geometry::Geometry(Geometry&& rhs) = default;
-Geometry& Geometry::operator=( Geometry&& rhs ) = default;
+Geometry& Geometry::operator=(Geometry&& rhs) = default;
-std::size_t Geometry::AddVertexBuffer( VertexBuffer& vertexBuffer )
+std::size_t Geometry::AddVertexBuffer(VertexBuffer& vertexBuffer)
{
- DALI_ASSERT_ALWAYS( vertexBuffer && "VertexBuffer is not initialized ");
- return GetImplementation(*this).AddVertexBuffer( GetImplementation( vertexBuffer ) );
+ DALI_ASSERT_ALWAYS(vertexBuffer && "VertexBuffer is not initialized ");
+ return GetImplementation(*this).AddVertexBuffer(GetImplementation(vertexBuffer));
}
std::size_t Geometry::GetNumberOfVertexBuffers() const
return GetImplementation(*this).GetNumberOfVertexBuffers();
}
-void Geometry::RemoveVertexBuffer( std::size_t index )
+void Geometry::RemoveVertexBuffer(std::size_t index)
{
- GetImplementation(*this).RemoveVertexBuffer( static_cast<uint32_t>( index ) );
+ GetImplementation(*this).RemoveVertexBuffer(static_cast<uint32_t>(index));
}
-void Geometry::SetIndexBuffer( const uint16_t* indices, size_t count )
+void Geometry::SetIndexBuffer(const uint16_t* indices, size_t count)
{
- GetImplementation(*this).SetIndexBuffer( indices, static_cast<uint32_t>( count ) );
+ GetImplementation(*this).SetIndexBuffer(indices, static_cast<uint32_t>(count));
}
-void Geometry::SetType( Type geometryType )
+void Geometry::SetType(Type geometryType)
{
- GetImplementation(*this).SetType( geometryType );
+ GetImplementation(*this).SetType(geometryType);
}
Geometry::Type Geometry::GetType() const
return GetImplementation(*this).GetType();
}
-Geometry::Geometry( Internal::Geometry* pointer )
-: BaseHandle( pointer )
+Geometry::Geometry(Internal::Geometry* pointer)
+: BaseHandle(pointer)
{
}
#include <cstdint> // uint16_t
// INTERNAL INCLUDES
-#include <dali/public-api/object/handle.h> // Dali::Handle
+#include <dali/public-api/object/handle.h> // Dali::Handle
#include <dali/public-api/object/property-index-ranges.h> // DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX
-#include <dali/public-api/rendering/vertex-buffer.h> // Dali::VertexBuffer
+#include <dali/public-api/rendering/vertex-buffer.h> // Dali::VertexBuffer
namespace Dali
{
class DALI_CORE_API Geometry : public BaseHandle
{
public:
-
/**
* @brief Enumeration for the description of the type of geometry, used to determine how the coordinates will be used.
* @SINCE_1_1.45
TRIANGLE_STRIP ///< A strip of triangles (after the first triangle, following triangles need only 1 point) @SINCE_1_1.45
};
-
/**
* @brief Creates a new Geometry object.
*
* @SINCE_1_1.43
* @param[in] handle Handle to an object
*/
- Geometry( const Geometry& handle );
+ Geometry(const Geometry& handle);
/**
* @brief Downcasts to a geometry.
* @param[in] handle Handle to an object
* @return Geometry handle or an uninitialized handle
*/
- static Geometry DownCast( BaseHandle handle );
+ static Geometry DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- Geometry& operator=( const Geometry& handle );
+ Geometry& operator=(const Geometry& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Geometry( Geometry&& rhs );
+ Geometry(Geometry&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- Geometry& operator=( Geometry&& rhs );
+ Geometry& operator=(Geometry&& rhs);
/**
* @brief Adds a VertexBuffer to be used as source of geometry vertices.
* @return Index of the newly added buffer, can be used with RemoveVertexBuffer to remove
* this buffer if no longer required
*/
- std::size_t AddVertexBuffer( VertexBuffer& vertexBuffer );
+ std::size_t AddVertexBuffer(VertexBuffer& vertexBuffer);
/**
* @brief Retrieves the number of vertex buffers that have been added to this geometry.
* @SINCE_1_9.27
* @param[in] index Index to the vertex buffer to remove
*/
- void RemoveVertexBuffer( std::size_t index );
+ void RemoveVertexBuffer(std::size_t index);
/**
* @brief Sets a the index data to be used as a source of indices for the geometry
* @param[in] indices Array of indices
* @param[in] count Number of indices in the array
*/
- void SetIndexBuffer( const uint16_t* indices, size_t count );
+ void SetIndexBuffer(const uint16_t* indices, size_t count);
/**
* @brief Sets the type of primitives this geometry contains.
* @SINCE_1_1.43
* @param[in] geometryType Type of primitives this geometry contains
*/
- void SetType( Type geometryType );
+ void SetType(Type geometryType);
/**
* @brief Gets the type of primitives this geometry contains.
Type GetType() const;
public:
-
/**
* @brief The constructor.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] pointer A pointer to a newly allocated Geometry
*/
- explicit DALI_INTERNAL Geometry( Internal::Geometry* pointer );
+ explicit DALI_INTERNAL Geometry(Internal::Geometry* pointer);
};
/**
*/
// CLASS HEADER
-#include <dali/public-api/rendering/renderer.h> // Dali::Renderer
+#include <dali/public-api/rendering/renderer.h> // Dali::Renderer
// INTERNAL INCLUDES
#include <dali/internal/event/rendering/renderer-impl.h> // Dali::Internal::Renderer
namespace Dali
{
-
-Renderer Renderer::New( Geometry& geometry, Shader& shader )
+Renderer Renderer::New(Geometry& geometry, Shader& shader)
{
- Internal::RendererPtr renderer = Internal::Renderer::New( );
- renderer->SetGeometry( GetImplementation(geometry) );
- renderer->SetShader( GetImplementation(shader) );
- return Renderer( renderer.Get() );
+ Internal::RendererPtr renderer = Internal::Renderer::New();
+ renderer->SetGeometry(GetImplementation(geometry));
+ renderer->SetShader(GetImplementation(shader));
+ return Renderer(renderer.Get());
}
Renderer::Renderer()
{
}
-Renderer::Renderer( const Renderer& handle ) = default;
+Renderer::Renderer(const Renderer& handle) = default;
-Renderer Renderer::DownCast( BaseHandle handle )
+Renderer Renderer::DownCast(BaseHandle handle)
{
- return Renderer( dynamic_cast<Dali::Internal::Renderer*>(handle.GetObjectPtr()));
+ return Renderer(dynamic_cast<Dali::Internal::Renderer*>(handle.GetObjectPtr()));
}
-Renderer& Renderer::operator=( const Renderer& handle ) = default;
+Renderer& Renderer::operator=(const Renderer& handle) = default;
-Renderer::Renderer( Renderer&& rhs ) = default;
+Renderer::Renderer(Renderer&& rhs) = default;
-Renderer& Renderer::operator=( Renderer&& rhs ) = default;
+Renderer& Renderer::operator=(Renderer&& rhs) = default;
-void Renderer::SetGeometry( Geometry& geometry )
+void Renderer::SetGeometry(Geometry& geometry)
{
- DALI_ASSERT_ALWAYS( geometry && "Geometry handle not initialized" );
- GetImplementation(*this).SetGeometry( GetImplementation(geometry) );
+ DALI_ASSERT_ALWAYS(geometry && "Geometry handle not initialized");
+ GetImplementation(*this).SetGeometry(GetImplementation(geometry));
}
Geometry Renderer::GetGeometry() const
{
- return Dali::Geometry( GetImplementation(*this).GetGeometry().Get() );
+ return Dali::Geometry(GetImplementation(*this).GetGeometry().Get());
}
-void Renderer::SetTextures( TextureSet& textureSet )
+void Renderer::SetTextures(TextureSet& textureSet)
{
- DALI_ASSERT_ALWAYS( textureSet && "TextureSet handle not initialized" );
- GetImplementation(*this).SetTextures( GetImplementation(textureSet) );
+ DALI_ASSERT_ALWAYS(textureSet && "TextureSet handle not initialized");
+ GetImplementation(*this).SetTextures(GetImplementation(textureSet));
}
TextureSet Renderer::GetTextures() const
{
- return Dali::TextureSet( GetImplementation(*this).GetTextures().Get() );
+ return Dali::TextureSet(GetImplementation(*this).GetTextures().Get());
}
-void Renderer::SetShader( Shader& shader )
+void Renderer::SetShader(Shader& shader)
{
- DALI_ASSERT_ALWAYS( shader && "Shader handle not initialized" );
- GetImplementation(*this).SetShader( GetImplementation(shader) );
+ DALI_ASSERT_ALWAYS(shader && "Shader handle not initialized");
+ GetImplementation(*this).SetShader(GetImplementation(shader));
}
Shader Renderer::GetShader() const
{
- return Dali::Shader( GetImplementation(*this).GetShader().Get() );
+ return Dali::Shader(GetImplementation(*this).GetShader().Get());
}
-Renderer::Renderer( Internal::Renderer* pointer )
-: Handle( pointer )
+Renderer::Renderer(Internal::Renderer* pointer)
+: Handle(pointer)
{
}
namespace FaceCullingMode
{
-
/**
* @brief Enumeration for face culling mode.
* @SINCE_1_1.43
*/
enum Type
{
- NONE, ///< None of the faces should be culled @SINCE_1_1.43
- FRONT, ///< Cull front face, front faces should never be shown @SINCE_1_1.43
- BACK, ///< Cull back face, back faces should never be shown @SINCE_1_1.43
- FRONT_AND_BACK, ///< Cull front and back faces; if the geometry is composed of triangles none of the faces will be shown @SINCE_1_1.43
+ NONE, ///< None of the faces should be culled @SINCE_1_1.43
+ FRONT, ///< Cull front face, front faces should never be shown @SINCE_1_1.43
+ BACK, ///< Cull back face, back faces should never be shown @SINCE_1_1.43
+ FRONT_AND_BACK, ///< Cull front and back faces; if the geometry is composed of triangles none of the faces will be shown @SINCE_1_1.43
};
} // namespace FaceCullingMode
namespace BlendMode
{
-
/**
* @brief Enumeration for blend mode.
* @SINCE_1_1.43
namespace BlendEquation
{
-
/**
* @brief Enumeration for blend equation.
* @SINCE_1_1.43
*/
enum Type
{
- ADD = 0x8006, ///< The source and destination colors are added to each other. @SINCE_1_1.43
- SUBTRACT = 0x800A, ///< Subtracts the destination from the source. @SINCE_1_1.43
- REVERSE_SUBTRACT = 0x800B ///< Subtracts the source from the destination. @SINCE_1_1.43
+ ADD = 0x8006, ///< The source and destination colors are added to each other. @SINCE_1_1.43
+ SUBTRACT = 0x800A, ///< Subtracts the destination from the source. @SINCE_1_1.43
+ REVERSE_SUBTRACT = 0x800B ///< Subtracts the source from the destination. @SINCE_1_1.43
};
} // namespace BlendEquation
namespace BlendFactor
{
-
/**
* @brief Enumeration for blend factor.
* @SINCE_1_1.43
namespace DepthWriteMode
{
-
/**
* @brief Enumeration for depth buffer write modes.
* @SINCE_1_1.43
namespace DepthTestMode
{
-
/**
* @brief Enumeration for depth buffer test (read) modes.
* @SINCE_1_1.43
namespace DepthFunction
{
-
/**
* @brief Enumeration for depth functions.
* @SINCE_1_1.43
namespace RenderMode
{
-
/**
* @brief Enumeration for the controls of how this renderer uses its stencil properties and writes to the color buffer.
* @SINCE_1_2_5
namespace StencilFunction
{
-
/**
* @brief Enumeration for the comparison function used on the stencil buffer.
* @SINCE_1_1.43
namespace StencilOperation
{
-
/**
* @brief Enumeration for specifying the action to take when the stencil (or depth) test fails during stencil test.
* @SINCE_1_1.43
} // namespace StencilOperation
-
/**
* @brief Renderer is a handle to an object used to show content by combining a Geometry, a TextureSet and a shader.
*
class DALI_CORE_API Renderer : public Handle
{
public:
-
/**
* @brief Enumeration for instances of properties belonging to the Renderer class.
* @SINCE_1_1.43
* @param[in] shader Shader to be used by this renderer
* @return A handle to the Renderer
*/
- static Renderer New( Geometry& geometry, Shader& shader );
+ static Renderer New(Geometry& geometry, Shader& shader);
/**
* @brief Default constructor, creates an empty handle
* @SINCE_1_1.43
* @param[in] handle Handle to an object
*/
- Renderer( const Renderer& handle );
+ Renderer(const Renderer& handle);
/**
* @brief Downcasts to a renderer handle.
* @param[in] handle Handle to an object
* @return Renderer handle or an uninitialized handle
*/
- static Renderer DownCast( BaseHandle handle );
+ static Renderer DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- Renderer& operator=( const Renderer& handle );
+ Renderer& operator=(const Renderer& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Renderer( Renderer&& rhs );
+ Renderer(Renderer&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- Renderer& operator=( Renderer&& rhs );
+ Renderer& operator=(Renderer&& rhs);
/**
* @brief Sets the geometry to be used by this renderer.
* @SINCE_1_1.43
* @param[in] geometry The geometry to be used by this renderer
*/
- void SetGeometry( Geometry& geometry );
+ void SetGeometry(Geometry& geometry);
/**
* @brief Gets the geometry used by this renderer.
* @param[in] firstElement The First element to draw
* @param[in] elementsCount The number of elements to draw
*/
- inline void SetIndexRange( int firstElement, int elementsCount )
+ inline void SetIndexRange(int firstElement, int elementsCount)
{
- SetProperty( Property::INDEX_RANGE_FIRST, firstElement );
- SetProperty( Property::INDEX_RANGE_COUNT, elementsCount );
+ SetProperty(Property::INDEX_RANGE_FIRST, firstElement);
+ SetProperty(Property::INDEX_RANGE_COUNT, elementsCount);
}
/**
* @SINCE_1_1.43
* @param[in] textureSet The texture set to be used by this renderer
*/
- void SetTextures( TextureSet& textureSet );
+ void SetTextures(TextureSet& textureSet);
/**
* @brief Gets the texture set used by this renderer.
* @SINCE_1_1.43
* @param[in] shader The shader to be used by this renderer
*/
- void SetShader( Shader& shader );
+ void SetShader(Shader& shader);
/**
* @brief Gets the shader used by this renderer.
Shader GetShader() const;
public:
-
/**
* @brief The constructor.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] pointer A pointer to a newly allocated Renderer
*/
- explicit DALI_INTERNAL Renderer( Internal::Renderer* pointer );
+ explicit DALI_INTERNAL Renderer(Internal::Renderer* pointer);
};
/**
*/
// CLASS HEADER
-#include <dali/public-api/rendering/sampler.h> // Dali::Sampler
+#include <dali/public-api/rendering/sampler.h> // Dali::Sampler
// INTERNAL INCLUDES
#include <dali/internal/event/rendering/sampler-impl.h> // Dali::Internal::Sampler
namespace Dali
{
-
Sampler Sampler::New()
{
Internal::SamplerPtr sampler = Internal::Sampler::New();
- return Sampler( sampler.Get() );
+ return Sampler(sampler.Get());
}
Sampler::Sampler()
{
}
-Sampler::Sampler( const Sampler& handle ) = default;
+Sampler::Sampler(const Sampler& handle) = default;
-Sampler Sampler::DownCast( BaseHandle handle )
+Sampler Sampler::DownCast(BaseHandle handle)
{
- return Sampler( dynamic_cast<Dali::Internal::Sampler*>(handle.GetObjectPtr()));
+ return Sampler(dynamic_cast<Dali::Internal::Sampler*>(handle.GetObjectPtr()));
}
-Sampler& Sampler::operator=( const Sampler& handle ) = default;
+Sampler& Sampler::operator=(const Sampler& handle) = default;
-Sampler::Sampler( Sampler&& rhs ) = default;
+Sampler::Sampler(Sampler&& rhs) = default;
-Sampler& Sampler::operator=( Sampler&& rhs ) = default;
+Sampler& Sampler::operator=(Sampler&& rhs) = default;
-void Sampler::SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter )
+void Sampler::SetFilterMode(FilterMode::Type minFilter, FilterMode::Type magFilter)
{
- GetImplementation(*this).SetFilterMode( minFilter, magFilter );
+ GetImplementation(*this).SetFilterMode(minFilter, magFilter);
}
-void Sampler::SetWrapMode( WrapMode::Type uWrap, WrapMode::Type vWrap )
+void Sampler::SetWrapMode(WrapMode::Type uWrap, WrapMode::Type vWrap)
{
- GetImplementation(*this).SetWrapMode( uWrap, uWrap, vWrap );
+ GetImplementation(*this).SetWrapMode(uWrap, uWrap, vWrap);
}
-void Sampler::SetWrapMode( WrapMode::Type rWrap, WrapMode::Type sWrap, WrapMode::Type tWrap )
+void Sampler::SetWrapMode(WrapMode::Type rWrap, WrapMode::Type sWrap, WrapMode::Type tWrap)
{
- GetImplementation(*this).SetWrapMode( rWrap, sWrap, tWrap );
+ GetImplementation(*this).SetWrapMode(rWrap, sWrap, tWrap);
}
Sampler::Sampler(Internal::Sampler* pointer)
-: BaseHandle( pointer )
+: BaseHandle(pointer)
{
}
*/
// INTERNAL INCLUDES
-#include <dali/public-api/object/handle.h> // Dali::Handle
#include <dali/public-api/actors/sampling.h>
+#include <dali/public-api/object/handle.h> // Dali::Handle
namespace Dali
{
class DALI_CORE_API Sampler : public BaseHandle
{
public:
-
/**
* @brief Creates a new Sampler object.
*
* @SINCE_1_1.43
* @param[in] handle Handle to an object
*/
- Sampler( const Sampler& handle );
+ Sampler(const Sampler& handle);
/**
* @brief Downcasts to a sampler handle.
* @param[in] handle Handle to an object
* @return Handle or an uninitialized handle
*/
- static Sampler DownCast( BaseHandle handle );
+ static Sampler DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- Sampler& operator=( const Sampler& handle );
-
+ Sampler& operator=(const Sampler& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Sampler( Sampler&& rhs );
+ Sampler(Sampler&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- Sampler& operator=( Sampler&& rhs );
+ Sampler& operator=(Sampler&& rhs);
/**
* @brief Sets the filter modes for this sampler.
* @param[in] minFilter The minification filter that will be used
* @param[in] magFilter The magnification filter that will be used
*/
- void SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter );
+ void SetFilterMode(FilterMode::Type minFilter, FilterMode::Type magFilter);
/**
* @brief Sets the wrap modes for this sampler.
* @param[in] uWrap Wrap mode for u coordinates
* @param[in] vWrap Wrap mode for v coordinates
*/
- void SetWrapMode( WrapMode::Type uWrap, WrapMode::Type vWrap );
+ void SetWrapMode(WrapMode::Type uWrap, WrapMode::Type vWrap);
/**
* @brief Sets the wrap modes for this sampler.
* @param[in] sWrap Wrap mode for the x direction
* @param[in] tWrap Wrap mode for the y direction
*/
- void SetWrapMode( WrapMode::Type rWrap, WrapMode::Type sWrap, WrapMode::Type tWrap );
+ void SetWrapMode(WrapMode::Type rWrap, WrapMode::Type sWrap, WrapMode::Type tWrap);
public:
-
/**
* @brief The constructor.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] pointer A pointer to a newly allocated Sampler
*/
- explicit DALI_INTERNAL Sampler( Internal::Sampler* pointer );
+ explicit DALI_INTERNAL Sampler(Internal::Sampler* pointer);
};
/**
*/
// CLASS HEADER
-#include <dali/public-api/rendering/shader.h> // Dali::Shader
+#include <dali/public-api/rendering/shader.h> // Dali::Shader
// INTERNAL INCLUDES
-#include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
+#include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
namespace Dali
{
-
-Shader Shader::New( const std::string& vertexShader,
- const std::string& fragmentShader,
- Hint::Value hints )
+Shader Shader::New(const std::string& vertexShader,
+ const std::string& fragmentShader,
+ Hint::Value hints)
{
- Internal::ShaderPtr renderer = Internal::Shader::New( vertexShader, fragmentShader, hints );
- return Shader( renderer.Get() );
+ Internal::ShaderPtr renderer = Internal::Shader::New(vertexShader, fragmentShader, hints);
+ return Shader(renderer.Get());
}
Shader::Shader()
{
}
-Shader::Shader( const Shader& handle ) = default;
+Shader::Shader(const Shader& handle) = default;
-Shader Shader::DownCast( BaseHandle handle )
+Shader Shader::DownCast(BaseHandle handle)
{
- return Shader( dynamic_cast<Dali::Internal::Shader*>(handle.GetObjectPtr()));
+ return Shader(dynamic_cast<Dali::Internal::Shader*>(handle.GetObjectPtr()));
}
-Shader& Shader::operator=( const Shader& handle ) = default;
+Shader& Shader::operator=(const Shader& handle) = default;
-Shader::Shader( Shader&& rhs ) = default;
+Shader::Shader(Shader&& rhs) = default;
-Shader& Shader::operator=( Shader&& rhs ) = default;
+Shader& Shader::operator=(Shader&& rhs) = default;
-Shader::Shader( Internal::Shader* pointer )
-: Handle( pointer )
+Shader::Shader(Internal::Shader* pointer)
+: Handle(pointer)
{
}
class DALI_CORE_API Shader : public Handle
{
public:
-
/**
* @brief Hints for rendering.
* @SINCE_1_1.45
*/
enum Value
{
- NONE = 0x00, ///< No hints @SINCE_1_1.45
- OUTPUT_IS_TRANSPARENT = 0x01, ///< Might generate transparent alpha from opaque inputs @SINCE_1_1.45
- MODIFIES_GEOMETRY = 0x02, ///< Might change position of vertices, this option disables any culling optimizations @SINCE_1_1.45
+ NONE = 0x00, ///< No hints @SINCE_1_1.45
+ OUTPUT_IS_TRANSPARENT = 0x01, ///< Might generate transparent alpha from opaque inputs @SINCE_1_1.45
+ MODIFIES_GEOMETRY = 0x02, ///< Might change position of vertices, this option disables any culling optimizations @SINCE_1_1.45
};
};
* @param[in] hints Hints to define the geometry of the rendered object
* @return A handle to a shader effect
*/
- static Shader New( const std::string& vertexShader,
- const std::string& fragmentShader,
- Hint::Value hints = Hint::NONE );
+ static Shader New(const std::string& vertexShader,
+ const std::string& fragmentShader,
+ Hint::Value hints = Hint::NONE);
/**
* @brief Default constructor, creates an empty handle.
* @SINCE_1_1.43
* @param[in] handle A handle to a Shader object
*/
- Shader( const Shader& handle );
+ Shader(const Shader& handle);
/**
* @brief Downcasts to a shader handle.
* @param[in] handle Handle to an object
* @return Shader handle or an uninitialized handle
*/
- static Shader DownCast( BaseHandle handle );
+ static Shader DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- Shader& operator=( const Shader& handle );
+ Shader& operator=(const Shader& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Shader( Shader&& rhs );
+ Shader(Shader&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- Shader& operator=( Shader&& rhs );
+ Shader& operator=(Shader&& rhs);
public:
-
/**
* @brief This constructor is used by Dali New() methods.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] effect A pointer to a newly allocated Dali resource.
*/
- explicit DALI_INTERNAL Shader( Internal::Shader* effect );
+ explicit DALI_INTERNAL Shader(Internal::Shader* effect);
};
/**
*/
// CLASS HEADER
-#include <dali/public-api/rendering/texture-set.h> // Dali::TextureSet
+#include <dali/public-api/rendering/texture-set.h> // Dali::TextureSet
// INTERNAL INCLUDES
-#include <dali/internal/event/rendering/texture-set-impl.h> // Dali::Internal::TextureSet
#include <dali/internal/event/rendering/sampler-impl.h> // Dali::Internal::Sampler
#include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
+#include <dali/internal/event/rendering/texture-set-impl.h> // Dali::Internal::TextureSet
namespace Dali
{
-
TextureSet TextureSet::New()
{
Internal::TextureSetPtr textureSet = Internal::TextureSet::New();
- return TextureSet( textureSet.Get() );
+ return TextureSet(textureSet.Get());
}
TextureSet::TextureSet()
{
}
-TextureSet::TextureSet( const TextureSet& handle ) = default;
+TextureSet::TextureSet(const TextureSet& handle) = default;
-TextureSet TextureSet::DownCast( BaseHandle handle )
+TextureSet TextureSet::DownCast(BaseHandle handle)
{
- return TextureSet( dynamic_cast<Dali::Internal::TextureSet*>(handle.GetObjectPtr()));
+ return TextureSet(dynamic_cast<Dali::Internal::TextureSet*>(handle.GetObjectPtr()));
}
-TextureSet& TextureSet::operator=( const TextureSet& handle ) = default;
+TextureSet& TextureSet::operator=(const TextureSet& handle) = default;
-TextureSet::TextureSet( TextureSet&& rhs ) = default;
+TextureSet::TextureSet(TextureSet&& rhs) = default;
-TextureSet& TextureSet::operator=( TextureSet&& rhs ) = default;
+TextureSet& TextureSet::operator=(TextureSet&& rhs) = default;
-void TextureSet::SetTexture( size_t index, Texture texture )
+void TextureSet::SetTexture(size_t index, Texture texture)
{
- if( texture )
+ if(texture)
{
- Internal::TexturePtr texturePtr( &GetImplementation( texture ) );
- GetImplementation(*this).SetTexture( static_cast<uint32_t>( index ), texturePtr ); // only support 4,294,967,295 textures
+ Internal::TexturePtr texturePtr(&GetImplementation(texture));
+ GetImplementation(*this).SetTexture(static_cast<uint32_t>(index), texturePtr); // only support 4,294,967,295 textures
}
else
{
- GetImplementation(*this).SetTexture( static_cast<uint32_t>( index ), nullptr ); // only support 4,294,967,295 textures
+ GetImplementation(*this).SetTexture(static_cast<uint32_t>(index), nullptr); // only support 4,294,967,295 textures
}
}
-Texture TextureSet::GetTexture( size_t index ) const
+Texture TextureSet::GetTexture(size_t index) const
{
- Internal::Texture* texturePtr = GetImplementation(*this).GetTexture( static_cast<uint32_t>( index ) ); // only support 4,294,967,295 textures
- return Dali::Texture( texturePtr );
+ Internal::Texture* texturePtr = GetImplementation(*this).GetTexture(static_cast<uint32_t>(index)); // only support 4,294,967,295 textures
+ return Dali::Texture(texturePtr);
}
-void TextureSet::SetSampler( size_t index, Sampler sampler )
+void TextureSet::SetSampler(size_t index, Sampler sampler)
{
- if( sampler )
+ if(sampler)
{
- Internal::SamplerPtr samplerPtr( &GetImplementation( sampler ) );
- GetImplementation(*this).SetSampler( static_cast<uint32_t>( index ), samplerPtr ); // only support 4,294,967,295 samplers
+ Internal::SamplerPtr samplerPtr(&GetImplementation(sampler));
+ GetImplementation(*this).SetSampler(static_cast<uint32_t>(index), samplerPtr); // only support 4,294,967,295 samplers
}
else
{
- GetImplementation(*this).SetSampler( static_cast<uint32_t>( index ), nullptr ); // only support 4,294,967,295 samplers
+ GetImplementation(*this).SetSampler(static_cast<uint32_t>(index), nullptr); // only support 4,294,967,295 samplers
}
}
-Sampler TextureSet::GetSampler( size_t index ) const
+Sampler TextureSet::GetSampler(size_t index) const
{
- Internal::Sampler* samplerPtr = GetImplementation(*this).GetSampler( static_cast<uint32_t>( index ) ); // only support 4,294,967,295 samplers
- return Dali::Sampler( samplerPtr );
+ Internal::Sampler* samplerPtr = GetImplementation(*this).GetSampler(static_cast<uint32_t>(index)); // only support 4,294,967,295 samplers
+ return Dali::Sampler(samplerPtr);
}
size_t TextureSet::GetTextureCount() const
return GetImplementation(*this).GetTextureCount();
}
-TextureSet::TextureSet( Internal::TextureSet* pointer )
-: BaseHandle( pointer )
+TextureSet::TextureSet(Internal::TextureSet* pointer)
+: BaseHandle(pointer)
{
}
class DALI_CORE_API TextureSet : public BaseHandle
{
public:
-
/**
* @brief Creates a new TextureSet object.
*
* @SINCE_1_1.43
* @param[in] handle Handle to an object
*/
- TextureSet( const TextureSet& handle );
+ TextureSet(const TextureSet& handle);
/**
* @brief Downcasts to a TextureSet handle.
* @param[in] handle Handle to an object
* @return TextureSet handle or an uninitialized handle
*/
- static TextureSet DownCast( BaseHandle handle );
+ static TextureSet DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return A reference to this
*/
- TextureSet& operator=( const TextureSet& handle );
+ TextureSet& operator=(const TextureSet& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- TextureSet( TextureSet&& rhs );
+ TextureSet(TextureSet&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- TextureSet& operator=( TextureSet&& rhs );
+ TextureSet& operator=(TextureSet&& rhs);
/**
* @brief Sets the texture at position "index".
* @param[in] index The position in the texture set of the texture
* @param[in] texture The texture
*/
- void SetTexture( size_t index, Texture texture );
+ void SetTexture(size_t index, Texture texture);
/**
* @brief Gets the image at position "index".
* @param[in] index The position in the texture set of the image
* @return A handle to the image at the the specified position
*/
- Texture GetTexture( size_t index ) const;
+ Texture GetTexture(size_t index) const;
/**
* @brief Sets the sampler to be used by the image at position "index".
* @param[in] index The position in the texture set of the sampler
* @param[in] sampler The sampler to use
*/
- void SetSampler( size_t index, Sampler sampler );
+ void SetSampler(size_t index, Sampler sampler);
/**
* @brief Sets the sampler to be used by the image at position "index".
* @param[in] index The position in the texture set of the image
* @return A handle to the sampler at the specified position
*/
- Sampler GetSampler( size_t index ) const;
+ Sampler GetSampler(size_t index) const;
/**
* @brief Gets the number of textures present in the TextureSet.
size_t GetTextureCount() const;
public:
-
/**
* @brief The constructor.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] pointer A pointer to a newly allocated TextureSet
*/
- explicit DALI_INTERNAL TextureSet( Internal::TextureSet* pointer );
+ explicit DALI_INTERNAL TextureSet(Internal::TextureSet* pointer);
};
/**
*/
} //namespace Dali
-
#endif // DALI_TEXTURE_SET_H
*/
// CLASS HEADER
-#include <dali/public-api/rendering/texture.h> // Dali::Texture
+#include <dali/public-api/rendering/texture.h> // Dali::Texture
// INTERNAL INCLUDES
-#include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
#include <dali/internal/event/images/pixel-data-impl.h> // Dali::Internal::PixelData
-
+#include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
namespace Dali
{
-
-Texture Texture::New( TextureType::Type type, Pixel::Format format, uint32_t width, uint32_t height )
+Texture Texture::New(TextureType::Type type, Pixel::Format format, uint32_t width, uint32_t height)
{
- Internal::TexturePtr texture = Internal::Texture::New(type, format, width, height );
- return Texture( texture.Get() );
+ Internal::TexturePtr texture = Internal::Texture::New(type, format, width, height);
+ return Texture(texture.Get());
}
-Texture Texture::New( NativeImageInterface& nativeImageInterface )
+Texture Texture::New(NativeImageInterface& nativeImageInterface)
{
- Internal::TexturePtr texture = Internal::Texture::New( nativeImageInterface );
- return Texture( texture.Get() );
+ Internal::TexturePtr texture = Internal::Texture::New(nativeImageInterface);
+ return Texture(texture.Get());
}
Texture::Texture()
{
}
-Texture::Texture( const Texture& handle ) = default;
+Texture::Texture(const Texture& handle) = default;
-Texture Texture::DownCast( BaseHandle handle )
+Texture Texture::DownCast(BaseHandle handle)
{
- return Texture( dynamic_cast<Dali::Internal::Texture*>(handle.GetObjectPtr()));
+ return Texture(dynamic_cast<Dali::Internal::Texture*>(handle.GetObjectPtr()));
}
-Texture& Texture::operator=( const Texture& handle ) = default;
+Texture& Texture::operator=(const Texture& handle) = default;
-Texture::Texture( Texture&& rhs ) = default;
+Texture::Texture(Texture&& rhs) = default;
-Texture& Texture::operator=( Texture&& rhs ) = default;
+Texture& Texture::operator=(Texture&& rhs) = default;
-bool Texture::Upload( PixelData pixelData )
+bool Texture::Upload(PixelData pixelData)
{
- Internal::PixelData& internalPixelData = GetImplementation( pixelData );
- return GetImplementation(*this).Upload( &internalPixelData );
+ Internal::PixelData& internalPixelData = GetImplementation(pixelData);
+ return GetImplementation(*this).Upload(&internalPixelData);
}
-bool Texture::Upload( PixelData pixelData,
- uint32_t layer, uint32_t mipmap,
- uint32_t xOffset, uint32_t yOffset,
- uint32_t width, uint32_t height )
+bool Texture::Upload(PixelData pixelData,
+ uint32_t layer,
+ uint32_t mipmap,
+ uint32_t xOffset,
+ uint32_t yOffset,
+ uint32_t width,
+ uint32_t height)
{
- Internal::PixelData& internalPixelData = GetImplementation( pixelData );
- return GetImplementation(*this).Upload( &internalPixelData, layer, mipmap, xOffset, yOffset, width, height );
+ Internal::PixelData& internalPixelData = GetImplementation(pixelData);
+ return GetImplementation(*this).Upload(&internalPixelData, layer, mipmap, xOffset, yOffset, width, height);
}
void Texture::GenerateMipmaps()
return GetImplementation(*this).GetHeight();
}
-Texture::Texture( Internal::Texture* pointer )
-: BaseHandle( pointer )
+Texture::Texture(Internal::Texture* pointer)
+: BaseHandle(pointer)
{
}
*/
// INTERNAL INCLUDES
-#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/images/native-image-interface.h>
-#include <dali/public-api/images/pixel.h>
#include <dali/public-api/images/pixel-data.h>
+#include <dali/public-api/images/pixel.h>
+#include <dali/public-api/object/base-handle.h>
namespace Dali
{
namespace TextureType
{
-
/**
* @brief Enumeration for texture types.
* @SINCE_1_1.43
*/
enum Type
{
- TEXTURE_2D, ///< One 2D image @SINCE_1_1.43
- TEXTURE_CUBE ///< Six 2D images arranged in a cube-shape @SINCE_1_1.43
+ TEXTURE_2D, ///< One 2D image @SINCE_1_1.43
+ TEXTURE_CUBE ///< Six 2D images arranged in a cube-shape @SINCE_1_1.43
};
} // namespace TextureType
namespace CubeMapLayer
{
-
- /**
+/**
* @brief Faces of a cube map.
* These constants should be used as the "layer" parameter when uploading a cube-map with Texture::Upload.
* @SINCE_1_1.43
*/
- const uint32_t POSITIVE_X = 0u; ///< CubeMap image for +x @SINCE_1_1.43
- const uint32_t NEGATIVE_X = 1u; ///< CubeMap image for -x @SINCE_1_1.43
- const uint32_t POSITIVE_Y = 2u; ///< CubeMap image for +y @SINCE_1_1.43
- const uint32_t NEGATIVE_Y = 3u; ///< CubeMap image for -y @SINCE_1_1.43
- const uint32_t POSITIVE_Z = 4u; ///< CubeMap image for +z @SINCE_1_1.43
- const uint32_t NEGATIVE_Z = 5u; ///< CubeMap image for -z @SINCE_1_1.43
+const uint32_t POSITIVE_X = 0u; ///< CubeMap image for +x @SINCE_1_1.43
+const uint32_t NEGATIVE_X = 1u; ///< CubeMap image for -x @SINCE_1_1.43
+const uint32_t POSITIVE_Y = 2u; ///< CubeMap image for +y @SINCE_1_1.43
+const uint32_t NEGATIVE_Y = 3u; ///< CubeMap image for -y @SINCE_1_1.43
+const uint32_t POSITIVE_Z = 4u; ///< CubeMap image for +z @SINCE_1_1.43
+const uint32_t NEGATIVE_Z = 5u; ///< CubeMap image for -z @SINCE_1_1.43
} // namespace CubeMapLayer
-
/**
* @brief Texture represents a texture object used as input or output by shaders.
* @SINCE_1_1.43
class DALI_CORE_API Texture : public BaseHandle
{
public:
-
/**
* @brief Creates a new Texture object.
*
* @param[in] height The height of the texture
* @return A handle to a newly allocated Texture
*/
- static Texture New( TextureType::Type type, Pixel::Format format, uint32_t width, uint32_t height );
+ static Texture New(TextureType::Type type, Pixel::Format format, uint32_t width, uint32_t height);
/**
* @brief Creates a new Texture object from a native image.
* @note It is not possible to upload data to textures created from a native image using Upload methods
* although there might be platform specific APIs to upload data to a native image.
*/
- static Texture New( NativeImageInterface& nativeImageInterface );
+ static Texture New(NativeImageInterface& nativeImageInterface);
/**
* @brief Default constructor, creates an empty handle.
* @SINCE_1_1.43
* @param[in] handle Handle to an object
*/
- Texture( const Texture& handle );
+ Texture(const Texture& handle);
/**
* @brief Downcasts to a texture.
* @param[in] handle Handle to an object
* @return Texture handle or an uninitialized handle
*/
- static Texture DownCast( BaseHandle handle );
+ static Texture DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- Texture& operator=( const Texture& handle );
+ Texture& operator=(const Texture& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Texture( Texture&& rhs );
+ Texture(Texture&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- Texture& operator=( Texture&& rhs );
+ Texture& operator=(Texture&& rhs);
/**
* @brief Uploads data to the texture from a PixelData object.
* @param[in] pixelData The pixelData object
* @return True if the PixelData object has compatible pixel format and fits within the texture, false otherwise
*/
- bool Upload( PixelData pixelData );
+ bool Upload(PixelData pixelData);
/**
* @brief Uploads data to the texture from a PixelData object.
* @param[in] height Specifies the height of the rectangular area in the texture that will be updated
* @return True if the PixelData object has compatible pixel format and fits in the rectangle specified, false otherwise
*/
- bool Upload( PixelData pixelData,
- uint32_t layer, uint32_t mipmap,
- uint32_t xOffset, uint32_t yOffset,
- uint32_t width, uint32_t height );
+ bool Upload(PixelData pixelData,
+ uint32_t layer,
+ uint32_t mipmap,
+ uint32_t xOffset,
+ uint32_t yOffset,
+ uint32_t width,
+ uint32_t height);
/**
* @brief Generates mipmaps for the texture.
uint32_t GetHeight() const;
public:
-
/**
* @brief The constructor.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] pointer A pointer to a newly allocated Texture
*/
- explicit DALI_INTERNAL Texture( Internal::Texture* pointer );
+ explicit DALI_INTERNAL Texture(Internal::Texture* pointer);
};
/**
#include <dali/public-api/rendering/vertex-buffer.h>
// INTERNAL INCLUDES
-#include <dali/public-api/object/property-map.h> // Dali::Property::Map
#include <dali/internal/event/rendering/vertex-buffer-impl.h> // Dali::Internal::VertexBuffer
+#include <dali/public-api/object/property-map.h> // Dali::Property::Map
namespace Dali
{
-
-VertexBuffer VertexBuffer::New( Dali::Property::Map& bufferFormat )
+VertexBuffer VertexBuffer::New(Dali::Property::Map& bufferFormat)
{
- Internal::VertexBufferPtr vertexBuffer = Internal::VertexBuffer::New( bufferFormat );
+ Internal::VertexBufferPtr vertexBuffer = Internal::VertexBuffer::New(bufferFormat);
- return VertexBuffer( vertexBuffer.Get() );
+ return VertexBuffer(vertexBuffer.Get());
}
VertexBuffer::VertexBuffer()
{
}
-VertexBuffer::VertexBuffer( const VertexBuffer& handle ) = default;
+VertexBuffer::VertexBuffer(const VertexBuffer& handle) = default;
-VertexBuffer VertexBuffer::DownCast( BaseHandle handle )
+VertexBuffer VertexBuffer::DownCast(BaseHandle handle)
{
- return VertexBuffer( dynamic_cast<Dali::Internal::VertexBuffer*>(handle.GetObjectPtr()));
+ return VertexBuffer(dynamic_cast<Dali::Internal::VertexBuffer*>(handle.GetObjectPtr()));
}
-VertexBuffer& VertexBuffer::operator=( const VertexBuffer& handle ) = default;
+VertexBuffer& VertexBuffer::operator=(const VertexBuffer& handle) = default;
-VertexBuffer::VertexBuffer( VertexBuffer&& rhs ) = default;
+VertexBuffer::VertexBuffer(VertexBuffer&& rhs) = default;
-VertexBuffer& VertexBuffer::operator=( VertexBuffer&& rhs ) = default;
+VertexBuffer& VertexBuffer::operator=(VertexBuffer&& rhs) = default;
-void VertexBuffer::SetData( const void* data, std::size_t size )
+void VertexBuffer::SetData(const void* data, std::size_t size)
{
- GetImplementation(*this).SetData( data, static_cast<uint32_t>( size ) ); // only support 4,294,967,295 bytes
+ GetImplementation(*this).SetData(data, static_cast<uint32_t>(size)); // only support 4,294,967,295 bytes
}
std::size_t VertexBuffer::GetSize() const
{
- return GetImplementation(*this).GetSize();
+ return GetImplementation(*this).GetSize();
}
-
-VertexBuffer::VertexBuffer( Internal::VertexBuffer* pointer )
-: BaseHandle( pointer )
+VertexBuffer::VertexBuffer(Internal::VertexBuffer* pointer)
+: BaseHandle(pointer)
{
}
class DALI_CORE_API VertexBuffer : public BaseHandle
{
public:
-
/**
* @brief Creates a VertexBuffer.
*
* @param[in] bufferFormat Map of names and types that describes the components of the buffer
* @return Handle to a newly allocated VertexBuffer
*/
- static VertexBuffer New( Dali::Property::Map& bufferFormat );
+ static VertexBuffer New(Dali::Property::Map& bufferFormat);
/**
* @brief Default constructor, creates an empty handle.
* @SINCE_1_9.27
* @param[in] handle Handle to an object
*/
- VertexBuffer( const VertexBuffer& handle );
+ VertexBuffer(const VertexBuffer& handle);
/**
* @brief Downcasts to a property buffer handle.
* @param[in] handle Handle to an object
* @return Property buffer handle or an uninitialized handle
*/
- static VertexBuffer DownCast( BaseHandle handle );
+ static VertexBuffer DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- VertexBuffer& operator=( const VertexBuffer& handle );
+ VertexBuffer& operator=(const VertexBuffer& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.27
* @param[in] rhs A reference to the moved handle
*/
- VertexBuffer( VertexBuffer&& rhs );
+ VertexBuffer(VertexBuffer&& rhs);
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this handle
*/
- VertexBuffer& operator=( VertexBuffer&& rhs );
+ VertexBuffer& operator=(VertexBuffer&& rhs);
/**
* @brief Updates the whole buffer information.
* @param[in] data A pointer to the data that will be copied to the buffer
* @param[in] size Number of elements to expand or contract the buffer
*/
- void SetData( const void* data, std::size_t size );
+ void SetData(const void* data, std::size_t size);
/**
* @brief Gets the number of elements in the buffer.
std::size_t GetSize() const;
public:
-
/**
* @brief The constructor.
* @note Not intended for application developers.
* @SINCE_1_9.27
* @param[in] pointer A pointer to a newly allocated VertexBuffer
*/
- explicit DALI_INTERNAL VertexBuffer( Internal::VertexBuffer* pointer );
+ explicit DALI_INTERNAL VertexBuffer(Internal::VertexBuffer* pointer);
};
/**
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace
{
-
const int32_t INVALID_CALLBACK_INDEX = -1;
} // unnamed namespace
namespace Dali
{
-
BaseSignal::BaseSignal()
-: mEmittingFlag( false )
+: mEmittingFlag(false)
{
}
BaseSignal::~BaseSignal()
{
// We can't assert in a destructor
- if( mEmittingFlag )
+ if(mEmittingFlag)
{
- DALI_LOG_ERROR( "Invalid destruction of Signal during Emit()\n" );
+ DALI_LOG_ERROR("Invalid destruction of Signal during Emit()\n");
}
// The signal is being destroyed. We have to inform any slots
// that are connected, that the signal is dead.
- const std::size_t count( mSignalConnections.Count() );
- for( std::size_t i=0; i < count; i++ )
+ const std::size_t count(mSignalConnections.Count());
+ for(std::size_t i = 0; i < count; i++)
{
- SignalConnection* connection = mSignalConnections[ i ];
+ SignalConnection* connection = mSignalConnections[i];
// Note that values are set to NULL in DeleteConnection
- if( connection )
+ if(connection)
{
- connection->Disconnect( this );
+ connection->Disconnect(this);
delete connection;
}
}
bool BaseSignal::Empty() const
{
- return ( 0 == GetConnectionCount() );
+ return (0 == GetConnectionCount());
}
std::size_t BaseSignal::GetConnectionCount() const
{
- std::size_t count( 0 );
+ std::size_t count(0);
- const std::size_t size( mSignalConnections.Count() );
- for( std::size_t i = 0; i < size; ++i )
+ const std::size_t size(mSignalConnections.Count());
+ for(std::size_t i = 0; i < size; ++i)
{
// Note that values are set to NULL in DeleteConnection
- if ( nullptr != mSignalConnections[i] )
+ if(nullptr != mSignalConnections[i])
{
++count;
}
void BaseSignal::Emit()
{
// Guards against nested Emit() calls
- EmitGuard guard( mEmittingFlag ); // Guards against nested Emit() calls
- if( guard.ErrorOccurred() )
+ EmitGuard guard(mEmittingFlag); // Guards against nested Emit() calls
+ if(guard.ErrorOccurred())
{
return;
}
// If more connections are added by callbacks, these are ignore until the next Emit()
// Note that mSignalConnections.Count() count cannot be reduced while iterating
- const std::size_t initialCount( mSignalConnections.Count() );
+ const std::size_t initialCount(mSignalConnections.Count());
- for( std::size_t i = 0; i < initialCount; ++i )
+ for(std::size_t i = 0; i < initialCount; ++i)
{
- CallbackBase* callback( GetCallback(i) );
+ CallbackBase* callback(GetCallback(i));
// Note that connections will be set to NULL when disconnected
// This is preferable to reducing the connection count while iterating
- if( callback )
+ if(callback)
{
- CallbackBase::Execute( *callback );
+ CallbackBase::Execute(*callback);
}
}
CleanupConnections();
}
-void BaseSignal::OnConnect( CallbackBase* callback )
+void BaseSignal::OnConnect(CallbackBase* callback)
{
- DALI_ASSERT_ALWAYS( nullptr != callback && "Invalid member function pointer passed to Connect()" );
+ DALI_ASSERT_ALWAYS(nullptr != callback && "Invalid member function pointer passed to Connect()");
- int32_t index = FindCallback( callback );
+ int32_t index = FindCallback(callback);
// Don't double-connect the same callback
- if( INVALID_CALLBACK_INDEX == index )
+ if(INVALID_CALLBACK_INDEX == index)
{
// create a new signal connection object, to allow the signal to track the connection.
- SignalConnection* connection = new SignalConnection( callback );
+ SignalConnection* connection = new SignalConnection(callback);
- mSignalConnections.PushBack( connection );
+ mSignalConnections.PushBack(connection);
}
else
{
}
}
-void BaseSignal::OnDisconnect( CallbackBase* callback )
+void BaseSignal::OnDisconnect(CallbackBase* callback)
{
- DALI_ASSERT_ALWAYS( nullptr != callback && "Invalid member function pointer passed to Disconnect()" );
+ DALI_ASSERT_ALWAYS(nullptr != callback && "Invalid member function pointer passed to Disconnect()");
- int32_t index = FindCallback( callback );
+ int32_t index = FindCallback(callback);
- if( index > INVALID_CALLBACK_INDEX )
+ if(index > INVALID_CALLBACK_INDEX)
{
- DeleteConnection( index );
+ DeleteConnection(index);
}
// call back is a temporary created to find which slot should be disconnected.
delete callback;
}
-void BaseSignal::OnConnect( ConnectionTrackerInterface* tracker, CallbackBase* callback )
+void BaseSignal::OnConnect(ConnectionTrackerInterface* tracker, CallbackBase* callback)
{
- DALI_ASSERT_ALWAYS( nullptr != tracker && "Invalid ConnectionTrackerInterface pointer passed to Connect()" );
- DALI_ASSERT_ALWAYS( nullptr != callback && "Invalid member function pointer passed to Connect()" );
+ DALI_ASSERT_ALWAYS(nullptr != tracker && "Invalid ConnectionTrackerInterface pointer passed to Connect()");
+ DALI_ASSERT_ALWAYS(nullptr != callback && "Invalid member function pointer passed to Connect()");
- int32_t index = FindCallback( callback );
+ int32_t index = FindCallback(callback);
// Don't double-connect the same callback
- if( INVALID_CALLBACK_INDEX == index )
+ if(INVALID_CALLBACK_INDEX == index)
{
// create a new signal connection object, to allow the signal to track the connection.
- SignalConnection* connection = new SignalConnection( tracker, callback );
+ SignalConnection* connection = new SignalConnection(tracker, callback);
- mSignalConnections.PushBack( connection );
+ mSignalConnections.PushBack(connection);
// Let the connection tracker know that a connection between a signal and a slot has been made.
- tracker->SignalConnected( this, callback );
+ tracker->SignalConnected(this, callback);
}
else
{
}
}
-void BaseSignal::OnDisconnect( ConnectionTrackerInterface* tracker, CallbackBase* callback )
+void BaseSignal::OnDisconnect(ConnectionTrackerInterface* tracker, CallbackBase* callback)
{
- DALI_ASSERT_ALWAYS( nullptr != tracker && "Invalid ConnectionTrackerInterface pointer passed to Disconnect()" );
- DALI_ASSERT_ALWAYS( nullptr != callback && "Invalid member function pointer passed to Disconnect()" );
+ DALI_ASSERT_ALWAYS(nullptr != tracker && "Invalid ConnectionTrackerInterface pointer passed to Disconnect()");
+ DALI_ASSERT_ALWAYS(nullptr != callback && "Invalid member function pointer passed to Disconnect()");
- int32_t index = FindCallback( callback );
+ int32_t index = FindCallback(callback);
- if( index > INVALID_CALLBACK_INDEX )
+ if(index > INVALID_CALLBACK_INDEX)
{
// temporary pointer to disconnected callback
CallbackBase* disconnectedCallback = mSignalConnections[index]->GetCallback();
// close the signal side connection first.
- DeleteConnection( index );
+ DeleteConnection(index);
// close the slot side connection
- tracker->SignalDisconnected( this, disconnectedCallback );
+ tracker->SignalDisconnected(this, disconnectedCallback);
}
// call back is a temporary created to find which slot should be disconnected.
}
// for SlotObserver::SlotDisconnected
-void BaseSignal::SlotDisconnected( CallbackBase* callback )
+void BaseSignal::SlotDisconnected(CallbackBase* callback)
{
- const std::size_t count( mSignalConnections.Count() );
- for( std::size_t i=0; i < count; ++i )
+ const std::size_t count(mSignalConnections.Count());
+ for(std::size_t i = 0; i < count; ++i)
{
- const CallbackBase* connectionCallback = GetCallback( i );
+ const CallbackBase* connectionCallback = GetCallback(i);
// Pointer comparison i.e. SignalConnection contains pointer to same callback instance
- if( connectionCallback &&
- connectionCallback == callback )
+ if(connectionCallback &&
+ connectionCallback == callback)
{
- DeleteConnection( i );
+ DeleteConnection(i);
// Disconnection complete
return;
}
}
- DALI_ABORT( "Callback lost in SlotDisconnected()" );
+ DALI_ABORT("Callback lost in SlotDisconnected()");
}
-CallbackBase* BaseSignal::GetCallback( std::size_t connectionIndex ) const
+CallbackBase* BaseSignal::GetCallback(std::size_t connectionIndex) const
{
- DALI_ASSERT_ALWAYS( connectionIndex < mSignalConnections.Count() && "GetCallback called with invalid index" );
+ DALI_ASSERT_ALWAYS(connectionIndex < mSignalConnections.Count() && "GetCallback called with invalid index");
- CallbackBase* callback( nullptr );
+ CallbackBase* callback(nullptr);
- SignalConnection* connection( mSignalConnections[ connectionIndex ] );
+ SignalConnection* connection(mSignalConnections[connectionIndex]);
// Note that values are set to NULL in DeleteConnection
- if( connection )
+ if(connection)
{
callback = connection->GetCallback();
}
return callback;
}
-int32_t BaseSignal::FindCallback( CallbackBase* callback )
+int32_t BaseSignal::FindCallback(CallbackBase* callback)
{
- int32_t index( INVALID_CALLBACK_INDEX );
+ int32_t index(INVALID_CALLBACK_INDEX);
// A signal can have multiple slots connected to it.
// We need to search for the slot which has the same call back function (if it's static)
// Or the same object / member function (for non-static)
const std::size_t count = mSignalConnections.Count();
- for( std::size_t i = 0; i < count; ++i )
+ for(std::size_t i = 0; i < count; ++i)
{
- const CallbackBase* connectionCallback = GetCallback( i );
+ const CallbackBase* connectionCallback = GetCallback(i);
// Note that values are set to NULL in DeleteConnection
- if( connectionCallback && ( *connectionCallback == *callback ) )
+ if(connectionCallback && (*connectionCallback == *callback))
{
- index = static_cast<int>( i ); // only 2,147,483,647 connections supported, no error check
+ index = static_cast<int>(i); // only 2,147,483,647 connections supported, no error check
break;
}
}
return index;
}
-void BaseSignal::DeleteConnection( std::size_t connectionIndex )
+void BaseSignal::DeleteConnection(std::size_t connectionIndex)
{
- DALI_ASSERT_ALWAYS( connectionIndex < mSignalConnections.Count() && "DeleteConnection called with invalid index" );
+ DALI_ASSERT_ALWAYS(connectionIndex < mSignalConnections.Count() && "DeleteConnection called with invalid index");
// delete the object
- SignalConnection* connection( mSignalConnections[ connectionIndex ] );
+ SignalConnection* connection(mSignalConnections[connectionIndex]);
delete connection;
- if( mEmittingFlag )
+ if(mEmittingFlag)
{
// IMPORTANT - do not remove from items from mSignalConnections, set to NULL instead.
// Signal Emit() methods require that connection count is not reduced while iterating
// i.e. DeleteConnection can be called from within callbacks, while iterating through mSignalConnections.
- mSignalConnections[ connectionIndex ] = nullptr;
+ mSignalConnections[connectionIndex] = nullptr;
}
else
{
// If application connects and disconnects without the signal never emitting,
// the mSignalConnections vector keeps growing and growing as CleanupConnections() is done from Emit.
- mSignalConnections.Erase( mSignalConnections.Begin() + connectionIndex );
+ mSignalConnections.Erase(mSignalConnections.Begin() + connectionIndex);
}
}
{
const std::size_t total = mSignalConnections.Count();
// only do something if there are items
- if( total > 0 )
+ if(total > 0)
{
std::size_t index = 0;
// process the whole vector
- for( std::size_t i = 0; i < total; ++i )
+ for(std::size_t i = 0; i < total; ++i)
{
- if( mSignalConnections[ index ] == nullptr )
+ if(mSignalConnections[index] == nullptr)
{
// items will be moved so don't increase index (erase will decrease the count of vector)
- mSignalConnections.Erase( mSignalConnections.Begin() + index );
+ mSignalConnections.Erase(mSignalConnections.Begin() + index);
}
else
{
// BaseSignal::EmitGuard
-BaseSignal::EmitGuard::EmitGuard( bool& flag )
-: mFlag( nullptr )
+BaseSignal::EmitGuard::EmitGuard(bool& flag)
+: mFlag(nullptr)
{
- if( !flag )
+ if(!flag)
{
mFlag = &flag;
- flag = true;
+ flag = true;
}
else
{
// mFlag is NULL when Emit() is called during Emit()
- DALI_LOG_ERROR( "Cannot call Emit() from inside Emit()\n" );
+ DALI_LOG_ERROR("Cannot call Emit() from inside Emit()\n");
}
}
BaseSignal::EmitGuard::~EmitGuard()
{
- if( mFlag )
+ if(mFlag)
{
*mFlag = false;
}
class DALI_CORE_API BaseSignal : public SlotObserver
{
public:
-
/**
* @brief Constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in,out] flag This flag will be set to true during Emit() calls
*/
- EmitGuard( bool& flag );
+ EmitGuard(bool& flag);
/**
* @brief Non-virtual destructor.
* @return The value returned by the last callback
* @pre Cannot be called from inside the same Signal's Emit methods.
*/
- template< typename Ret >
+ template<typename Ret>
Ret EmitReturn()
{
Ret returnVal = Ret();
// Guards against nested Emit() calls
- EmitGuard guard( mEmittingFlag );
- if( guard.ErrorOccurred() )
+ EmitGuard guard(mEmittingFlag);
+ if(guard.ErrorOccurred())
{
return returnVal;
}
// If more connections are added by callbacks, these are ignore until the next Emit()
// Note that count cannot be reduced while iterating
- const std::size_t initialCount( mSignalConnections.Count() );
+ const std::size_t initialCount(mSignalConnections.Count());
- for( std::size_t i = 0; i < initialCount; ++i )
+ for(std::size_t i = 0; i < initialCount; ++i)
{
- CallbackBase* callback( GetCallback(i) );
+ CallbackBase* callback(GetCallback(i));
// Note that connections will be set to NULL when disconnected
// This is preferable to reducing the connection count while iterating
- if( callback )
+ if(callback)
{
- returnVal = CallbackBase::ExecuteReturn<Ret>( *callback );
+ returnVal = CallbackBase::ExecuteReturn<Ret>(*callback);
}
}
* @param[in] arg0 The first parameter
* @pre Cannot be called from inside the same Signal's Emit methods.
*/
- template< typename Arg0 >
- void Emit( Arg0 arg0 )
+ template<typename Arg0>
+ void Emit(Arg0 arg0)
{
// Guards against nested Emit() calls
- EmitGuard guard( mEmittingFlag ); // Guards against nested Emit() calls
- if( guard.ErrorOccurred() )
+ EmitGuard guard(mEmittingFlag); // Guards against nested Emit() calls
+ if(guard.ErrorOccurred())
{
return;
}
// If more connections are added by callbacks, these are ignore until the next Emit()
// Note that count cannot be reduced while iterating
- const std::size_t initialCount( mSignalConnections.Count() );
+ const std::size_t initialCount(mSignalConnections.Count());
- for( std::size_t i = 0; i < initialCount; ++i )
+ for(std::size_t i = 0; i < initialCount; ++i)
{
- CallbackBase* callback( GetCallback(i) );
+ CallbackBase* callback(GetCallback(i));
// Note that connections will be set to NULL when disconnected
// This is preferable to reducing the connection count while iterating
- if( callback )
+ if(callback)
{
- CallbackBase::Execute<Arg0 >( *callback, arg0 );
+ CallbackBase::Execute<Arg0>(*callback, arg0);
}
}
* @return The value returned by the last callback
* @pre Cannot be called from inside the same Signal's Emit methods.
*/
- template< typename Ret, typename Arg0 >
- Ret EmitReturn( Arg0 arg0 )
+ template<typename Ret, typename Arg0>
+ Ret EmitReturn(Arg0 arg0)
{
Ret returnVal = Ret();
// Guards against nested Emit() calls
- EmitGuard guard( mEmittingFlag ); // Guards against nested Emit() calls
- if( guard.ErrorOccurred() )
+ EmitGuard guard(mEmittingFlag); // Guards against nested Emit() calls
+ if(guard.ErrorOccurred())
{
return returnVal;
}
// If more connections are added by callbacks, these are ignore until the next Emit()
// Note that count cannot be reduced while iterating
- const std::size_t initialCount( mSignalConnections.Count() );
+ const std::size_t initialCount(mSignalConnections.Count());
- for( std::size_t i = 0; i < initialCount; ++i )
+ for(std::size_t i = 0; i < initialCount; ++i)
{
- CallbackBase* callback( GetCallback(i) );
+ CallbackBase* callback(GetCallback(i));
// Note that connections will be set to NULL when disconnected
// This is preferable to reducing the connection count while iterating
- if( callback )
+ if(callback)
{
- returnVal = CallbackBase::ExecuteReturn<Ret,Arg0>( *callback, arg0 );
+ returnVal = CallbackBase::ExecuteReturn<Ret, Arg0>(*callback, arg0);
}
}
* @param[in] arg1 The second parameter
* @pre Cannot be called from inside the same Signal's Emit methods.
*/
- template< typename Arg0, typename Arg1 >
- void Emit( Arg0 arg0, Arg1 arg1 )
+ template<typename Arg0, typename Arg1>
+ void Emit(Arg0 arg0, Arg1 arg1)
{
// Guards against nested Emit() calls
- EmitGuard guard( mEmittingFlag ); // Guards against nested Emit() calls
- if( guard.ErrorOccurred() )
+ EmitGuard guard(mEmittingFlag); // Guards against nested Emit() calls
+ if(guard.ErrorOccurred())
{
return;
}
// If more connections are added by callbacks, these are ignore until the next Emit()
// Note that count cannot be reduced while iterating
- const std::size_t initialCount( mSignalConnections.Count() );
+ const std::size_t initialCount(mSignalConnections.Count());
- for( std::size_t i = 0; i < initialCount; ++i )
+ for(std::size_t i = 0; i < initialCount; ++i)
{
- CallbackBase* callback( GetCallback(i) );
+ CallbackBase* callback(GetCallback(i));
// Note that connections will be set to NULL when disconnected
// This is preferable to reducing the connection count while iterating
- if( callback )
+ if(callback)
{
- CallbackBase::Execute<Arg0,Arg1>( *callback, arg0, arg1 );
+ CallbackBase::Execute<Arg0, Arg1>(*callback, arg0, arg1);
}
}
* @return The value returned by the last callback
* @pre Cannot be called from inside the same Signal's Emit methods.
*/
- template< typename Ret, typename Arg0, typename Arg1 >
- Ret EmitReturn( Arg0 arg0, Arg1 arg1 )
+ template<typename Ret, typename Arg0, typename Arg1>
+ Ret EmitReturn(Arg0 arg0, Arg1 arg1)
{
Ret returnVal = Ret();
// Guards against nested Emit() calls
- EmitGuard guard( mEmittingFlag ); // Guards against nested Emit() calls
- if( guard.ErrorOccurred() )
+ EmitGuard guard(mEmittingFlag); // Guards against nested Emit() calls
+ if(guard.ErrorOccurred())
{
return returnVal;
}
// If more connections are added by callbacks, these are ignore until the next Emit()
// Note that count cannot be reduced while iterating
- const std::size_t initialCount( mSignalConnections.Count() );
+ const std::size_t initialCount(mSignalConnections.Count());
- for( std::size_t i = 0; i < initialCount; ++i )
+ for(std::size_t i = 0; i < initialCount; ++i)
{
- CallbackBase* callback( GetCallback(i) );
+ CallbackBase* callback(GetCallback(i));
// Note that connections will be set to NULL when disconnected
// This is preferable to reducing the connection count while iterating
- if( callback )
+ if(callback)
{
- returnVal = CallbackBase::ExecuteReturn<Ret,Arg0,Arg1>( *callback, arg0, arg1 );
+ returnVal = CallbackBase::ExecuteReturn<Ret, Arg0, Arg1>(*callback, arg0, arg1);
}
}
* @param[in] arg2 The third parameter
* @pre Cannot be called from inside the same Signal's Emit methods.
*/
- template< typename Arg0, typename Arg1, typename Arg2 >
- void Emit( Arg0 arg0, Arg1 arg1, Arg2 arg2 )
+ template<typename Arg0, typename Arg1, typename Arg2>
+ void Emit(Arg0 arg0, Arg1 arg1, Arg2 arg2)
{
// Guards against nested Emit() calls
- EmitGuard guard( mEmittingFlag ); // Guards against nested Emit() calls
- if( guard.ErrorOccurred() )
+ EmitGuard guard(mEmittingFlag); // Guards against nested Emit() calls
+ if(guard.ErrorOccurred())
{
return;
}
// If more connections are added by callbacks, these are ignore until the next Emit()
// Note that count cannot be reduced while iterating
- const std::size_t initialCount( mSignalConnections.Count() );
+ const std::size_t initialCount(mSignalConnections.Count());
- for( std::size_t i = 0; i < initialCount; ++i )
+ for(std::size_t i = 0; i < initialCount; ++i)
{
- CallbackBase* callback( GetCallback(i) );
+ CallbackBase* callback(GetCallback(i));
// Note that connections will be set to NULL when disconnected
// This is preferable to reducing the connection count while iterating
- if( callback )
+ if(callback)
{
- CallbackBase::Execute<Arg0,Arg1,Arg2>( *callback, arg0, arg1, arg2 );
+ CallbackBase::Execute<Arg0, Arg1, Arg2>(*callback, arg0, arg1, arg2);
}
}
* @return The value returned by the last callback
* @pre Cannot be called from inside the same Signal's Emit methods.
*/
- template< typename Ret, typename Arg0, typename Arg1, typename Arg2 >
- Ret EmitReturn( Arg0 arg0, Arg1 arg1, Arg2 arg2 )
+ template<typename Ret, typename Arg0, typename Arg1, typename Arg2>
+ Ret EmitReturn(Arg0 arg0, Arg1 arg1, Arg2 arg2)
{
Ret returnVal = Ret();
// Guards against nested Emit() calls
- EmitGuard guard( mEmittingFlag ); // Guards against nested Emit() calls
- if( guard.ErrorOccurred() )
+ EmitGuard guard(mEmittingFlag); // Guards against nested Emit() calls
+ if(guard.ErrorOccurred())
{
return returnVal;
}
// If more connections are added by callbacks, these are ignore until the next Emit()
// Note that count cannot be reduced while iterating
- const std::size_t initialCount( mSignalConnections.Count() );
+ const std::size_t initialCount(mSignalConnections.Count());
- for( std::size_t i = 0; i < initialCount; ++i )
+ for(std::size_t i = 0; i < initialCount; ++i)
{
- CallbackBase* callback( GetCallback(i) );
+ CallbackBase* callback(GetCallback(i));
// Note that connections will be set to NULL when disconnected
// This is preferable to reducing the connection count while iterating
- if( callback )
+ if(callback)
{
- returnVal = CallbackBase::ExecuteReturn<Ret,Arg0,Arg1,Arg2>( *callback, arg0, arg1, arg2 );
+ returnVal = CallbackBase::ExecuteReturn<Ret, Arg0, Arg1, Arg2>(*callback, arg0, arg1, arg2);
}
}
* @SINCE_1_0.0
* @param[in] callback A newly allocated callback object (takes ownership)
*/
- void OnConnect( CallbackBase* callback );
+ void OnConnect(CallbackBase* callback);
/**
* @brief Called by Signal implementations, when the user calls Signal.Disconnect( ... ).
* @SINCE_1_0.0
* @param[in] callback A newly allocated callback object (takes ownership)
*/
- void OnDisconnect( CallbackBase* callback );
+ void OnDisconnect(CallbackBase* callback);
/**
* @brief Called by Signal implementations, when the user calls Signal.Connect( ... ).
* @param[in] tracker The connection tracker
* @param[in] callback A newly allocated callback object (takes ownership)
*/
- void OnConnect( ConnectionTrackerInterface* tracker, CallbackBase* callback );
+ void OnConnect(ConnectionTrackerInterface* tracker, CallbackBase* callback);
/**
* @brief Called by Signal implementations, when the user calls Signal.Disconnect( ... ).
* @param[in] tracker The connection tracker
* @param[in] callback A newly allocated callback object (takes ownership)
*/
- void OnDisconnect( ConnectionTrackerInterface* tracker, CallbackBase* callback );
+ void OnDisconnect(ConnectionTrackerInterface* tracker, CallbackBase* callback);
private: // SlotObserver interface, to be told when a slot disconnects
-
/**
* @copydoc SlotObserver::SlotDisconnected
*/
- void SlotDisconnected( CallbackBase* callback ) override;
+ void SlotDisconnected(CallbackBase* callback) override;
private:
-
/**
* @brief Returns a callback given an index in to the connection array.
*
* @param[in] connectionIndex The index of the callback
* @return The callback, or NULL if the connection has been deleted
*/
- CallbackBase* GetCallback( std::size_t connectionIndex ) const;
+ CallbackBase* GetCallback(std::size_t connectionIndex) const;
/**
* @brief Helper to find whether a callback is connected.
* @param[in] callback The call back object
* @return A valid index if the callback is connected
*/
- int32_t FindCallback( CallbackBase* callback );
+ int32_t FindCallback(CallbackBase* callback);
/**
* @brief Deletes a connection object from the list of connections.
* @SINCE_1_0.0
* @param[in] connectionIndex The index of the callback
*/
- void DeleteConnection( std::size_t connectionIndex );
+ void DeleteConnection(std::size_t connectionIndex);
/**
* @brief Helper to remove NULL items from mSignalConnections, which is only safe at the end of Emit()
*/
void CleanupConnections();
- BaseSignal( const BaseSignal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- BaseSignal( BaseSignal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- BaseSignal& operator=( const BaseSignal& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
- BaseSignal& operator=( BaseSignal&& ) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
+ BaseSignal(const BaseSignal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ BaseSignal(BaseSignal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ BaseSignal& operator=(const BaseSignal&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
+ BaseSignal& operator=(BaseSignal&&) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
private:
-
- Dali::Vector< SignalConnection* > mSignalConnections; ///< Array of connections
+ Dali::Vector<SignalConnection*> mSignalConnections; ///< Array of connections
bool mEmittingFlag; ///< Used to guard against nested Emit() calls
};
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// CLASS HEADER
#include <dali/public-api/signals/callback.h>
-
namespace Dali
{
-
// CallbackBase
CallbackBase::CallbackBase()
-: mImpl( nullptr ),
- mFunction( nullptr )
+: mImpl(nullptr),
+ mFunction(nullptr)
{
}
Reset();
}
-CallbackBase::CallbackBase( Function function )
-: mImpl( nullptr ),
- mFunction( function )
+CallbackBase::CallbackBase(Function function)
+: mImpl(nullptr),
+ mFunction(function)
{
}
-CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher )
-: mMemberFunction( function )
+CallbackBase::CallbackBase(void* object, MemberFunction function, Dispatcher dispatcher)
+: mMemberFunction(function)
{
mImpl = new CallbackBase::Impl;
- if( mImpl )
+ if(mImpl)
{
- mImpl->mObjectPointer = object;
+ mImpl->mObjectPointer = object;
mImpl->mMemberFunctionDispatcher = dispatcher;
- mImpl->mDestructorDispatcher = nullptr; // object is not owned
+ mImpl->mDestructorDispatcher = nullptr; // object is not owned
}
}
-CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor )
-: mMemberFunction( function )
+CallbackBase::CallbackBase(void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor)
+: mMemberFunction(function)
{
mImpl = new CallbackBase::Impl;
- if( mImpl )
+ if(mImpl)
{
- mImpl->mObjectPointer = object;
+ mImpl->mObjectPointer = object;
mImpl->mMemberFunctionDispatcher = dispatcher;
- mImpl->mDestructorDispatcher = destructor; // object is owned
+ mImpl->mDestructorDispatcher = destructor; // object is owned
}
}
void CallbackBase::Reset()
{
- if( mImpl )
+ if(mImpl)
{
// if destructor function is set it means we own this object
- if ( mImpl->mObjectPointer &&
- mImpl->mDestructorDispatcher )
+ if(mImpl->mObjectPointer &&
+ mImpl->mDestructorDispatcher)
{
// call the destructor dispatcher
- (*mImpl->mDestructorDispatcher)( mImpl->mObjectPointer );
+ (*mImpl->mDestructorDispatcher)(mImpl->mObjectPointer);
}
delete mImpl;
// CallbackBase::Impl
CallbackBase::Impl::Impl()
-: mObjectPointer( nullptr ),
- mMemberFunctionDispatcher( nullptr ),
- mDestructorDispatcher( nullptr )
+: mObjectPointer(nullptr),
+ mMemberFunctionDispatcher(nullptr),
+ mDestructorDispatcher(nullptr)
{
}
// Non-member equality operator
-bool operator==( const CallbackBase& lhs, const CallbackBase& rhs )
+bool operator==(const CallbackBase& lhs, const CallbackBase& rhs)
{
- if( lhs.mImpl )
+ if(lhs.mImpl)
{
// check it's the same member function / object
- return ( lhs.mFunction == rhs.mFunction ) && ( lhs.mImpl->mObjectPointer == rhs.mImpl->mObjectPointer );
+ return (lhs.mFunction == rhs.mFunction) && (lhs.mImpl->mObjectPointer == rhs.mImpl->mObjectPointer);
}
else
{
// check if it the same C function or a static member function
- return ( lhs.mFunction == rhs.mFunction );
+ return (lhs.mFunction == rhs.mFunction);
}
}
-} // namespace DALI
+} // namespace Dali
#define DALI_CALLBACK_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
class DALI_CORE_API CallbackBase
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] callback The callback to call
*/
- static void Execute( CallbackBase& callback )
+ static void Execute(CallbackBase& callback)
{
// if we point to a function, we can call it directly
// otherwise call the dispatcher function that knows the real type of the object
// Note that this template dispatcher lives in client code so the library containing
// the code has to be loaded, otherwise we crash boom bang
- if( callback.mImpl && callback.mImpl->mObjectPointer )
+ if(callback.mImpl && callback.mImpl->mObjectPointer)
{
Dispatcher dispatcher = callback.mImpl->mMemberFunctionDispatcher;
- (*dispatcher)( callback );
+ (*dispatcher)(callback);
}
// its also possible to have a member function pointer to a CallbackProvider
// that has been deleted, so check if we have impl still
- else if( !callback.mImpl && callback.mFunction )
+ else if(!callback.mImpl && callback.mFunction)
{
(*(callback.mFunction))();
}
else
{
- DALI_ASSERT_ALWAYS( 0 && "no function to execute" );
+ DALI_ASSERT_ALWAYS(0 && "no function to execute");
}
}
* @param[in] callback The callback to call
* @return The value from the function
*/
- template< typename R >
- static R ExecuteReturn( CallbackBase& callback )
+ template<typename R>
+ static R ExecuteReturn(CallbackBase& callback)
{
R returnVal = R();
// if we point to a function, we can call it directly
// otherwise call the dispatcher function that knows the real type of the object
// Note that this template dispatcher lives in client code so the library containing
// the code has to be loaded, otherwise we crash boom bang
- if( callback.mImpl && callback.mImpl->mObjectPointer )
+ if(callback.mImpl && callback.mImpl->mObjectPointer)
{
- using Dispatcher = R ( * )( CallbackBase& );
- Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
- returnVal = (*dispatcher)( callback );
+ using Dispatcher = R (*)(CallbackBase&);
+ Dispatcher dispatcher = reinterpret_cast<Dispatcher>(callback.mImpl->mMemberFunctionDispatcher);
+ returnVal = (*dispatcher)(callback);
}
- else if( !callback.mImpl && callback.mFunction )
+ else if(!callback.mImpl && callback.mFunction)
{
- using Function1 = R ( * )();
- returnVal = (*(reinterpret_cast< Function1 >( callback.mFunction )))();
+ using Function1 = R (*)();
+ returnVal = (*(reinterpret_cast<Function1>(callback.mFunction)))();
}
return returnVal;
* @param[in] callback The callback to call
* @param[in] param1 The first parameter to pass into the function
*/
- template< typename P1 >
- static void Execute( CallbackBase& callback, P1 param1 )
+ template<typename P1>
+ static void Execute(CallbackBase& callback, P1 param1)
{
// if we point to a function, we can call it directly
// otherwise call the dispatcher function that knows the real type of the object
// Note that this template dispatcher lives in client code (where the callback was created)
// so the library containing the code has to be loaded, otherwise we crash boom bang
- if( callback.mImpl && callback.mImpl->mObjectPointer )
+ if(callback.mImpl && callback.mImpl->mObjectPointer)
{
- using Dispatcher = void ( * )( CallbackBase&, P1 );
- Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
- (*dispatcher)( callback, param1 );
+ using Dispatcher = void (*)(CallbackBase&, P1);
+ Dispatcher dispatcher = reinterpret_cast<Dispatcher>(callback.mImpl->mMemberFunctionDispatcher);
+ (*dispatcher)(callback, param1);
}
- else if( !callback.mImpl && callback.mFunction )
+ else if(!callback.mImpl && callback.mFunction)
{
// convert function type
- using Function1 = void ( * )( P1 );
- (*(reinterpret_cast< Function1 >( callback.mFunction )))( param1 );
+ using Function1 = void (*)(P1);
+ (*(reinterpret_cast<Function1>(callback.mFunction)))(param1);
}
}
* @param[in] param1 The first parameter to pass into the function
* @return The value from the function
*/
- template< typename R, typename P1 >
- static R ExecuteReturn( CallbackBase& callback, P1 param1 )
+ template<typename R, typename P1>
+ static R ExecuteReturn(CallbackBase& callback, P1 param1)
{
- R returnVal = R();
+ R returnVal = R();
// if we point to a function, we can call it directly
// otherwise call the dispatcher function that knows the real type of the object
// Note that this template dispatcher lives in client code (where the callback was created)
// so the library containing the code has to be loaded, otherwise we crash boom bang
- if( callback.mImpl && callback.mImpl->mObjectPointer )
+ if(callback.mImpl && callback.mImpl->mObjectPointer)
{
- using Dispatcher = R ( * )( CallbackBase&, P1 );
- Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
- returnVal = (*dispatcher)( callback, param1 );
+ using Dispatcher = R (*)(CallbackBase&, P1);
+ Dispatcher dispatcher = reinterpret_cast<Dispatcher>(callback.mImpl->mMemberFunctionDispatcher);
+ returnVal = (*dispatcher)(callback, param1);
}
- else if( !callback.mImpl && callback.mFunction )
+ else if(!callback.mImpl && callback.mFunction)
{
// convert function type
- using Function1 = R ( * )( P1 );
- returnVal = (*(reinterpret_cast< Function1 >( callback.mFunction )))( param1 );
+ using Function1 = R (*)(P1);
+ returnVal = (*(reinterpret_cast<Function1>(callback.mFunction)))(param1);
}
return returnVal;
* @param[in] param1 The first parameter to pass into the function
* @param[in] param2 The second parameter to pass into the function
*/
- template< typename P1, typename P2 >
- static void Execute( CallbackBase& callback, P1 param1, P2 param2 )
+ template<typename P1, typename P2>
+ static void Execute(CallbackBase& callback, P1 param1, P2 param2)
{
// if we point to a function, we can call it directly
// otherwise call the dispatcher function that knows the real type of the object
// Note that this template dispatcher lives in client code (where the callback was created)
// so the library containing the code has to be loaded, otherwise we crash boom bang
- if( callback.mImpl && callback.mImpl->mObjectPointer )
+ if(callback.mImpl && callback.mImpl->mObjectPointer)
{
- using Dispatcher = void ( * )( CallbackBase&, P1, P2 );
- Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
- (*dispatcher)( callback, param1, param2 );
+ using Dispatcher = void (*)(CallbackBase&, P1, P2);
+ Dispatcher dispatcher = reinterpret_cast<Dispatcher>(callback.mImpl->mMemberFunctionDispatcher);
+ (*dispatcher)(callback, param1, param2);
}
- else if( !callback.mImpl && callback.mFunction )
+ else if(!callback.mImpl && callback.mFunction)
{
// convert function type
- using Function2 = void ( * )( P1, P2 );
- (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2 );
+ using Function2 = void (*)(P1, P2);
+ (*(reinterpret_cast<Function2>(callback.mFunction)))(param1, param2);
}
}
* @param[in] param2 The second parameter to pass into the function
* @return The return value from the function
*/
- template< typename R, typename P1, typename P2 >
- static R ExecuteReturn( CallbackBase& callback, P1 param1, P2 param2 )
+ template<typename R, typename P1, typename P2>
+ static R ExecuteReturn(CallbackBase& callback, P1 param1, P2 param2)
{
- R returnVal= R();
+ R returnVal = R();
// if we point to a function, we can call it directly
// otherwise call the dispatcher function that knows the real type of the object
// Note that this template dispatcher lives in client code (where the callback was created)
// so the library containing the code has to be loaded, otherwise we crash boom bang
- if( callback.mImpl && callback.mImpl->mObjectPointer )
+ if(callback.mImpl && callback.mImpl->mObjectPointer)
{
- using Dispatcher = R ( * )( CallbackBase&, P1, P2 );
- Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
- returnVal = (*dispatcher)( callback, param1, param2 );
+ using Dispatcher = R (*)(CallbackBase&, P1, P2);
+ Dispatcher dispatcher = reinterpret_cast<Dispatcher>(callback.mImpl->mMemberFunctionDispatcher);
+ returnVal = (*dispatcher)(callback, param1, param2);
}
- else if( !callback.mImpl && callback.mFunction )
+ else if(!callback.mImpl && callback.mFunction)
{
// convert function type
- using Function2 = R ( * )( P1, P2 );
- returnVal = (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2 );
+ using Function2 = R (*)(P1, P2);
+ returnVal = (*(reinterpret_cast<Function2>(callback.mFunction)))(param1, param2);
}
return returnVal;
* @param[in] param2 The second parameter to pass into the function
* @param[in] param3 The third parameter to pass into the function
*/
- template< typename P1, typename P2, typename P3 >
- static void Execute( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
+ template<typename P1, typename P2, typename P3>
+ static void Execute(CallbackBase& callback, P1 param1, P2 param2, P3 param3)
{
// if we point to a function, we can call it directly
// otherwise call the dispatcher function that knows the real type of the object
// Note that this template dispatcher lives in client code (where the callback was created)
// so the library containing the code has to be loaded, otherwise we crash boom bang
- if( callback.mImpl && callback.mImpl->mObjectPointer )
+ if(callback.mImpl && callback.mImpl->mObjectPointer)
{
- using Dispatcher = void ( * )( CallbackBase&, P1, P2, P3 );
- Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
- (*dispatcher)( callback, param1, param2, param3 );
+ using Dispatcher = void (*)(CallbackBase&, P1, P2, P3);
+ Dispatcher dispatcher = reinterpret_cast<Dispatcher>(callback.mImpl->mMemberFunctionDispatcher);
+ (*dispatcher)(callback, param1, param2, param3);
}
- else if( !callback.mImpl && callback.mFunction )
+ else if(!callback.mImpl && callback.mFunction)
{
// convert function type
- using Function2 = void ( * )( P1, P2, P3 );
- (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2, param3 );
+ using Function2 = void (*)(P1, P2, P3);
+ (*(reinterpret_cast<Function2>(callback.mFunction)))(param1, param2, param3);
}
}
* @param[in] param3 The third parameter to pass into the function
* @return The return value from the function
*/
- template< typename R, typename P1, typename P2, typename P3 >
- static R ExecuteReturn( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
+ template<typename R, typename P1, typename P2, typename P3>
+ static R ExecuteReturn(CallbackBase& callback, P1 param1, P2 param2, P3 param3)
{
- R returnVal= R();
+ R returnVal = R();
// if we point to a function, we can call it directly
// otherwise call the dispatcher function that knows the real type of the object
// Note that this template dispatcher lives in client code (where the callback was created)
// so the library containing the code has to be loaded, otherwise we crash boom bang
- if( callback.mImpl && callback.mImpl->mObjectPointer )
+ if(callback.mImpl && callback.mImpl->mObjectPointer)
{
- using Dispatcher = R ( * )( CallbackBase&, P1, P2, P3 );
- Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
- returnVal = (*dispatcher)( callback, param1, param2, param3 );
+ using Dispatcher = R (*)(CallbackBase&, P1, P2, P3);
+ Dispatcher dispatcher = reinterpret_cast<Dispatcher>(callback.mImpl->mMemberFunctionDispatcher);
+ returnVal = (*dispatcher)(callback, param1, param2, param3);
}
- else if( !callback.mImpl && callback.mFunction )
+ else if(!callback.mImpl && callback.mFunction)
{
// convert function type
- using Function2 = R ( * )( P1, P2, P3 );
- returnVal = (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2, param3 );
+ using Function2 = R (*)(P1, P2, P3);
+ returnVal = (*(reinterpret_cast<Function2>(callback.mFunction)))(param1, param2, param3);
}
return returnVal;
}
protected: // Constructors for deriving classes
-
/**
* @brief Function with static linkage.
* @SINCE_1_0.0
*/
- using Function = void ( * )();
+ using Function = void (*)();
/**
* @brief Member function.
* @SINCE_1_0.0
*/
- using MemberFunction = void ( CallbackBase::* )();
+ using MemberFunction = void (CallbackBase::*)();
/**
* @brief Used to call the correct member function.
* @SINCE_1_0.0
*/
- using Dispatcher = void ( * )( CallbackBase& );
+ using Dispatcher = void (*)(CallbackBase&);
/**
* @brief Used to destroy mObjectPointer (NULL if not mObjectPointer is not owned).
* @SINCE_1_0.0
*/
- using Destructor = void ( * )( void* );
+ using Destructor = void (*)(void*);
/**
* @brief Copy constructor operator not declared.
* @SINCE_1_0.0
* @param[in] rhs Handle to an object
*/
- CallbackBase( const CallbackBase& rhs );
+ CallbackBase(const CallbackBase& rhs);
/**
* @brief Assignment operator not declared.
* @param[in] rhs Handle to an object
* @return A reference to this
*/
- CallbackBase& operator=( const CallbackBase& rhs );
+ CallbackBase& operator=(const CallbackBase& rhs);
/**
* @brief Constructor for function with static linkage.
* @SINCE_1_0.0
* @param[in] function The function to call
*/
- CallbackBase( Function function );
+ CallbackBase(Function function);
/**
* @brief Constructor for member function.
* @param[in] function The member function of the object
* @param[in] dispatcher Used to call the actual object
*/
- CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher );
+ CallbackBase(void* object, MemberFunction function, Dispatcher dispatcher);
/**
* @brief Constructor for member function.
* @param dispatcher Used to call the actual object
* @param destructor Used to delete the owned object
*/
- CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor );
+ CallbackBase(void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor);
public: // Data for deriving classes & Dispatchers
-
/**
* @brief Struct to hold the extra data needed for member functions.
* @SINCE_1_0.0
*/
struct Impl
{
- Impl(); ///< Default constructor @SINCE_1_0.0
+ Impl(); ///< Default constructor @SINCE_1_0.0
- void* mObjectPointer; ///< Object whose member function will be called. Not owned if mDestructorDispatcher is NULL.
+ void* mObjectPointer; ///< Object whose member function will be called. Not owned if mDestructorDispatcher is NULL.
Dispatcher mMemberFunctionDispatcher; ///< Dispatcher for member functions
Destructor mDestructorDispatcher; ///< Destructor for owned objects. NULL if mDestructorDispatcher is not owned.
};
- Impl* mImpl; ///< Implementation pointer
+ Impl* mImpl; ///< Implementation pointer
union
{
- MemberFunction mMemberFunction; ///< Pointer to member function
- Function mFunction; ///< Static function
+ MemberFunction mMemberFunction; ///< Pointer to member function
+ Function mFunction; ///< Static function
};
};
* @param[in] rhs A reference to compare to
* @return True if lhs is same as rhs
*/
-bool operator==( const CallbackBase& lhs, const CallbackBase& rhs );
+bool operator==(const CallbackBase& lhs, const CallbackBase& rhs);
/**
* @brief Dispatcher to delete an object.
* @SINCE_1_0.0
*/
-template< class T >
+template<class T>
struct Destroyer
{
/**
* @SINCE_1_0.0
* @param[in] object An object to delete
*/
- static void Delete( void* object )
+ static void Delete(void* object)
{
// CallbackBase owns the object but we're the only one who knows the real type so need
// to delete by "downcasting" from void* to the correct type
- delete reinterpret_cast< T* >( object );
+ delete reinterpret_cast<T*>(object);
}
};
* @brief Dispatcher to call the actual member function.
* @SINCE_1_0.0
*/
-template< class T >
+template<class T>
struct Dispatcher0
{
/**
* @SINCE_1_0.0
* @param[in] callback The callback information
*/
- static void Dispatch( CallbackBase& callback )
+ static void Dispatch(CallbackBase& callback)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)();
}
};
* @brief Dispatcher to call the actual member function.
* @SINCE_1_0.0
*/
-template< class T, typename P1 >
+template<class T, typename P1>
struct Dispatcher1
{
/**
* @param[in] callback The callback information
* @param[in] param1 The first parameter to pass to the real member function
*/
- static void Dispatch( CallbackBase& callback, P1 param1 )
+ static void Dispatch(CallbackBase& callback, P1 param1)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )( P1 );
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
- (object->*function)( param1 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)(P1);
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
+ (object->*function)(param1);
}
};
* @brief Dispatcher to call the actual member function.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2 >
+template<class T, typename P1, typename P2>
struct Dispatcher2
{
/**
* @param[in] param1 The first parameter to pass to the real member function
* @param[in] param2 The second parameter to pass to the real member function
*/
- static void Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
+ static void Dispatch(CallbackBase& callback, P1 param1, P2 param2)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )( P1, P2 );
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
- (object->*function)( param1, param2 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)(P1, P2);
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
+ (object->*function)(param1, param2);
}
};
* @brief Dispatcher to call the actual member function.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2, typename P3 >
+template<class T, typename P1, typename P2, typename P3>
struct Dispatcher3
{
/**
* @param[in] param2 The second parameter to pass to the real member function
* @param[in] param3 The third parameter to pass to the real member function
*/
- static void Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
+ static void Dispatch(CallbackBase& callback, P1 param1, P2 param2, P3 param3)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )( P1, P2, P3 );
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
- (object->*function)( param1, param2, param3 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)(P1, P2, P3);
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
+ (object->*function)(param1, param2, param3);
}
};
* @brief Dispatcher to call the actual member function.
* @SINCE_1_0.0
*/
-template< class T, typename R >
+template<class T, typename R>
struct DispatcherReturn0
{
/**
* @param[in] callback The callback information
* @return The value
*/
- static R Dispatch( CallbackBase& callback )
+ static R Dispatch(CallbackBase& callback)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = R ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = R (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
return (object->*function)();
}
};
* @brief Dispatcher to call the actual member function.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1 >
+template<class T, typename R, typename P1>
struct DispatcherReturn1
{
/**
* @param[in] param1 The first parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1 )
+ static R Dispatch(CallbackBase& callback, P1 param1)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = R ( T::* )( P1 );
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
- return (object->*function)( param1 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = R (T::*)(P1);
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
+ return (object->*function)(param1);
}
};
* @brief Dispatcher to call the actual member function.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1, typename P2 >
+template<class T, typename R, typename P1, typename P2>
struct DispatcherReturn2
{
/**
* @param[in] param2 The second parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
+ static R Dispatch(CallbackBase& callback, P1 param1, P2 param2)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = R ( T::* )( P1, P2 );
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
- return (object->*function)( param1, param2 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = R (T::*)(P1, P2);
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
+ return (object->*function)(param1, param2);
}
};
* @brief Dispatcher to call the actual member function.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1, typename P2, typename P3 >
+template<class T, typename R, typename P1, typename P2, typename P3>
struct DispatcherReturn3
{
/**
* @param[in] param3 The third parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
+ static R Dispatch(CallbackBase& callback, P1 param1, P2 param2, P3 param3)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = R ( T::* )( P1, P2, P3 );
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
- return (object->*function)( param1, param2, param3 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = R (T::*)(P1, P2, P3);
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
+ return (object->*function)(param1, param2, param3);
}
};
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< class T >
+template<class T>
struct FunctorDispatcher0
{
/**
* @SINCE_1_0.0
* @param[in] callback The callback information
*/
- static void Dispatch( CallbackBase& callback )
+ static void Dispatch(CallbackBase& callback)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
(*object)();
}
};
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< class T, typename P1 >
+template<class T, typename P1>
struct FunctorDispatcher1
{
/**
* @param[in] callback The callback information
* @param[in] param1 The first parameter to pass to the real member function.
*/
- static void Dispatch( CallbackBase& callback, P1 param1 )
+ static void Dispatch(CallbackBase& callback, P1 param1)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- (*object)( param1 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ (*object)(param1);
}
};
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2 >
+template<class T, typename P1, typename P2>
struct FunctorDispatcher2
{
/**
* @param[in] param1 The first parameter to pass to the real member function
* @param[in] param2 The second parameter to pass to the real member function
*/
- static void Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
+ static void Dispatch(CallbackBase& callback, P1 param1, P2 param2)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- (*object)( param1, param2 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ (*object)(param1, param2);
}
};
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2, typename P3 >
+template<class T, typename P1, typename P2, typename P3>
struct FunctorDispatcher3
{
/**
* @param[in] param2 The second parameter to pass to the real member function
* @param[in] param3 The third parameter to pass to the real member function
*/
- static void Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
+ static void Dispatch(CallbackBase& callback, P1 param1, P2 param2, P3 param3)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- (*object)( param1, param2, param3 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ (*object)(param1, param2, param3);
}
};
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< class T, typename R >
+template<class T, typename R>
struct FunctorDispatcherReturn0
{
/**
* @param[in] callback The callback information
* @return The value
*/
- static R Dispatch( CallbackBase& callback )
+ static R Dispatch(CallbackBase& callback)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
return (*object)();
}
};
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1 >
+template<class T, typename R, typename P1>
struct FunctorDispatcherReturn1
{
/**
* @param[in] param1 The first parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1 )
+ static R Dispatch(CallbackBase& callback, P1 param1)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- return (*object)( param1 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ return (*object)(param1);
}
};
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1, typename P2 >
+template<class T, typename R, typename P1, typename P2>
struct FunctorDispatcherReturn2
{
/**
* @param[in] param2 The second parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
+ static R Dispatch(CallbackBase& callback, P1 param1, P2 param2)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- return (*object)( param1, param2 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ return (*object)(param1, param2);
}
};
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1, typename P2, typename P3 >
+template<class T, typename R, typename P1, typename P2, typename P3>
struct FunctorDispatcherReturn3
{
/**
* @param[in] param3 The third parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
+ static R Dispatch(CallbackBase& callback, P1 param1, P2 param2, P3 param3)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- return (*object)( param1, param2, param3 );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ return (*object)(param1, param2, param3);
}
};
* This variant calls a specific void() member function.
* @SINCE_1_0.0
*/
-template< class T >
+template<class T>
struct VoidFunctorDispatcher0
{
/**
* @SINCE_1_0.0
* @param[in] callback The callback information
*/
- static void Dispatch( CallbackBase& callback )
+ static void Dispatch(CallbackBase& callback)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)();
}
};
* This variant calls a void() member, ignoring any signal parameters.
* @SINCE_1_0.0
*/
-template< class T, typename P1 >
+template<class T, typename P1>
struct VoidFunctorDispatcher1
{
/**
* @param[in] callback The callback information
* @param[in] param1 The first parameter to pass to the real member function
*/
- static void Dispatch( CallbackBase& callback, P1 param1 )
+ static void Dispatch(CallbackBase& callback, P1 param1)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)(/*ignore params*/);
}
};
* This variant calls a void() member, ignoring any signal parameters.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2 >
+template<class T, typename P1, typename P2>
struct VoidFunctorDispatcher2
{
/**
* @param[in] param1 The first parameter to pass to the real member function
* @param[in] param2 The second parameter to pass to the real member function
*/
- static void Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
+ static void Dispatch(CallbackBase& callback, P1 param1, P2 param2)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)(/*ignore params*/);
}
};
* This variant calls a void() member, ignoring any signal parameters.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2, typename P3 >
+template<class T, typename P1, typename P2, typename P3>
struct VoidFunctorDispatcher3
{
/**
* @param[in] param2 The second parameter to pass to the real member function
* @param[in] param3 The third parameter to pass to the real member function
*/
- static void Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
+ static void Dispatch(CallbackBase& callback, P1 param1, P2 param2, P3 param3)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)(/*ignore params*/);
}
};
* This variant calls a void() member, and returns a default-constructed value.
* @SINCE_1_0.0
*/
-template< class T, typename R >
+template<class T, typename R>
struct VoidFunctorDispatcherReturn0
{
/**
* @param[in] callback The callback information
* @return The value
*/
- static R Dispatch( CallbackBase& callback )
+ static R Dispatch(CallbackBase& callback)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)(/*ignore params*/);
return R();
}
* This variant calls a void() member, and returns a default-constructed value.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1 >
+template<class T, typename R, typename P1>
struct VoidFunctorDispatcherReturn1
{
/**
* @param[in] param1 The first parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1 )
+ static R Dispatch(CallbackBase& callback, P1 param1)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)(/*ignore params*/);
return R();
}
* This variant calls a void() member, and returns a default-constructed value.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1, typename P2 >
+template<class T, typename R, typename P1, typename P2>
struct VoidFunctorDispatcherReturn2
{
/**
* @param[in] param2 The second parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
+ static R Dispatch(CallbackBase& callback, P1 param1, P2 param2)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)(/*ignore params*/);
return R();
}
* This variant calls a void() member, and returns a default-constructed value.
* @SINCE_1_0.0
*/
-template< class T, typename R, typename P1, typename P2, typename P3 >
+template<class T, typename R, typename P1, typename P2, typename P3>
struct VoidFunctorDispatcherReturn3
{
/**
* @param[in] param3 The third parameter to pass to the real member function
* @return The return value from the function
*/
- static R Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
+ static R Dispatch(CallbackBase& callback, P1 param1, P2 param2, P3 param3)
{
// "downcast" the object and function type back to the correct ones
- T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
- using MemberFunction = void ( T::* )();
- MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
+ T* object = reinterpret_cast<T*>(callback.mImpl->mObjectPointer);
+ using MemberFunction = void (T::*)();
+ MemberFunction function = reinterpret_cast<MemberFunction>(callback.mMemberFunction);
(object->*function)(/*ignore params*/);
return R();
}
* Version with two parameters and return value.
* @SINCE_1_0.0
*/
-template< class T >
+template<class T>
class Callback : public CallbackBase
{
public:
-
/**
* @brief Default constructor.
*
* @param[in] object The object to call
* @param[in] memberFunction The member function of the object
*/
- Callback( T* object, void(T::*memberFunction)(void) )
- : CallbackBase( object,
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher0<T>::Dispatch ) ) { }
- template< typename P1 >
- Callback( T* object, void(T::*memberFunction)(P1) )
- : CallbackBase( object,
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher1<T,P1>::Dispatch ) ) { }
- template< typename P1, typename P2 >
- Callback( T* object, void(T::*memberFunction)(P1, P2) )
- : CallbackBase( object,
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher2<T,P1,P2>::Dispatch ) ) { }
- template< typename P1, typename P2, typename P3 >
- Callback( T* object, void(T::*memberFunction)(P1, P2, P3) )
- : CallbackBase( object,
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher3<T,P1,P2,P3>::Dispatch ) ) { }
- template< typename R >
- Callback( T* object, R(T::*memberFunction)(void) )
- : CallbackBase( object,
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &DispatcherReturn0<T,R>::Dispatch ) ) { }
- template< typename R, typename P1 >
- Callback( T* object, R(T::*memberFunction)(P1) )
- : CallbackBase( object,
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &DispatcherReturn1<T,R,P1>::Dispatch ) ) { }
- template< typename R, typename P1, typename P2 >
- Callback( T* object, R(T::*memberFunction)(P1, P2) )
- : CallbackBase( object,
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &DispatcherReturn2<T,R,P1,P2>::Dispatch ) ) { }
- template< typename R, typename P1, typename P2, typename P3 >
- Callback( T* object, R(T::*memberFunction)(P1, P2, P3) )
- : CallbackBase( object,
- reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
- reinterpret_cast< CallbackBase::Dispatcher >( &DispatcherReturn3<T,R,P1,P2,P3>::Dispatch ) ) { }
-
+ Callback(T* object, void (T::*memberFunction)(void))
+ : CallbackBase(object,
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&Dispatcher0<T>::Dispatch))
+ {
+ }
+ template<typename P1>
+ Callback(T* object, void (T::*memberFunction)(P1))
+ : CallbackBase(object,
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&Dispatcher1<T, P1>::Dispatch))
+ {
+ }
+ template<typename P1, typename P2>
+ Callback(T* object, void (T::*memberFunction)(P1, P2))
+ : CallbackBase(object,
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&Dispatcher2<T, P1, P2>::Dispatch))
+ {
+ }
+ template<typename P1, typename P2, typename P3>
+ Callback(T* object, void (T::*memberFunction)(P1, P2, P3))
+ : CallbackBase(object,
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&Dispatcher3<T, P1, P2, P3>::Dispatch))
+ {
+ }
+ template<typename R>
+ Callback(T* object, R (T::*memberFunction)(void))
+ : CallbackBase(object,
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&DispatcherReturn0<T, R>::Dispatch))
+ {
+ }
+ template<typename R, typename P1>
+ Callback(T* object, R (T::*memberFunction)(P1))
+ : CallbackBase(object,
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&DispatcherReturn1<T, R, P1>::Dispatch))
+ {
+ }
+ template<typename R, typename P1, typename P2>
+ Callback(T* object, R (T::*memberFunction)(P1, P2))
+ : CallbackBase(object,
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&DispatcherReturn2<T, R, P1, P2>::Dispatch))
+ {
+ }
+ template<typename R, typename P1, typename P2, typename P3>
+ Callback(T* object, R (T::*memberFunction)(P1, P2, P3))
+ : CallbackBase(object,
+ reinterpret_cast<CallbackBase::MemberFunction>(memberFunction),
+ reinterpret_cast<CallbackBase::Dispatcher>(&DispatcherReturn3<T, R, P1, P2, P3>::Dispatch))
+ {
+ }
};
/**
class CallbackFunction : public CallbackBase
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] function The function to call
*/
- CallbackFunction( void(*function)() )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
- { }
- template< typename R >
- CallbackFunction( R(*function)() )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
- { }
- template< typename P1 >
- CallbackFunction( void(*function)(P1) )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
- { }
- template< typename P1, typename R >
- CallbackFunction( R(*function)(P1) )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
- { }
- template< typename P1, typename P2 >
- CallbackFunction( void(*function)(P1,P2) )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
- { }
- template< typename P1, typename P2, typename R >
- CallbackFunction( R(*function)(P1,P2) )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
- { }
- template< typename P1, typename P2, typename P3 >
- CallbackFunction( void(*function)(P1,P2,P3) )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
- { }
- template< typename P1, typename P2, typename P3, typename R >
- CallbackFunction( R(*function)(P1,P2,P3) )
- : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
- { }
-
+ CallbackFunction(void (*function)())
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function))
+ {
+ }
+ template<typename R>
+ CallbackFunction(R (*function)())
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function))
+ {
+ }
+ template<typename P1>
+ CallbackFunction(void (*function)(P1))
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function))
+ {
+ }
+ template<typename P1, typename R>
+ CallbackFunction(R (*function)(P1))
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function))
+ {
+ }
+ template<typename P1, typename P2>
+ CallbackFunction(void (*function)(P1, P2))
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function))
+ {
+ }
+ template<typename P1, typename P2, typename R>
+ CallbackFunction(R (*function)(P1, P2))
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function))
+ {
+ }
+ template<typename P1, typename P2, typename P3>
+ CallbackFunction(void (*function)(P1, P2, P3))
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function))
+ {
+ }
+ template<typename P1, typename P2, typename P3, typename R>
+ CallbackFunction(R (*function)(P1, P2, P3))
+ : CallbackBase(reinterpret_cast<CallbackBase::Function>(function))
+ {
+ }
};
/**
* @brief Specializations for function object callbacks.
* @SINCE_1_0.0
*/
-template< class T >
+template<class T>
class CallbackFunctor0 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctor0( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- NULL, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher0<T>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
+ CallbackFunctor0(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ NULL, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcher0<T>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete))
+ {
+ }
};
/**
class CallbackFunctorDelegate0 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object A newly allocated object (ownership is transferred)
*/
- CallbackFunctorDelegate0( FunctorDelegate* object )
- : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
- reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
- reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcher0<FunctorDelegate>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
+ CallbackFunctorDelegate0(FunctorDelegate* object)
+ : CallbackBase(reinterpret_cast<void*>(object), // transfer ownership
+ reinterpret_cast<CallbackBase::MemberFunction>(&FunctorDelegate::Execute),
+ reinterpret_cast<CallbackBase::Dispatcher>(&VoidFunctorDispatcher0<FunctorDelegate>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<FunctorDelegate>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for matching callbacks to signal signature.
* @SINCE_1_0.0
*/
-template< class T, typename P1 >
+template<class T, typename P1>
class CallbackFunctor1 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctor1( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- NULL, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher1<T,P1>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
+ CallbackFunctor1(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ NULL, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcher1<T, P1>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for connecting void() methods.
* @SINCE_1_0.0
*/
-template< typename P1 >
+template<typename P1>
class CallbackFunctorDelegate1 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorDelegate1( FunctorDelegate* object )
- : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
- reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
- reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcher1<FunctorDelegate,P1>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
+ CallbackFunctorDelegate1(FunctorDelegate* object)
+ : CallbackBase(reinterpret_cast<void*>(object), // transfer ownership
+ reinterpret_cast<CallbackBase::MemberFunction>(&FunctorDelegate::Execute),
+ reinterpret_cast<CallbackBase::Dispatcher>(&VoidFunctorDispatcher1<FunctorDelegate, P1>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<FunctorDelegate>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for matching callbacks to signal signature.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2 >
+template<class T, typename P1, typename P2>
class CallbackFunctor2 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctor2( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- NULL, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher2<T,P1,P2>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
+ CallbackFunctor2(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ NULL, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcher2<T, P1, P2>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for connecting void() methods.
* @SINCE_1_0.0
*/
-template< typename P1, typename P2 >
+template<typename P1, typename P2>
class CallbackFunctorDelegate2 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorDelegate2( FunctorDelegate* object )
- : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
- reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
- reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcher2<FunctorDelegate,P1,P2>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
+ CallbackFunctorDelegate2(FunctorDelegate* object)
+ : CallbackBase(reinterpret_cast<void*>(object), // transfer ownership
+ reinterpret_cast<CallbackBase::MemberFunction>(&FunctorDelegate::Execute),
+ reinterpret_cast<CallbackBase::Dispatcher>(&VoidFunctorDispatcher2<FunctorDelegate, P1, P2>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<FunctorDelegate>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for matching callbacks to signal signature.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2, typename P3 >
+template<class T, typename P1, typename P2, typename P3>
class CallbackFunctor3 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctor3( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- NULL, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher3<T,P1,P2,P3>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
+ CallbackFunctor3(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ NULL, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcher3<T, P1, P2, P3>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for connecting void() methods.
* @SINCE_1_0.0
*/
-template< typename P1, typename P2, typename P3 >
+template<typename P1, typename P2, typename P3>
class CallbackFunctorDelegate3 : public CallbackBase
{
public:
-
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorDelegate3( FunctorDelegate* object )
- : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
- reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
- reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcher3<FunctorDelegate,P1,P2,P3>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
+ CallbackFunctorDelegate3(FunctorDelegate* object)
+ : CallbackBase(reinterpret_cast<void*>(object), // transfer ownership
+ reinterpret_cast<CallbackBase::MemberFunction>(&FunctorDelegate::Execute),
+ reinterpret_cast<CallbackBase::Dispatcher>(&VoidFunctorDispatcher3<FunctorDelegate, P1, P2, P3>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<FunctorDelegate>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for matching callbacks to signal signature.
* @SINCE_1_0.0
*/
-template< class T, typename R >
+template<class T, typename R>
class CallbackFunctorReturn0 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorReturn0( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- NULL, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn0<T,R>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
+ CallbackFunctorReturn0(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ NULL, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcherReturn0<T, R>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for connecting void() methods.
* @SINCE_1_0.0
*/
-template< typename R >
+template<typename R>
class CallbackFunctorDelegateReturn0 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorDelegateReturn0( FunctorDelegate* object )
- : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
- reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
- reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcherReturn0<FunctorDelegate,R>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
+ CallbackFunctorDelegateReturn0(FunctorDelegate* object)
+ : CallbackBase(reinterpret_cast<void*>(object), // transfer ownership
+ reinterpret_cast<CallbackBase::MemberFunction>(&FunctorDelegate::Execute),
+ reinterpret_cast<CallbackBase::Dispatcher>(&VoidFunctorDispatcherReturn0<FunctorDelegate, R>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<FunctorDelegate>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for matching callbacks to signal signature.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename R >
+template<class T, typename P1, typename R>
class CallbackFunctorReturn1 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorReturn1( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- NULL, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn1<T,R,P1>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
+ CallbackFunctorReturn1(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ NULL, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcherReturn1<T, R, P1>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for connecting void() methods.
* @SINCE_1_0.0
*/
-template< typename P1, typename R >
+template<typename P1, typename R>
class CallbackFunctorDelegateReturn1 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorDelegateReturn1( FunctorDelegate* object )
- : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
- reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
- reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcherReturn1<FunctorDelegate,R,P1>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
+ CallbackFunctorDelegateReturn1(FunctorDelegate* object)
+ : CallbackBase(reinterpret_cast<void*>(object), // transfer ownership
+ reinterpret_cast<CallbackBase::MemberFunction>(&FunctorDelegate::Execute),
+ reinterpret_cast<CallbackBase::Dispatcher>(&VoidFunctorDispatcherReturn1<FunctorDelegate, R, P1>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<FunctorDelegate>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for matching callbacks to signal signature.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2, typename R >
+template<class T, typename P1, typename P2, typename R>
class CallbackFunctorReturn2 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorReturn2( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- NULL, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn2<T,R,P1,P2>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
+ CallbackFunctorReturn2(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ NULL, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcherReturn2<T, R, P1, P2>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for connecting void() methods.
* @SINCE_1_0.0
*/
-template< typename P1, typename P2, typename R >
+template<typename P1, typename P2, typename R>
class CallbackFunctorDelegateReturn2 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorDelegateReturn2( FunctorDelegate* object )
- : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
- reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
- reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcherReturn2<FunctorDelegate,R,P1,P2>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
+ CallbackFunctorDelegateReturn2(FunctorDelegate* object)
+ : CallbackBase(reinterpret_cast<void*>(object), // transfer ownership
+ reinterpret_cast<CallbackBase::MemberFunction>(&FunctorDelegate::Execute),
+ reinterpret_cast<CallbackBase::Dispatcher>(&VoidFunctorDispatcherReturn2<FunctorDelegate, R, P1, P2>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<FunctorDelegate>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for matching callbacks to signal signature.
* @SINCE_1_0.0
*/
-template< class T, typename P1, typename P2, typename P3, typename R >
+template<class T, typename P1, typename P2, typename P3, typename R>
class CallbackFunctorReturn3 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorReturn3( const T& object )
- : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
- NULL, // uses operator() instead of member function
- reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn3<T,R,P1,P2,P3>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
+ CallbackFunctorReturn3(const T& object)
+ : CallbackBase(reinterpret_cast<void*>(new T(object)), // copy the object
+ NULL, // uses operator() instead of member function
+ reinterpret_cast<CallbackBase::Dispatcher>(&FunctorDispatcherReturn3<T, R, P1, P2, P3>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<T>::Delete))
+ {
+ }
};
/**
* @brief Function object callback for connecting void() methods.
* @SINCE_1_0.0
*/
-template< typename P1, typename P2, typename P3, typename R >
+template<typename P1, typename P2, typename P3, typename R>
class CallbackFunctorDelegateReturn3 : public CallbackBase
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @SINCE_1_0.0
* @param[in] object The object to copy
*/
- CallbackFunctorDelegateReturn3( FunctorDelegate* object )
- : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
- reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
- reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcherReturn3<FunctorDelegate,R,P1,P2,P3>::Dispatch ),
- reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
+ CallbackFunctorDelegateReturn3(FunctorDelegate* object)
+ : CallbackBase(reinterpret_cast<void*>(object), // transfer ownership
+ reinterpret_cast<CallbackBase::MemberFunction>(&FunctorDelegate::Execute),
+ reinterpret_cast<CallbackBase::Dispatcher>(&VoidFunctorDispatcherReturn3<FunctorDelegate, R, P1, P2, P3>::Dispatch),
+ reinterpret_cast<CallbackBase::Destructor>(&Destroyer<FunctorDelegate>::Delete))
+ {
+ }
};
// Callback creation thin templates
* @param[in] function The function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-inline CallbackBase* MakeCallback( void(*function)(void) )
+inline CallbackBase* MakeCallback(void (*function)(void))
{
- return new CallbackFunction( function );
+ return new CallbackFunction(function);
}
/**
* @param[in] function The function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< typename P1 >
-inline CallbackBase* MakeCallback( void(*function)(P1) )
+template<typename P1>
+inline CallbackBase* MakeCallback(void (*function)(P1))
{
- return new CallbackFunction( function );
+ return new CallbackFunction(function);
}
/**
* @param[in] function The function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< typename R >
-inline CallbackBase* MakeCallback( R(*function)(void) )
+template<typename R>
+inline CallbackBase* MakeCallback(R (*function)(void))
{
- return new CallbackFunction( function );
+ return new CallbackFunction(function);
}
/**
* @param[in] function The function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< typename R, typename P1 >
-inline CallbackBase* MakeCallback( R(*function)(P1) )
+template<typename R, typename P1>
+inline CallbackBase* MakeCallback(R (*function)(P1))
{
- return new CallbackFunction( function );
+ return new CallbackFunction(function);
}
/**
* @param[in] function The function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< typename P1, typename P2 >
-inline CallbackBase* MakeCallback( void(*function)(P1,P2) )
+template<typename P1, typename P2>
+inline CallbackBase* MakeCallback(void (*function)(P1, P2))
{
- return new CallbackFunction( function );
+ return new CallbackFunction(function);
}
/**
* @param[in] function The function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< typename R, typename P1, typename P2 >
-inline CallbackBase* MakeCallback( R(*function)(P1,P2) )
+template<typename R, typename P1, typename P2>
+inline CallbackBase* MakeCallback(R (*function)(P1, P2))
{
- return new CallbackFunction( function );
+ return new CallbackFunction(function);
}
/**
* @param[in] function The function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< typename P1, typename P2, typename P3 >
-inline CallbackBase* MakeCallback( void(*function)(P1,P2,P3) )
+template<typename P1, typename P2, typename P3>
+inline CallbackBase* MakeCallback(void (*function)(P1, P2, P3))
{
- return new CallbackFunction( function );
+ return new CallbackFunction(function);
}
/**
* @param[in] function The function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< typename R, typename P1, typename P2, typename P3 >
-inline CallbackBase* MakeCallback( R(*function)(P1,P2,P3) )
+template<typename R, typename P1, typename P2, typename P3>
+inline CallbackBase* MakeCallback(R (*function)(P1, P2, P3))
{
- return new CallbackFunction( function );
+ return new CallbackFunction(function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T >
-inline CallbackBase* MakeCallback( T* object, void(T::*function)(void) )
+template<class T>
+inline CallbackBase* MakeCallback(T* object, void (T::*function)(void))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, typename P1 >
-inline CallbackBase* MakeCallback( T* object, void(T::*function)(P1) )
+template<class T, typename P1>
+inline CallbackBase* MakeCallback(T* object, void (T::*function)(P1))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, typename P1, typename P2 >
-inline CallbackBase* MakeCallback( T* object, void(T::*function)(P1,P2) )
+template<class T, typename P1, typename P2>
+inline CallbackBase* MakeCallback(T* object, void (T::*function)(P1, P2))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, typename P1, typename P2, typename P3 >
-inline CallbackBase* MakeCallback( T* object, void(T::*function)(P1,P2,P3) )
+template<class T, typename P1, typename P2, typename P3>
+inline CallbackBase* MakeCallback(T* object, void (T::*function)(P1, P2, P3))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, typename R >
-inline CallbackBase* MakeCallback( T* object, R(T::*function)() )
+template<class T, typename R>
+inline CallbackBase* MakeCallback(T* object, R (T::*function)())
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, typename P1, typename R >
-inline CallbackBase* MakeCallback( T* object, R(T::*function)(P1) )
+template<class T, typename P1, typename R>
+inline CallbackBase* MakeCallback(T* object, R (T::*function)(P1))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, typename P1, typename P2, typename R >
-inline CallbackBase* MakeCallback( T* object, R(T::*function)(P1,P2) )
+template<class T, typename P1, typename P2, typename R>
+inline CallbackBase* MakeCallback(T* object, R (T::*function)(P1, P2))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, typename P1, typename P2, typename P3, typename R >
-inline CallbackBase* MakeCallback( T* object, R(T::*function)(P1,P2,P3) )
+template<class T, typename P1, typename P2, typename P3, typename R>
+inline CallbackBase* MakeCallback(T* object, R (T::*function)(P1, P2, P3))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, class Base >
-inline CallbackBase* MakeCallback( T* object, void(Base::*function)(void) )
+template<class T, class Base>
+inline CallbackBase* MakeCallback(T* object, void (Base::*function)(void))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @brief Creates a callback from a class's parent member function with no parameters.
* @param[in] function The member function to call
* @return A newly allocated Callback object, ownership transferred to caller
*/
-template< class T, class Base >
-inline CallbackBase* MakeCallback( T& object, void(Base::*function)(void) )
+template<class T, class Base>
+inline CallbackBase* MakeCallback(T& object, void (Base::*function)(void))
{
- return new Callback< T >( object, function );
+ return new Callback<T>(object, function);
}
/**
* @}
*/
-} // namespace DALI
+} // namespace Dali
#endif // DALI_CALLBACK_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
ConnectionTrackerInterface::ConnectionTrackerInterface()
{
}
class DALI_CORE_API ConnectionTrackerInterface : public SignalObserver
{
public:
-
/**
* @brief Constructor.
* @SINCE_1_0.0
* @param[in] slotObserver The slot observer i.e. a signal. Ownership is not passed
* @param[in] callback The call back. Ownership is not passed
*/
- virtual void SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) = 0;
+ virtual void SignalConnected(SlotObserver* slotObserver, CallbackBase* callback) = 0;
private:
-
- ConnectionTrackerInterface( const ConnectionTrackerInterface& ) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
- ConnectionTrackerInterface( ConnectionTrackerInterface&& ) = delete; ///< Deleted move constructor. @SINCE_1_9.25
- ConnectionTrackerInterface& operator=( const ConnectionTrackerInterface& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
- ConnectionTrackerInterface& operator=( ConnectionTrackerInterface&& ) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
+ ConnectionTrackerInterface(const ConnectionTrackerInterface&) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
+ ConnectionTrackerInterface(ConnectionTrackerInterface&&) = delete; ///< Deleted move constructor. @SINCE_1_9.25
+ ConnectionTrackerInterface& operator=(const ConnectionTrackerInterface&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
+ ConnectionTrackerInterface& operator=(ConnectionTrackerInterface&&) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
};
/**
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/signals/connection-tracker.h>
#include <dali/public-api/signals/callback.h>
-#include <dali/public-api/signals/signal-slot-observers.h>
#include <dali/public-api/signals/signal-slot-connections.h>
+#include <dali/public-api/signals/signal-slot-observers.h>
namespace Dali
{
-
ConnectionTracker::ConnectionTracker()
{
}
{
std::size_t size = mConnections.Size();
- for( std::size_t i = 0; i< size; ++i )
+ for(std::size_t i = 0; i < size; ++i)
{
SlotConnection* connection = mConnections[i];
// Tell the signal that the slot is disconnected
- connection->GetSlotObserver()->SlotDisconnected( connection->GetCallback() );
+ connection->GetSlotObserver()->SlotDisconnected(connection->GetCallback());
delete connection;
}
mConnections.Clear();
}
-void ConnectionTracker::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
+void ConnectionTracker::SignalConnected(SlotObserver* slotObserver, CallbackBase* callback)
{
- SlotConnection* connection = new SlotConnection( slotObserver, callback );
- mConnections.PushBack( connection );
+ SlotConnection* connection = new SlotConnection(slotObserver, callback);
+ mConnections.PushBack(connection);
}
-void ConnectionTracker::SignalDisconnected( SlotObserver* signal, CallbackBase* callback )
+void ConnectionTracker::SignalDisconnected(SlotObserver* signal, CallbackBase* callback)
{
std::size_t size = mConnections.Size();
- for( std::size_t i = 0; i< size; ++i )
+ for(std::size_t i = 0; i < size; ++i)
{
SlotConnection* connection = mConnections[i];
// Pointer comparison i.e. SignalConnection contains pointer to same callback instance
- if( connection->GetCallback() == callback )
+ if(connection->GetCallback() == callback)
{
// Remove from connection list
- mConnections.Erase( mConnections.Begin() + i );
+ mConnections.Erase(mConnections.Begin() + i);
// Delete connection
delete connection;
}
}
- DALI_ABORT( "Callback lost in SignalDisconnected()" );
+ DALI_ABORT("Callback lost in SignalDisconnected()");
}
std::size_t ConnectionTracker::GetConnectionCount() const
class DALI_CORE_API ConnectionTracker : public ConnectionTrackerInterface
{
public:
-
/**
* @brief Constructor.
* @SINCE_1_0.0
/**
* @copydoc ConnectionTrackerInterface::SignalConnected
*/
- void SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) override;
+ void SignalConnected(SlotObserver* slotObserver, CallbackBase* callback) override;
/**
* @copydoc ConnectionTrackerInterface::SignalDisconnected
*/
- void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ) override;
+ void SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback) override;
/**
* @brief Returns the connection count.
std::size_t GetConnectionCount() const;
private:
-
- ConnectionTracker( const ConnectionTracker& ) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
- ConnectionTracker( ConnectionTracker&& ) = delete; ///< Deleted move constructor. @SINCE_1_9.25
- ConnectionTracker& operator=( const ConnectionTracker& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
- ConnectionTracker& operator=( ConnectionTracker&& ) = delete;///< Deleted move assignment operator. @SINCE_1_9.25
+ ConnectionTracker(const ConnectionTracker&) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
+ ConnectionTracker(ConnectionTracker&&) = delete; ///< Deleted move constructor. @SINCE_1_9.25
+ ConnectionTracker& operator=(const ConnectionTracker&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
+ ConnectionTracker& operator=(ConnectionTracker&&) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
private:
-
- Dali::Vector< SlotConnection* > mConnections; ///< Vector of connection pointers
+ Dali::Vector<SlotConnection*> mConnections; ///< Vector of connection pointers
};
/**
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/signals/base-signal.h>
#include <dali/public-api/signals/callback.h>
#include <dali/public-api/signals/signal-slot-connections.h>
#include <dali/public-api/signals/slot-delegate.h>
-#include <dali/public-api/signals/base-signal.h>
namespace Dali
{
* @endcode
* @SINCE_1_0.0
*/
-template< typename _Signature >
+template<typename _Signature>
class Signal
{
};
* @brief A template for Signals with no parameters or return value.
* @SINCE_1_0.0
*/
-template <>
-class Signal< void () >
+template<>
+class Signal<void()>
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
- void Connect( void (*func)() )
+ void Connect(void (*func)())
{
- mImpl.OnConnect( MakeCallback( func ) );
+ mImpl.OnConnect(MakeCallback(func));
}
/**
* @SINCE_1_0.0
* @param[in] func The function to disconnect
*/
- void Disconnect( void (*func)() )
+ void Disconnect(void (*func)())
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ mImpl.OnDisconnect(MakeCallback(func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, void (X::*func)() )
+ void Connect(X* obj, void (X::*func)())
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnConnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, void (X::*func)() )
+ void Disconnect(X* obj, void (X::*func)())
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnDisconnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, void (X::*func)() )
+ void Connect(SlotDelegate<X>& delegate, void (X::*func)())
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, void (X::*func)() )
+ void Disconnect(SlotDelegate<X>& delegate, void (X::*func)())
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctor0< X >( func ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctor0<X>(func));
}
/**
* @param[in] connectionTracker A connection tracker which can be used to disconnect
* @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegate0( delegate ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegate0(delegate));
}
/**
}
private:
-
- Signal( const Signal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal( Signal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=( const Signal& ) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=( Signal&& ) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
+ Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
+ Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
private:
-
// Use composition instead of inheritance (virtual methods don't mix well with templates)
BaseSignal mImpl; ///< The base signal implementation
};
* @brief A template for Signals with no parameters and a return value.
* @SINCE_1_0.0
*/
-template < typename Ret >
-class Signal< Ret() >
+template<typename Ret>
+class Signal<Ret()>
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
- void Connect( Ret (*func)() )
+ void Connect(Ret (*func)())
{
- mImpl.OnConnect( MakeCallback( func ) );
+ mImpl.OnConnect(MakeCallback(func));
}
/**
* @SINCE_1_0.0
* @param[in] func The function to disconnect
*/
- void Disconnect( Ret (*func)() )
+ void Disconnect(Ret (*func)())
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ mImpl.OnDisconnect(MakeCallback(func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, Ret (X::*func)() )
+ void Connect(X* obj, Ret (X::*func)())
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnConnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, Ret (X::*func)() )
+ void Disconnect(X* obj, Ret (X::*func)())
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnDisconnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, Ret (X::*func)() )
+ void Connect(SlotDelegate<X>& delegate, Ret (X::*func)())
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, Ret (X::*func)() )
+ void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)())
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorReturn0< X, Ret >( func ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorReturn0<X, Ret>(func));
}
/**
* @param[in] connectionTracker A connection tracker which can be used to disconnect
* @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegateReturn0< Ret >( delegate ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegateReturn0<Ret>(delegate));
}
/**
*/
Ret Emit()
{
- return mImpl.EmitReturn< Ret >();
+ return mImpl.EmitReturn<Ret>();
}
private:
-
- Signal( const Signal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal( Signal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=( const Signal& ) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=( Signal&& ) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
+ Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
+ Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
private:
-
// Use composition instead of inheritance (virtual methods don't mix well with templates)
BaseSignal mImpl; ///< Implementation
};
* @brief A template for Signals with 1 parameter.
* @SINCE_1_0.0
*/
-template < typename Arg0 >
-class Signal< void ( Arg0 ) >
+template<typename Arg0>
+class Signal<void(Arg0)>
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
- void Connect( void (*func)( Arg0 arg0 ) )
+ void Connect(void (*func)(Arg0 arg0))
{
- mImpl.OnConnect( MakeCallback( func ) );
+ mImpl.OnConnect(MakeCallback(func));
}
/**
* @SINCE_1_0.0
* @param[in] func The function to disconnect
*/
- void Disconnect( void (*func)( Arg0 arg0 ) )
+ void Disconnect(void (*func)(Arg0 arg0))
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ mImpl.OnDisconnect(MakeCallback(func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, void (X::*func)( Arg0 arg0 ) )
+ void Connect(X* obj, void (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnConnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, void (X::*func)( Arg0 arg0 ) )
+ void Disconnect(X* obj, void (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnDisconnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0 ) )
+ void Connect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0 ) )
+ void Disconnect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctor1< X, Arg0 >( func ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctor1<X, Arg0>(func));
}
/**
* @param[in] connectionTracker A connection tracker which can be used to disconnect
* @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegate1< Arg0 >( delegate ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegate1<Arg0>(delegate));
}
/**
* @SINCE_1_0.0
* @param[in] arg0 The first value to pass to callbacks
*/
- void Emit( Arg0 arg0 )
+ void Emit(Arg0 arg0)
{
- mImpl.Emit< Arg0 >( arg0 );
+ mImpl.Emit<Arg0>(arg0);
}
private:
-
- Signal( const Signal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal( Signal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=( const Signal& ) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=( Signal&& ) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
+ Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
+ Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
private:
-
// Use composition instead of inheritance (virtual methods don't mix well with templates)
BaseSignal mImpl; ///< Implementation
};
* @brief A template for Signals with 1 parameter and a return value.
* @SINCE_1_0.0
*/
-template < typename Ret, typename Arg0 >
-class Signal< Ret( Arg0 ) >
+template<typename Ret, typename Arg0>
+class Signal<Ret(Arg0)>
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
- void Connect( Ret (*func)( Arg0 arg0 ) )
+ void Connect(Ret (*func)(Arg0 arg0))
{
- mImpl.OnConnect( MakeCallback( func ) );
+ mImpl.OnConnect(MakeCallback(func));
}
/**
* @SINCE_1_0.0
* @param[in] func The function to disconnect
*/
- void Disconnect( Ret (*func)( Arg0 arg0 ) )
+ void Disconnect(Ret (*func)(Arg0 arg0))
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ mImpl.OnDisconnect(MakeCallback(func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, Ret (X::*func)( Arg0 arg0 ) )
+ void Connect(X* obj, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnConnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, Ret (X::*func)( Arg0 arg0 ) )
+ void Disconnect(X* obj, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnDisconnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0 ) )
+ void Connect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0 ) )
+ void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0))
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorReturn1< X, Arg0, Ret >( func ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorReturn1<X, Arg0, Ret>(func));
}
/**
* @param[in] connectionTracker A connection tracker which can be used to disconnect
* @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegateReturn1< Arg0, Ret >( delegate ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegateReturn1<Arg0, Ret>(delegate));
}
/**
* @param[in] arg0 The first value to pass to callbacks
* @return The value returned by the last callback, or a default constructed value if no callbacks are connected
*/
- Ret Emit( Arg0 arg0 )
+ Ret Emit(Arg0 arg0)
{
- return mImpl.EmitReturn< Ret,Arg0 >(arg0);
+ return mImpl.EmitReturn<Ret, Arg0>(arg0);
}
private:
-
- Signal( const Signal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal( Signal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=( const Signal& ) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=( Signal&& ) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
+ Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
+ Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
private:
-
// Use composition instead of inheritance (virtual methods don't mix well with templates)
BaseSignal mImpl; ///< Implementation
};
*
* @SINCE_1_0.0
*/
-template < typename Arg0, typename Arg1 >
-class Signal< void ( Arg0, Arg1 ) >
+template<typename Arg0, typename Arg1>
+class Signal<void(Arg0, Arg1)>
{
public:
-
/**
* @brief Default constructor.
*
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
- void Connect( void (*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Connect(void (*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect( MakeCallback( func ) );
+ mImpl.OnConnect(MakeCallback(func));
}
/**
* @SINCE_1_0.0
* @param[in] func The function to disconnect
*/
- void Disconnect( void (*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Disconnect(void (*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ mImpl.OnDisconnect(MakeCallback(func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, void (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Connect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnConnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, void (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Disconnect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnDisconnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Connect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Disconnect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctor2< X, Arg0, Arg1 >( func ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctor2<X, Arg0, Arg1>(func));
}
/**
* @param[in] connectionTracker A connection tracker which can be used to disconnect
* @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegate2< Arg0, Arg1 >( delegate ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegate2<Arg0, Arg1>(delegate));
}
/**
* @param[in] arg0 The first value to pass to callbacks
* @param[in] arg1 The second value to pass to callbacks
*/
- void Emit( Arg0 arg0, Arg1 arg1 )
+ void Emit(Arg0 arg0, Arg1 arg1)
{
- mImpl.Emit< Arg0,Arg1 >( arg0, arg1 );
+ mImpl.Emit<Arg0, Arg1>(arg0, arg1);
}
private:
-
- Signal( const Signal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal( Signal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=( const Signal& ) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=( Signal&& ) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
+ Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
+ Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
private:
-
// Use composition instead of inheritance (virtual methods don't mix well with templates)
BaseSignal mImpl; ///< Implementation
};
* @brief A template for Signals with 2 parameters and a return value.
* @SINCE_1_0.0
*/
-template < typename Ret, typename Arg0, typename Arg1 >
-class Signal< Ret( Arg0, Arg1 ) >
+template<typename Ret, typename Arg0, typename Arg1>
+class Signal<Ret(Arg0, Arg1)>
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
- void Connect( Ret (*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Connect(Ret (*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect( MakeCallback( func ) );
+ mImpl.OnConnect(MakeCallback(func));
}
/**
* @SINCE_1_0.0
* @param[in] func The function to disconnect
*/
- void Disconnect( Ret (*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Disconnect(Ret (*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ mImpl.OnDisconnect(MakeCallback(func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, Ret (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Connect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnConnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, Ret (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Disconnect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnDisconnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Connect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0, Arg1 arg1 ) )
+ void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0, Arg1 arg1))
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorReturn2< X, Arg0, Arg1, Ret >( func ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorReturn2<X, Arg0, Arg1, Ret>(func));
}
/**
* @param[in] connectionTracker A connection tracker which can be used to disconnect
* @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegateReturn2< Arg0, Arg1, Ret >( delegate ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegateReturn2<Arg0, Arg1, Ret>(delegate));
}
/**
* @param[in] arg1 The second value to pass to callbacks
* @return The value returned by the last callback, or a default constructed value if no callbacks are connected
*/
- Ret Emit( Arg0 arg0, Arg1 arg1 )
+ Ret Emit(Arg0 arg0, Arg1 arg1)
{
- return mImpl.EmitReturn< Ret,Arg0,Arg1 >( arg0, arg1 );
+ return mImpl.EmitReturn<Ret, Arg0, Arg1>(arg0, arg1);
}
private:
-
- Signal( const Signal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal( Signal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=( const Signal& ) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=( Signal&& ) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
+ Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
+ Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
private:
-
// Use composition instead of inheritance (virtual methods don't mix well with templates)
BaseSignal mImpl; ///< Implementation
};
* @brief A template for Signals with 3 parameters.
* @SINCE_1_0.0
*/
-template < typename Arg0, typename Arg1, typename Arg2 >
-class Signal< void ( Arg0, Arg1, Arg2 ) >
+template<typename Arg0, typename Arg1, typename Arg2>
+class Signal<void(Arg0, Arg1, Arg2)>
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
- void Connect( void (*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Connect(void (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect( MakeCallback( func ) );
+ mImpl.OnConnect(MakeCallback(func));
}
/**
* @SINCE_1_0.0
* @param[in] func The function to disconnect
*/
- void Disconnect( void (*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Disconnect(void (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ mImpl.OnDisconnect(MakeCallback(func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, void (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Connect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnConnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, void (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Disconnect(X* obj, void (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnDisconnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Connect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Disconnect(SlotDelegate<X>& delegate, void (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctor3< X, Arg0, Arg1, Arg2 >( func ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctor3<X, Arg0, Arg1, Arg2>(func));
}
/**
* @param[in] connectionTracker A connection tracker which can be used to disconnect
* @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegate3< Arg0, Arg1, Arg2 >( delegate ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegate3<Arg0, Arg1, Arg2>(delegate));
}
/**
* @param[in] arg1 The second value to pass to callbacks
* @param[in] arg2 The third value to pass to callbacks
*/
- void Emit( Arg0 arg0, Arg1 arg1, Arg2 arg2 )
+ void Emit(Arg0 arg0, Arg1 arg1, Arg2 arg2)
{
- mImpl.Emit< Arg0,Arg1,Arg2 >( arg0, arg1, arg2 );
+ mImpl.Emit<Arg0, Arg1, Arg2>(arg0, arg1, arg2);
}
private:
-
- Signal( const Signal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal( Signal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=( const Signal& ) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=( Signal&& ) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
+ Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
+ Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
private:
-
// Use composition instead of inheritance (virtual methods don't mix well with templates)
BaseSignal mImpl; ///< Implementation
};
* @brief A template for Signals with 2 parameters and a return value.
* @SINCE_1_0.0
*/
-template < typename Ret, typename Arg0, typename Arg1, typename Arg2 >
-class Signal< Ret( Arg0, Arg1, Arg2 ) >
+template<typename Ret, typename Arg0, typename Arg1, typename Arg2>
+class Signal<Ret(Arg0, Arg1, Arg2)>
{
public:
-
/**
* @brief Default constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] func The function to connect
*/
- void Connect( Ret (*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Connect(Ret (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect( MakeCallback( func ) );
+ mImpl.OnConnect(MakeCallback(func));
}
/**
* @SINCE_1_0.0
* @param[in] func The function to disconnect
*/
- void Disconnect( Ret (*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Disconnect(Ret (*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect( MakeCallback( func ) );
+ mImpl.OnDisconnect(MakeCallback(func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( X* obj, Ret (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Connect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnConnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( X* obj, Ret (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Disconnect(X* obj, Ret (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect( obj, MakeCallback( obj, func ) );
+ mImpl.OnDisconnect(obj, MakeCallback(obj, func));
}
/**
* @param[in] func The member function to connect
*/
template<class X>
- void Connect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Connect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnConnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnConnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The member function to disconnect
*/
template<class X>
- void Disconnect( SlotDelegate<X>& delegate, Ret (X::*func)( Arg0 arg0, Arg1 arg1, Arg2 arg2 ) )
+ void Disconnect(SlotDelegate<X>& delegate, Ret (X::*func)(Arg0 arg0, Arg1 arg1, Arg2 arg2))
{
- mImpl.OnDisconnect( delegate.GetConnectionTracker(), MakeCallback( delegate.GetSlot(), func ) );
+ mImpl.OnDisconnect(delegate.GetConnectionTracker(), MakeCallback(delegate.GetSlot(), func));
}
/**
* @param[in] func The function object to copy
*/
template<class X>
- void Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
+ void Connect(ConnectionTrackerInterface* connectionTracker, const X& func)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorReturn3< X, Arg0, Arg1, Arg2, Ret >( func ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorReturn3<X, Arg0, Arg1, Arg2, Ret>(func));
}
/**
* @param[in] connectionTracker A connection tracker which can be used to disconnect
* @param[in] delegate A newly allocated FunctorDelegate (ownership is taken)
*/
- void Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
+ void Connect(ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate)
{
- mImpl.OnConnect( connectionTracker, new CallbackFunctorDelegateReturn3< Arg0, Arg1, Arg2, Ret >( delegate ) );
+ mImpl.OnConnect(connectionTracker, new CallbackFunctorDelegateReturn3<Arg0, Arg1, Arg2, Ret>(delegate));
}
/**
* @param[in] arg2 The third value to pass to callbacks
* @return The value returned by the last callback, or a default constructed value if no callbacks are connected
*/
- Ret Emit( Arg0 arg0, Arg1 arg1, Arg2 arg2 )
+ Ret Emit(Arg0 arg0, Arg1 arg1, Arg2 arg2)
{
- return mImpl.EmitReturn< Ret,Arg0,Arg1,Arg2 >( arg0, arg1, arg2 );
+ return mImpl.EmitReturn<Ret, Arg0, Arg1, Arg2>(arg0, arg1, arg2);
}
private:
-
- Signal( const Signal& ) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
- Signal( Signal&& ) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
- Signal& operator=( const Signal& ) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
- Signal& operator=( Signal&& ) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
+ Signal(const Signal&) = delete; ///< Deleted copy constructor, signals don't support copying. @SINCE_1_0.0
+ Signal(Signal&&) = delete; ///< Deleted move constructor, signals don't support moving. @SINCE_1_9.25
+ Signal& operator=(const Signal&) = delete; ///< Deleted copy assignment operator @SINCE_1_0.0
+ Signal& operator=(Signal&&) = delete; ///< Deleted move assignment operator @SINCE_1_9.25
private:
-
// Use composition instead of inheritance (virtual methods don't mix well with templates)
BaseSignal mImpl; ///< Implementation
};
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
* functions and regular functions.
* If this assert fails, please implement the template specialisation for C functions.
*/
-static_assert( sizeof(void*) == sizeof( &FunctorDispatcher<void>::Dispatch ), "Need to implement template specialisation for C functions" );
-}
+static_assert(sizeof(void*) == sizeof(&FunctorDispatcher<void>::Dispatch), "Need to implement template specialisation for C functions");
+} // namespace
FunctorDelegate::~FunctorDelegate()
{
- if( mFunctorPointer )
+ if(mFunctorPointer)
{
- (*mDestructorDispatcher)( mFunctorPointer );
+ (*mDestructorDispatcher)(mFunctorPointer);
}
}
void FunctorDelegate::Execute()
{
- if( mFunctorPointer )
+ if(mFunctorPointer)
{
Dispatcher dispatcher = mMemberFunctionDispatcher;
- (*dispatcher)( mFunctorPointer );
+ (*dispatcher)(mFunctorPointer);
}
}
-FunctorDelegate::FunctorDelegate( void* objectPtr, Dispatcher dispatcher, Destructor destructor )
-: mFunctorPointer( objectPtr ),
- mMemberFunctionDispatcher( dispatcher ),
- mDestructorDispatcher( destructor )
+FunctorDelegate::FunctorDelegate(void* objectPtr, Dispatcher dispatcher, Destructor destructor)
+: mFunctorPointer(objectPtr),
+ mMemberFunctionDispatcher(dispatcher),
+ mDestructorDispatcher(destructor)
{
}
#define DALI_FUNCTOR_DELEGATE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
* @brief Dispatcher to call a functor.
* @SINCE_1_0.0
*/
-template< typename T >
+template<typename T>
struct FunctorDispatcher
{
/**
* @SINCE_1_0.0
* @param[in] functorPtr The functor to call
*/
- static void Dispatch( void* functorPtr )
+ static void Dispatch(void* functorPtr)
{
// "downcast" the functor type back to the correct one
- T* functor = reinterpret_cast< T* >( functorPtr );
+ T* functor = reinterpret_cast<T*>(functorPtr);
(*functor)();
}
};
* @brief Dispatcher to delete a functor object.
* @SINCE_1_0.0
*/
-template< typename T >
+template<typename T>
struct FunctorDestroyer
{
/**
* @SINCE_1_0.0
* @param[in] functorPtr A functor object to delete
*/
- static void Delete( void* functorPtr )
+ static void Delete(void* functorPtr)
{
// FunctorDelegate owns the object but we're the only one who knows the real type so need
// to delete by "downcasting" from void* to the correct type
- delete reinterpret_cast< T* >( functorPtr );
+ delete reinterpret_cast<T*>(functorPtr);
}
};
class DALI_CORE_API FunctorDelegate
{
public:
-
/**
* @brief Constructor which copies a function object.
*
* @param[in] functor The functor object to copy, either a class with operator() or a C function
* @return A pointer to the new function object
*/
- template< typename T >
- static FunctorDelegate* New( const T& functor )
+ template<typename T>
+ static FunctorDelegate* New(const T& functor)
{
- return new FunctorDelegate( reinterpret_cast< void* >( new T( functor ) ), // heap allocate the functor
- reinterpret_cast< FunctorDelegate::Dispatcher >( &FunctorDispatcher<T>::Dispatch ),
- reinterpret_cast< FunctorDelegate::Destructor >( &FunctorDestroyer<T>::Delete ) );
+ return new FunctorDelegate(reinterpret_cast<void*>(new T(functor)), // heap allocate the functor
+ reinterpret_cast<FunctorDelegate::Dispatcher>(&FunctorDispatcher<T>::Dispatch),
+ reinterpret_cast<FunctorDelegate::Destructor>(&FunctorDestroyer<T>::Delete));
}
/**
void Execute();
private:
-
/**
* @brief Used to call the correct function.
* @SINCE_1_0.0
*/
- using Dispatcher = void ( * )( void* );
+ using Dispatcher = void (*)(void*);
/**
* @brief Used to destroy mObjectPointer.
* @SINCE_1_0.0
*/
- using Destructor = void ( * )( void* );
+ using Destructor = void (*)(void*);
/**
* @brief Not defined.
* @SINCE_1_0.0
*/
- FunctorDelegate( const FunctorDelegate& rhs );
+ FunctorDelegate(const FunctorDelegate& rhs);
/**
* @brief Not defined.
* @SINCE_1_0.0
*/
- const FunctorDelegate& operator=( const FunctorDelegate& rhs );
+ const FunctorDelegate& operator=(const FunctorDelegate& rhs);
/**
* @brief Private constructor.
* @param dispatcher Used to call the actual function
* @param destructor Used to delete the owned functor object
*/
- FunctorDelegate( void* functorPtr, Dispatcher dispatcher, Destructor destructor );
+ FunctorDelegate(void* functorPtr, Dispatcher dispatcher, Destructor destructor);
-public: // Data for deriving classes & Dispatchers
+public:
+ // Data for deriving classes & Dispatchers
- void* mFunctorPointer; ///< Functor that will be called
+ void* mFunctorPointer; ///< Functor that will be called
Dispatcher mMemberFunctionDispatcher; ///< Dispatcher for member functions
Destructor mDestructorDispatcher; ///< Destructor for owned objects
};
/**
* @}
*/
-} // namespace DALI
+} // namespace Dali
#endif // DALI_FUNCTOR_DELEGATE_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
-SlotConnection::SlotConnection( SlotObserver* slotObserver, CallbackBase* callback )
-: mSlotObserver( slotObserver ),
- mCallback( callback )
+SlotConnection::SlotConnection(SlotObserver* slotObserver, CallbackBase* callback)
+: mSlotObserver(slotObserver),
+ mCallback(callback)
{
}
return mSlotObserver;
}
-SignalConnection::SignalConnection( CallbackBase* callback )
-: mSignalObserver( nullptr ),
- mCallback( callback )
+SignalConnection::SignalConnection(CallbackBase* callback)
+: mSignalObserver(nullptr),
+ mCallback(callback)
{
}
-SignalConnection::SignalConnection( SignalObserver* signalObserver, CallbackBase* callback )
-: mSignalObserver( signalObserver ),
- mCallback( callback )
+SignalConnection::SignalConnection(SignalObserver* signalObserver, CallbackBase* callback)
+: mSignalObserver(signalObserver),
+ mCallback(callback)
{
}
delete mCallback;
}
-void SignalConnection::Disconnect( SlotObserver* slotObserver )
+void SignalConnection::Disconnect(SlotObserver* slotObserver)
{
- if( mSignalObserver )
+ if(mSignalObserver)
{
// tell the slot the signal wants to disconnect
- mSignalObserver->SignalDisconnected( slotObserver, mCallback );
+ mSignalObserver->SignalDisconnected(slotObserver, mCallback);
mSignalObserver = nullptr;
}
class DALI_CORE_API SlotConnection
{
public:
-
/**
* @brief Constructor.
*
SlotObserver* GetSlotObserver();
private:
-
- SlotConnection( const SlotConnection& ) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
- SlotConnection( SlotConnection&& ) = delete; ///< Deleted move constructor. @SINCE_1_9.25
- SlotConnection& operator=( const SlotConnection& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
- SlotConnection& operator=( SlotConnection&& ) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
+ SlotConnection(const SlotConnection&) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
+ SlotConnection(SlotConnection&&) = delete; ///< Deleted move constructor. @SINCE_1_9.25
+ SlotConnection& operator=(const SlotConnection&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
+ SlotConnection& operator=(SlotConnection&&) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
private:
-
SlotObserver* mSlotObserver; ///< a pointer to the slot observer (not owned)
CallbackBase* mCallback; ///< The callback. This is not owned, the corresponding SignalConnection has ownership.
};
class DALI_CORE_API SignalConnection
{
public:
-
/**
* @brief Constructor.
*
* @SINCE_1_0.0
* @param[in] callback The callback which should be a C function
*/
- SignalConnection( CallbackBase* callback );
+ SignalConnection(CallbackBase* callback);
/**
* @brief Constructor.
* @param[in] signalObserver The signal observer
* @param[in] callback Ownership of this callback object is taken
*/
- SignalConnection( SignalObserver* signalObserver, CallbackBase* callback );
+ SignalConnection(SignalObserver* signalObserver, CallbackBase* callback);
/**
* @brief Non-virtual destructor, not intended as a base class.
* @SINCE_1_0.0
* @param[in] slotObserver The signal disconnecting from the slot
*/
- void Disconnect( SlotObserver* slotObserver );
+ void Disconnect(SlotObserver* slotObserver);
/**
* @brief Retrieves the callback.
CallbackBase* GetCallback();
private:
-
- SignalConnection( const SignalConnection& ) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
- SignalConnection( SignalConnection&& ) = delete; ///< Deleted move constructor. @SINCE_1_9.25
- SignalConnection& operator=( const SignalConnection& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
- SignalConnection& operator=( SignalConnection&& ) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
+ SignalConnection(const SignalConnection&) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
+ SignalConnection(SignalConnection&&) = delete; ///< Deleted move constructor. @SINCE_1_9.25
+ SignalConnection& operator=(const SignalConnection&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
+ SignalConnection& operator=(SignalConnection&&) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
private:
-
SignalObserver* mSignalObserver; ///< a pointer to the signal observer (not owned)
- CallbackBase* mCallback; ///< The callback, has ownership.
+ CallbackBase* mCallback; ///< The callback, has ownership.
};
/**
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
SignalObserver::SignalObserver()
{
}
#define DALI_SIGNAL_SLOT_OBSERVERS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
class DALI_CORE_API SignalObserver
{
public:
-
/**
* @brief Constructor.
* @SINCE_1_0.0
* @param[in] slotObserver The signal that has disconnected
* @param[in] callback The callback attached to the signal disconnected
*/
- virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ) = 0;
+ virtual void SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback) = 0;
};
/**
class DALI_CORE_API SlotObserver
{
public:
-
/**
* @brief Constructor.
* @SINCE_1_0.0
* @SINCE_1_0.0
* @param[in] callback The callback attached to the signal disconnected
*/
- virtual void SlotDisconnected( CallbackBase* callback ) = 0;
+ virtual void SlotDisconnected(CallbackBase* callback) = 0;
};
/**
* @endcode
* @SINCE_1_0.0
*/
-template <typename Slot>
+template<typename Slot>
class SlotDelegate
{
public:
-
/**
* @brief Constructor.
*
* @SINCE_1_0.0
* @param[in] slot The object with a callback
*/
- SlotDelegate( Slot* slot )
- : mSlot( slot )
+ SlotDelegate(Slot* slot)
+ : mSlot(slot)
{
}
}
private:
-
- SlotDelegate( const SlotDelegate& ) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
- SlotDelegate( SlotDelegate&& ) = delete; ///< Deleted move constructor. @SINCE_1_9.25
- SlotDelegate& operator=( const SlotDelegate& ) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
- SlotDelegate& operator=( SlotDelegate&& ) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
+ SlotDelegate(const SlotDelegate&) = delete; ///< Deleted copy constructor. @SINCE_1_0.0
+ SlotDelegate(SlotDelegate&&) = delete; ///< Deleted move constructor. @SINCE_1_9.25
+ SlotDelegate& operator=(const SlotDelegate&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
+ SlotDelegate& operator=(SlotDelegate&&) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
private:
-
Slot* mSlot; ///< The slot object
// Use composition instead of inheritance (virtual methods don't mix well with templates)
#define DALI_RELAYOUT_CONTAINER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
class RelayoutContainer
{
public:
-
/**
* @brief Default constructor.
*
* @SINCE_1_0.0
*/
- RelayoutContainer() {}
+ RelayoutContainer()
+ {
+ }
/**
* @brief Virtual destructor.
* @SINCE_1_0.0
*/
- virtual ~RelayoutContainer() {}
+ virtual ~RelayoutContainer()
+ {
+ }
/**
* @brief Adds relayout information to the container if it doesn't already exist.
* @param actor The actor to relayout
* @param size The size to relayout
*/
- virtual void Add( const Actor& actor, const Vector2& size ) = 0;
-
+ virtual void Add(const Actor& actor, const Vector2& size) = 0;
};
/**