From: Kimmo Hoikka Date: Thu, 4 Oct 2018 16:44:20 +0000 (+0100) Subject: Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t X-Git-Tag: dali_1.3.46~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=646f736e77b085c86e982c0d1d4b895c2a431330;p=platform%2Fcore%2Fuifw%2Fdali-core.git Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t unsigned char -> uint8_t unsigned short -> uint16_t unsigned int -> uint32_t int -> int32_t these types are guaranteed to have the correct amount of bits by the compiler Change-Id: Ie480a21e06dc999110de368284ff9a601bacef2a --- diff --git a/dali/public-api/actors/actor.cpp b/dali/public-api/actors/actor.cpp index 0cd89e141..bfa73fd17 100644 --- a/dali/public-api/actors/actor.cpp +++ b/dali/public-api/actors/actor.cpp @@ -75,7 +75,7 @@ void Actor::SetName(const std::string& name) GetImplementation(*this).SetName(name); } -unsigned int Actor::GetId() const +uint32_t Actor::GetId() const { return GetImplementation(*this).GetId(); } @@ -115,12 +115,12 @@ void Actor::Unparent() GetImplementation(*this).Unparent(); } -unsigned int Actor::GetChildCount() const +uint32_t Actor::GetChildCount() const { return GetImplementation(*this).GetChildCount(); } -Actor Actor::GetChildAt(unsigned int index) const +Actor Actor::GetChildAt( uint32_t index ) const { Internal::ActorPtr child = GetImplementation(*this).GetChildAt( index ); return Actor( child.Get() ); @@ -132,7 +132,7 @@ Actor Actor::FindChildByName(const std::string& actorName) return Actor( child.Get() ); } -Actor Actor::FindChildById(const unsigned int id) +Actor Actor::FindChildById( const uint32_t id ) { Internal::ActorPtr child = GetImplementation(*this).FindChildById( id ); return Actor( child.Get() ); @@ -563,7 +563,7 @@ Vector2 Actor::GetMaximumSize() return Vector2( impl.GetMaximumSize( Dimension::WIDTH ), impl.GetMaximumSize( Dimension::HEIGHT ) ); } -int Actor::GetHierarchyDepth() +int32_t Actor::GetHierarchyDepth() { return GetImplementation(*this).GetHierarchyDepth(); } @@ -600,17 +600,17 @@ Actor::OffStageSignalType& Actor::OffStageSignal() return GetImplementation(*this).OffStageSignal(); } -unsigned int Actor::AddRenderer( Renderer& renderer ) +uint32_t Actor::AddRenderer( Renderer& renderer ) { return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) ); } -unsigned int Actor::GetRendererCount() const +uint32_t Actor::GetRendererCount() const { return GetImplementation(*this).GetRendererCount(); } -Renderer Actor::GetRendererAt( unsigned int index ) +Renderer Actor::GetRendererAt( uint32_t index ) { Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index ); return Renderer( renderer.Get() ); @@ -621,7 +621,7 @@ void Actor::RemoveRenderer( Renderer& renderer ) GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) ); } -void Actor::RemoveRenderer( unsigned int index ) +void Actor::RemoveRenderer( uint32_t index ) { GetImplementation(*this).RemoveRenderer( index ); } diff --git a/dali/public-api/actors/actor.h b/dali/public-api/actors/actor.h index ebb7a196e..97756b0be 100644 --- a/dali/public-api/actors/actor.h +++ b/dali/public-api/actors/actor.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // uint32_t // INTERNAL INCLUDES #include @@ -417,7 +418,7 @@ public: * @return The ID * @pre The Actor has been initialized. */ - unsigned int GetId() const; + uint32_t GetId() const; // Containment @@ -503,7 +504,7 @@ public: * @return The number of children * @pre The Actor has been initialized. */ - unsigned int GetChildCount() const; + uint32_t GetChildCount() const; /** * @brief Retrieve and child actor by index. @@ -513,7 +514,7 @@ public: * @return The actor for the given index or empty handle if children not initialized * @pre The Actor has been initialized. */ - Actor GetChildAt(unsigned int index) const; + Actor GetChildAt( uint32_t index ) const; /** * @brief Search through this actor's hierarchy for an actor with the given name. @@ -535,7 +536,7 @@ public: * @return A handle to the actor if found, or an empty handle if not * @pre The Actor has been initialized. */ - Actor FindChildById(const unsigned int id); + Actor FindChildById( const uint32_t id ); /** * @brief Retrieves the actor's parent. @@ -1458,7 +1459,7 @@ public: * @SINCE_1_0.0 * @return The current depth in the hierarchy of the actor, or @c -1 if actor is not in the hierarchy */ - int GetHierarchyDepth(); + int32_t GetHierarchyDepth(); public: // Renderer @@ -1471,7 +1472,7 @@ public: // Renderer * @pre The renderer must be initialized. * */ - unsigned int AddRenderer( Renderer& renderer ); + uint32_t AddRenderer( Renderer& renderer ); /** * @brief Gets the number of renderers on this actor. @@ -1479,7 +1480,7 @@ public: // Renderer * @SINCE_1_0.0 * @return The number of renderers on this actor */ - unsigned int GetRendererCount() const; + uint32_t GetRendererCount() const; /** * @brief Gets a Renderer by index. @@ -1490,7 +1491,7 @@ public: // Renderer * @pre The index must be between 0 and GetRendererCount()-1 * */ - Renderer GetRendererAt( unsigned int index ); + Renderer GetRendererAt( uint32_t index ); /** * @brief Removes a renderer from the actor. @@ -1508,7 +1509,7 @@ public: // Renderer * @pre The index must be between 0 and GetRendererCount()-1 * */ - void RemoveRenderer( unsigned int index ); + void RemoveRenderer( uint32_t index ); public: // Signals diff --git a/dali/public-api/actors/custom-actor-impl.h b/dali/public-api/actors/custom-actor-impl.h index d834606bf..f4cc9fef5 100644 --- a/dali/public-api/actors/custom-actor-impl.h +++ b/dali/public-api/actors/custom-actor-impl.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -106,7 +109,7 @@ public: * @endcode * @param[in] depth The depth in the hierarchy for the actor */ - virtual void OnStageConnection( int depth ) = 0; + virtual void OnStageConnection( int32_t depth ) = 0; /** * @brief Called after the actor has been disconnected from Stage. @@ -337,7 +340,7 @@ protected: // For derived classes LAST_ACTOR_FLAG ///< Special marker for last actor flag @SINCE_1_0.0 }; - static const int ACTOR_FLAG_COUNT = Log< LAST_ACTOR_FLAG - 1 >::value + 1; ///< Value for deriving classes to continue on the flag enum + static const 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. diff --git a/dali/public-api/actors/layer.cpp b/dali/public-api/actors/layer.cpp index 029ee45a5..5e31ff7d5 100644 --- a/dali/public-api/actors/layer.cpp +++ b/dali/public-api/actors/layer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ Layer& Layer::operator=(const Layer& rhs) return *this; } -unsigned int Layer::GetDepth() const +uint32_t Layer::GetDepth() const { return GetImplementation(*this).GetDepth(); } @@ -123,7 +123,7 @@ bool Layer::IsClipping() const return GetImplementation(*this).IsClipping(); } -void Layer::SetClippingBox(int x, int y, int width, int height) +void Layer::SetClippingBox(int32_t x, int32_t y, int32_t width, int32_t height) { GetImplementation(*this).SetClippingBox(x, y, width, height); } diff --git a/dali/public-api/actors/layer.h b/dali/public-api/actors/layer.h index c21e32fb6..15683cff9 100644 --- a/dali/public-api/actors/layer.h +++ b/dali/public-api/actors/layer.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -43,7 +46,7 @@ class Layer; * @SINCE_1_0.0 * @see Dali::Layer::SetClippingBox() */ -typedef Rect ClippingBox; +typedef Rect ClippingBox; /** * @brief Layers provide a mechanism for overlaying groups of actors on top of each other. @@ -101,7 +104,7 @@ public: enum { CLIPPING_ENABLE = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, ///< name "clippingEnable", type bool @SINCE_1_0.0 - CLIPPING_BOX, ///< name "clippingBox", type Rect @SINCE_1_0.0 + CLIPPING_BOX, ///< name "clippingBox", type Rect @SINCE_1_0.0 BEHAVIOR, ///< name "behavior", type String @SINCE_1_0.0 }; }; @@ -263,7 +266,7 @@ public: * @pre Layer is on the stage. * If layer is not added to the stage, returns 0. */ - unsigned int GetDepth() const; + uint32_t GetDepth() const; /** * @brief Increments the depth of the layer. @@ -391,7 +394,7 @@ public: * @param[in] width The width of the box * @param[in] height The height of the box */ - void SetClippingBox(int x, int y, int width, int height); + void SetClippingBox(int32_t x, int32_t y, int32_t width, int32_t height); /** * @brief Sets the clipping box of a layer in window coordinates. diff --git a/dali/public-api/animation/alpha-function.cpp b/dali/public-api/animation/alpha-function.cpp index 21133dcad..28f7c41e9 100755 --- a/dali/public-api/animation/alpha-function.cpp +++ b/dali/public-api/animation/alpha-function.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,11 @@ namespace Dali namespace { -constexpr unsigned int BitMaskOfN( unsigned int bits ) +constexpr uint32_t BitMaskOfN( uint32_t bits ) { return ( 1 << bits ) - 1; } + } // unnamed namespace AlphaFunction::AlphaFunction() diff --git a/dali/public-api/animation/animation.cpp b/dali/public-api/animation/animation.cpp index 980223d4b..bd3ce9831 100644 --- a/dali/public-api/animation/animation.cpp +++ b/dali/public-api/animation/animation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,17 +79,17 @@ void Animation::SetLooping(bool looping) GetImplementation(*this).SetLooping(looping); } -void Animation::SetLoopCount(int count) +void Animation::SetLoopCount(int32_t count) { GetImplementation(*this).SetLoopCount(count); } -int Animation::GetLoopCount() +int32_t Animation::GetLoopCount() { return GetImplementation(*this).GetLoopCount(); } -int Animation::GetCurrentLoop() +int32_t Animation::GetCurrentLoop() { return GetImplementation(*this).GetCurrentLoop(); } diff --git a/dali/public-api/animation/animation.h b/dali/public-api/animation/animation.h index 50fb99914..2fb26067d 100644 --- a/dali/public-api/animation/animation.h +++ b/dali/public-api/animation/animation.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -267,7 +270,7 @@ public: * @SINCE_1_1.20 * @param[in] count The number of times to loop */ - void SetLoopCount(int count); + void SetLoopCount(int32_t count); /** * @brief Gets the loop count. @@ -278,7 +281,7 @@ public: * @SINCE_1_1.20 * @return The number of times to loop */ - int GetLoopCount(); + int32_t GetLoopCount(); /** * @brief Gets the current loop count. @@ -288,7 +291,7 @@ public: * @SINCE_1_1.20 * @return The current number of loops that have occured */ - int GetCurrentLoop(); + int32_t GetCurrentLoop(); /** * @brief Queries whether the animation will loop. diff --git a/dali/public-api/animation/constraint.cpp b/dali/public-api/animation/constraint.cpp index 31f6fdc2a..4951c7e98 100644 --- a/dali/public-api/animation/constraint.cpp +++ b/dali/public-api/animation/constraint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -104,12 +104,12 @@ Constraint::RemoveAction Constraint::GetRemoveAction() const return GetImplementation(*this).GetRemoveAction(); } -void Constraint::SetTag( const unsigned int tag ) +void Constraint::SetTag( uint32_t tag ) { GetImplementation(*this).SetTag( tag ); } -unsigned int Constraint::GetTag() const +uint32_t Constraint::GetTag() const { return GetImplementation(*this).GetTag(); } diff --git a/dali/public-api/animation/constraint.h b/dali/public-api/animation/constraint.h index eaf4509dd..c2722fbb8 100644 --- a/dali/public-api/animation/constraint.h +++ b/dali/public-api/animation/constraint.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -499,7 +502,7 @@ public: * @SINCE_1_0.0 * @param[in] tag An integer to identify the constraint */ - void SetTag( const unsigned int tag ); + void SetTag( uint32_t tag ); /** * @brief Gets the tag. @@ -507,7 +510,7 @@ public: * @SINCE_1_0.0 * @return The tag */ - unsigned int GetTag() const; + uint32_t GetTag() const; public: // Not intended for use by Application developers diff --git a/dali/public-api/common/dali-common.cpp b/dali/public-api/common/dali-common.cpp index 14e362bfa..42d13311a 100644 --- a/dali/public-api/common/dali-common.cpp +++ b/dali/public-api/common/dali-common.cpp @@ -38,7 +38,7 @@ namespace Dali namespace { -const int MAX_NUM_STACK_FRAMES = 25; +const int32_t MAX_NUM_STACK_FRAMES = 25; } std::string Demangle(const char* symbol) @@ -74,7 +74,7 @@ std::string Demangle(const char* symbol) mangledSymbol[tokenLength] = '\0'; size_t size; - int status; + int32_t status; char* demangled=NULL; demangled = abi::__cxa_demangle( mangledSymbol, NULL, &size, &status ); if( demangled != NULL ) @@ -111,9 +111,9 @@ DALI_CORE_API DaliException::DaliException( const char* location, const char* co DALI_LOG_ERROR_NOFN("Backtrace:\n"); void* frameArray[MAX_NUM_STACK_FRAMES]; - int nSize = backtrace(frameArray, MAX_NUM_STACK_FRAMES); + int32_t nSize = backtrace(frameArray, MAX_NUM_STACK_FRAMES); char** symbols = backtrace_symbols(frameArray, nSize); - for(int i=1; i< nSize; i++) + 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() ); diff --git a/dali/public-api/common/dali-vector.cpp b/dali/public-api/common/dali-vector.cpp index 2e2bd8f5b..31fad5488 100644 --- a/dali/public-api/common/dali-vector.cpp +++ b/dali/public-api/common/dali-vector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,8 +51,7 @@ void VectorBase::Release() { // adjust pointer to real beginning SizeType* metadata = reinterpret_cast< SizeType* >( mData ); - // TODO would be nice to memset to a bitpattern to catch illegal use of container after release - // but that would require knowledge of the itemsize + delete [] ( metadata - 2u ); mData = 0u; } @@ -75,7 +74,7 @@ void VectorBase::Reserve( SizeType capacity, SizeType elementSize ) if( capacity > oldCapacity ) { const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize; - void* wholeData = reinterpret_cast< void* >( new unsigned char[ wholeAllocation ] ); + void* wholeData = reinterpret_cast< void* >( new uint8_t[ wholeAllocation ] ); DALI_ASSERT_ALWAYS( wholeData && "VectorBase::Reserve - Memory allocation failed" ); #if defined( DEBUG_ENABLED ) diff --git a/dali/public-api/common/dali-vector.h b/dali/public-api/common/dali-vector.h index 4140049e6..2b7b78618 100755 --- a/dali/public-api/common/dali-vector.h +++ b/dali/public-api/common/dali-vector.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include // uint32_t // INTERNAL INCLUDES #include @@ -360,7 +361,7 @@ protected: // API for deriving classes std::size_t offset = at - reinterpret_cast( mData ); // need more space - Reserve( NextPowerOfTwo( newCount ), elementSize ); // reserve enough space to store at least the next power of two elements of the new required size. + Reserve( NextPowerOfTwo( static_cast( 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( mData ) + offset; diff --git a/dali/public-api/common/stage.cpp b/dali/public-api/common/stage.cpp index 13825ff12..cf5c03ab5 100644 --- a/dali/public-api/common/stage.cpp +++ b/dali/public-api/common/stage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,12 +90,12 @@ Vector2 Stage::GetSize() const return GetImplementation(*this).GetSize(); } -unsigned int Stage::GetLayerCount() const +uint32_t Stage::GetLayerCount() const { return GetImplementation(*this).GetLayerCount(); } -Layer Stage::GetLayer(unsigned int depth) const +Layer Stage::GetLayer(uint32_t depth) const { return GetImplementation(*this).GetLayer(depth); } diff --git a/dali/public-api/common/stage.h b/dali/public-api/common/stage.h index 9ca8a9b87..ede398306 100644 --- a/dali/public-api/common/stage.h +++ b/dali/public-api/common/stage.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -198,7 +201,7 @@ public: * @SINCE_1_0.0 * @return The number of layers */ - unsigned int GetLayerCount() const; + uint32_t GetLayerCount() const; /** * @brief Retrieves the layer at a specified depth. @@ -208,7 +211,7 @@ public: * @return The layer found at the given depth * @pre Depth is less than layer count; see GetLayerCount(). */ - Layer GetLayer(unsigned int depth) const; + Layer GetLayer(uint32_t depth) const; /** * @brief Returns the Stage's Root Layer. diff --git a/dali/public-api/dali-core-version.cpp b/dali/public-api/dali-core-version.cpp index e4e25f2bd..ab3814778 100644 --- a/dali/public-api/dali-core-version.cpp +++ b/dali/public-api/dali-core-version.cpp @@ -26,9 +26,9 @@ namespace Dali { -const unsigned int CORE_MAJOR_VERSION = 1; -const unsigned int CORE_MINOR_VERSION = 3; -const unsigned int CORE_MICRO_VERSION = 45; +const uint32_t CORE_MAJOR_VERSION = 1; +const uint32_t CORE_MINOR_VERSION = 3; +const uint32_t CORE_MICRO_VERSION = 45; const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/dali/public-api/dali-core-version.h b/dali/public-api/dali-core-version.h index 5872984c1..e8658bb73 100644 --- a/dali/public-api/dali-core-version.h +++ b/dali/public-api/dali-core-version.h @@ -18,14 +18,17 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include namespace Dali { -DALI_CORE_API extern const unsigned int CORE_MAJOR_VERSION; ///< The major version number of the Core library. -DALI_CORE_API extern const unsigned int CORE_MINOR_VERSION; ///< The minor version number of the Core library. -DALI_CORE_API extern const unsigned int CORE_MICRO_VERSION; ///< The micro version number of the Core library. +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 diff --git a/dali/public-api/events/gesture-detector.h b/dali/public-api/events/gesture-detector.h index 08f19996f..b8668185a 100644 --- a/dali/public-api/events/gesture-detector.h +++ b/dali/public-api/events/gesture-detector.h @@ -19,7 +19,6 @@ */ // INTERNAL INCLUDES -#include #include namespace Dali diff --git a/dali/public-api/events/gesture.h b/dali/public-api/events/gesture.h index bf9378925..2696f7b8e 100644 --- a/dali/public-api/events/gesture.h +++ b/dali/public-api/events/gesture.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include @@ -112,7 +115,7 @@ struct DALI_CORE_API Gesture /** * @brief The time the gesture took place. */ - unsigned int time; + uint32_t time; protected: // Creation diff --git a/dali/public-api/events/hover-event.cpp b/dali/public-api/events/hover-event.cpp index 395a56978..69f02e130 100644 --- a/dali/public-api/events/hover-event.cpp +++ b/dali/public-api/events/hover-event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ HoverEvent::~HoverEvent() { } -unsigned int HoverEvent::GetPointCount() const +uint32_t HoverEvent::GetPointCount() const { - return points.size(); + return static_cast( points.size() ); } -const TouchPoint& HoverEvent::GetPoint(unsigned int point) const +const TouchPoint& HoverEvent::GetPoint( uint32_t point ) const { DALI_ASSERT_ALWAYS( point < points.size() && "No point at index" ); return points[point]; diff --git a/dali/public-api/events/hover-event.h b/dali/public-api/events/hover-event.h index ff7d71913..e5c9f48ad 100644 --- a/dali/public-api/events/hover-event.h +++ b/dali/public-api/events/hover-event.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -82,7 +85,7 @@ struct DALI_CORE_API HoverEvent * @SINCE_1_0.0 * @return Total number of Points */ - unsigned int GetPointCount() const; + uint32_t GetPointCount() const; /** * @brief Returns a touch point at the index requested. @@ -95,7 +98,7 @@ struct DALI_CORE_API HoverEvent * @note "point" should be less than the value returned by GetPointCount(). * If out of range, then program asserts. */ - const TouchPoint& GetPoint(unsigned int point) const; + const TouchPoint& GetPoint( uint32_t point) const; }; /** diff --git a/dali/public-api/events/key-event.cpp b/dali/public-api/events/key-event.cpp index aa5ba9aa8..30a1323d7 100755 --- a/dali/public-api/events/key-event.cpp +++ b/dali/public-api/events/key-event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ namespace Dali namespace { -const unsigned int MODIFIER_SHIFT = 0x1; -const unsigned int MODIFIER_CTRL = 0x2; -const unsigned int MODIFIER_ALT = 0x4; -const int KEY_INVALID_CODE = -1; +const uint32_t MODIFIER_SHIFT = 0x1; +const uint32_t MODIFIER_CTRL = 0x2; +const uint32_t MODIFIER_ALT = 0x4; +const int32_t KEY_INVALID_CODE = -1; } KeyEvent::KeyEvent() @@ -43,7 +43,7 @@ KeyEvent::KeyEvent() new Internal::KeyEventImpl( this ); } -KeyEvent::KeyEvent(const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier,unsigned long timeStamp, const State& keyState) +KeyEvent::KeyEvent(const std::string& keyName, const std::string& keyString, int32_t keyCode, int32_t keyModifier,unsigned long timeStamp, const State& keyState) : keyPressedName(keyName), keyPressed(keyString), keyCode(keyCode), diff --git a/dali/public-api/events/key-event.h b/dali/public-api/events/key-event.h index 8aaadad38..336e73728 100755 --- a/dali/public-api/events/key-event.h +++ b/dali/public-api/events/key-event.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // int32_t // INTERNAL INCLUDES #include @@ -79,7 +80,7 @@ struct DALI_CORE_API KeyEvent * @param[in] timeStamp The time (in ms) that the key event occurred * @param[in] keyState The state of the key event */ - KeyEvent(const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier, unsigned long timeStamp, const State& keyState); + KeyEvent(const std::string& keyName, const std::string& keyString, int32_t keyCode, int32_t keyModifier, unsigned long timeStamp, const State& keyState); /** * @brief Copy constructor. @@ -180,12 +181,12 @@ struct DALI_CORE_API KeyEvent * platform-specific key code. You need to use IsKey() to know what a key event means * instead of direct comparison of key code value. */ - int keyCode; + int32_t keyCode; /** * @brief special keys like shift, alt and control which modify the next key pressed. */ - int keyModifier; + int32_t keyModifier; /** * @brief The time (in ms) that the key event occurred. diff --git a/dali/public-api/events/long-press-gesture-detector.cpp b/dali/public-api/events/long-press-gesture-detector.cpp index d49e9b944..98c7ed392 100644 --- a/dali/public-api/events/long-press-gesture-detector.cpp +++ b/dali/public-api/events/long-press-gesture-detector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,14 +40,14 @@ LongPressGestureDetector LongPressGestureDetector::New() return LongPressGestureDetector(internal.Get()); } -LongPressGestureDetector LongPressGestureDetector::New(unsigned int touchesRequired) +LongPressGestureDetector LongPressGestureDetector::New(uint32_t touchesRequired) { Internal::LongPressGestureDetectorPtr internal = Internal::LongPressGestureDetector::New(touchesRequired); return LongPressGestureDetector(internal.Get()); } -LongPressGestureDetector LongPressGestureDetector::New(unsigned int minTouches, unsigned int maxTouches) +LongPressGestureDetector LongPressGestureDetector::New(uint32_t minTouches, uint32_t maxTouches) { Internal::LongPressGestureDetectorPtr internal = Internal::LongPressGestureDetector::New(minTouches, maxTouches); @@ -74,22 +74,22 @@ LongPressGestureDetector& LongPressGestureDetector::operator=(const LongPressGes return *this; } -void LongPressGestureDetector::SetTouchesRequired(unsigned int touches) +void LongPressGestureDetector::SetTouchesRequired(uint32_t touches) { GetImplementation(*this).SetTouchesRequired(touches); } -void LongPressGestureDetector::SetTouchesRequired(unsigned int minTouches, unsigned int maxTouches) +void LongPressGestureDetector::SetTouchesRequired(uint32_t minTouches, uint32_t maxTouches) { GetImplementation(*this).SetTouchesRequired(minTouches, maxTouches); } -unsigned int LongPressGestureDetector::GetMinimumTouchesRequired() const +uint32_t LongPressGestureDetector::GetMinimumTouchesRequired() const { return GetImplementation(*this).GetMinimumTouchesRequired(); } -unsigned int LongPressGestureDetector::GetMaximumTouchesRequired() const +uint32_t LongPressGestureDetector::GetMaximumTouchesRequired() const { return GetImplementation(*this).GetMaximumTouchesRequired(); } diff --git a/dali/public-api/events/long-press-gesture-detector.h b/dali/public-api/events/long-press-gesture-detector.h index 111bbf2e6..3696df037 100644 --- a/dali/public-api/events/long-press-gesture-detector.h +++ b/dali/public-api/events/long-press-gesture-detector.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -92,7 +95,7 @@ public: // Creation & Destruction * @param[in] touchesRequired The number of touches required * @return A handle to a newly allocated Dali resource */ - static LongPressGestureDetector New(unsigned int touchesRequired); + static LongPressGestureDetector New(uint32_t touchesRequired); /** * @brief Creates an initialized LongPressGestureDetector with the minimum and maximum number of touches required. @@ -104,7 +107,7 @@ public: // Creation & Destruction * @param[in] maxTouches The maximum number of touches required * @return A handle to a newly allocated Dali resource */ - static LongPressGestureDetector New(unsigned int minTouches, unsigned int maxTouches); + static LongPressGestureDetector New(uint32_t minTouches, uint32_t maxTouches); /** * @brief Downcasts a handle to LongPressGestureDetector handle. @@ -156,7 +159,7 @@ public: // Setters * @pre The gesture detector has been initialized. * @note The default is '1'. */ - void SetTouchesRequired(unsigned int touches); + void SetTouchesRequired(uint32_t touches); /** * @brief Sets the minimum and maximum touches required. @@ -170,7 +173,7 @@ public: // Setters * @pre The gesture detector has been initialized. * @note The default is '1'. */ - void SetTouchesRequired(unsigned int minTouches, unsigned int maxTouches); + void SetTouchesRequired(uint32_t minTouches, uint32_t maxTouches); public: // Getters @@ -181,7 +184,7 @@ public: // Getters * @return The minimum number of touches required * @pre The gesture detector has been initialized. */ - unsigned int GetMinimumTouchesRequired() const; + uint32_t GetMinimumTouchesRequired() const; /** * @brief Retrieves the maximum number of touches required. @@ -190,7 +193,7 @@ public: // Getters * @return The maximum number of touches required * @pre The gesture detector has been initialized. */ - unsigned int GetMaximumTouchesRequired() const; + uint32_t GetMaximumTouchesRequired() const; public: // Signals diff --git a/dali/public-api/events/long-press-gesture.h b/dali/public-api/events/long-press-gesture.h index 414cc0603..d994ea568 100644 --- a/dali/public-api/events/long-press-gesture.h +++ b/dali/public-api/events/long-press-gesture.h @@ -79,7 +79,7 @@ struct DALI_CORE_API LongPressGesture : public Gesture * @brief The number of touch points in this long press gesture, i.e. the number of fingers the user had * on the screen to generate the long press gesture. */ - unsigned int numberOfTouches; + uint32_t numberOfTouches; /** * @brief This is the point, in screen coordinates, where the long press occurred. diff --git a/dali/public-api/events/pan-gesture-detector.cpp b/dali/public-api/events/pan-gesture-detector.cpp index 78ed53d54..860e6a80b 100644 --- a/dali/public-api/events/pan-gesture-detector.cpp +++ b/dali/public-api/events/pan-gesture-detector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,22 +68,22 @@ PanGestureDetector& PanGestureDetector::operator=(const PanGestureDetector& rhs) return *this; } -void PanGestureDetector::SetMinimumTouchesRequired(unsigned int minimum) +void PanGestureDetector::SetMinimumTouchesRequired(uint32_t minimum) { GetImplementation(*this).SetMinimumTouchesRequired(minimum); } -void PanGestureDetector::SetMaximumTouchesRequired(unsigned int maximum) +void PanGestureDetector::SetMaximumTouchesRequired(uint32_t maximum) { GetImplementation(*this).SetMaximumTouchesRequired(maximum); } -unsigned int PanGestureDetector::GetMinimumTouchesRequired() const +uint32_t PanGestureDetector::GetMinimumTouchesRequired() const { return GetImplementation(*this).GetMinimumTouchesRequired(); } -unsigned int PanGestureDetector::GetMaximumTouchesRequired() const +uint32_t PanGestureDetector::GetMaximumTouchesRequired() const { return GetImplementation(*this).GetMaximumTouchesRequired(); } diff --git a/dali/public-api/events/pan-gesture-detector.h b/dali/public-api/events/pan-gesture-detector.h index ec83a3887..3f6449de2 100644 --- a/dali/public-api/events/pan-gesture-detector.h +++ b/dali/public-api/events/pan-gesture-detector.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -168,7 +171,7 @@ public: // Setters * @pre The gesture detector has been initialized. * @note The default minimum is '1'. */ - void SetMinimumTouchesRequired(unsigned int minimum); + void SetMinimumTouchesRequired(uint32_t minimum); /** * @brief This is the maximum number of touches required for the pan gesture to be detected. @@ -178,7 +181,7 @@ public: // Setters * @pre The gesture detector has been initialized. * @note The default maximum is '1'. */ - void SetMaximumTouchesRequired(unsigned int maximum); + void SetMaximumTouchesRequired(uint32_t maximum); public: // Getters @@ -189,7 +192,7 @@ public: // Getters * @return The minimum touches required * @pre The gesture detector has been initialized. */ - unsigned int GetMinimumTouchesRequired() const; + uint32_t GetMinimumTouchesRequired() const; /** * @brief Retrieves the maximum number of touches required for the pan gesture to be detected. @@ -198,7 +201,7 @@ public: // Getters * @return The maximum touches required * @pre The gesture detector has been initialized. */ - unsigned int GetMaximumTouchesRequired() const; + uint32_t GetMaximumTouchesRequired() const; public: // Directional Panning diff --git a/dali/public-api/events/pan-gesture.h b/dali/public-api/events/pan-gesture.h index d2fcb3511..8c6dbfbd0 100644 --- a/dali/public-api/events/pan-gesture.h +++ b/dali/public-api/events/pan-gesture.h @@ -140,7 +140,7 @@ struct DALI_CORE_API PanGesture: public Gesture /** * @brief The total number of fingers touching the screen in a pan gesture. */ - unsigned int numberOfTouches; + uint32_t numberOfTouches; // Convenience Methods diff --git a/dali/public-api/events/tap-gesture-detector.cpp b/dali/public-api/events/tap-gesture-detector.cpp index 961149600..e979fb7d9 100644 --- a/dali/public-api/events/tap-gesture-detector.cpp +++ b/dali/public-api/events/tap-gesture-detector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ TapGestureDetector TapGestureDetector::New() return TapGestureDetector(internal.Get()); } -TapGestureDetector TapGestureDetector::New(unsigned int tapsRequired ) +TapGestureDetector TapGestureDetector::New(uint32_t tapsRequired ) { Internal::TapGestureDetectorPtr internal = Internal::TapGestureDetector::New( tapsRequired ); @@ -66,22 +66,22 @@ TapGestureDetector& TapGestureDetector::operator=(const TapGestureDetector& rhs) return *this; } -void TapGestureDetector::SetMinimumTapsRequired(unsigned int taps) +void TapGestureDetector::SetMinimumTapsRequired(uint32_t taps) { GetImplementation(*this).SetMinimumTapsRequired(taps); } -void TapGestureDetector::SetMaximumTapsRequired(unsigned int taps) +void TapGestureDetector::SetMaximumTapsRequired(uint32_t taps) { GetImplementation(*this).SetMaximumTapsRequired(taps); } -unsigned int TapGestureDetector::GetMinimumTapsRequired() const +uint32_t TapGestureDetector::GetMinimumTapsRequired() const { return GetImplementation(*this).GetMinimumTapsRequired(); } -unsigned int TapGestureDetector::GetMaximumTapsRequired() const +uint32_t TapGestureDetector::GetMaximumTapsRequired() const { return GetImplementation(*this).GetMaximumTapsRequired(); } diff --git a/dali/public-api/events/tap-gesture-detector.h b/dali/public-api/events/tap-gesture-detector.h index f51ebb43a..0d2b82953 100644 --- a/dali/public-api/events/tap-gesture-detector.h +++ b/dali/public-api/events/tap-gesture-detector.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -100,7 +103,7 @@ public: // Creation & Destruction * @param[in] tapsRequired The minimum & maximum number of taps required * @return A handle to a newly allocated Dali resource */ - static TapGestureDetector New( unsigned int tapsRequired ); + static TapGestureDetector New( uint32_t tapsRequired ); /** * @brief Downcasts a handle to TapGestureDetector handle. @@ -149,7 +152,7 @@ public: // Setters * @pre The gesture detector has been initialized. * @note The default is '1'. */ - void SetMinimumTapsRequired( unsigned int minimumTaps ); + void SetMinimumTapsRequired( uint32_t minimumTaps ); /** * @brief Sets the maximum number of taps required. @@ -160,7 +163,7 @@ public: // Setters * @pre The gesture detector has been initialized. * @note The default is '1'. */ - void SetMaximumTapsRequired( unsigned int maximumTaps ); + void SetMaximumTapsRequired( uint32_t maximumTaps ); public: // Getters @@ -171,7 +174,7 @@ public: // Getters * @return The minimum taps required * @pre The gesture detector has been initialized. */ - unsigned int GetMinimumTapsRequired() const; + uint32_t GetMinimumTapsRequired() const; /** * @brief Retrieves the maximum number of taps required. @@ -180,7 +183,7 @@ public: // Getters * @return The maximum taps required * @pre The gesture detector has been initialized. */ - unsigned int GetMaximumTapsRequired() const; + uint32_t GetMaximumTapsRequired() const; public: // Signals diff --git a/dali/public-api/events/tap-gesture.h b/dali/public-api/events/tap-gesture.h index e752400c3..6fc68524a 100644 --- a/dali/public-api/events/tap-gesture.h +++ b/dali/public-api/events/tap-gesture.h @@ -72,13 +72,13 @@ struct DALI_CORE_API TapGesture : public Gesture /** * @brief The number of taps in this tap gesture. */ - unsigned int numberOfTaps; + uint32_t numberOfTaps; /** * @brief The number of touch points in this tap gesture, i.e. the number of fingers the user had on the * screen to generate the tap gesture. */ - unsigned int numberOfTouches; + uint32_t numberOfTouches; /** * @brief This is the point, in screen coordinates, where the tap occurred. diff --git a/dali/public-api/events/touch-event.cpp b/dali/public-api/events/touch-event.cpp index 2ec741178..9a3a82174 100644 --- a/dali/public-api/events/touch-event.cpp +++ b/dali/public-api/events/touch-event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,12 +41,12 @@ TouchEvent::~TouchEvent() { } -unsigned int TouchEvent::GetPointCount() const +uint32_t TouchEvent::GetPointCount() const { - return points.size(); + return static_cast( points.size() ); } -const TouchPoint& TouchEvent::GetPoint(unsigned int point) const +const TouchPoint& TouchEvent::GetPoint( uint32_t point ) const { DALI_ASSERT_ALWAYS( point < points.size() && "No point at index" ); return points[point]; diff --git a/dali/public-api/events/touch-event.h b/dali/public-api/events/touch-event.h index 9ce558e53..f4adbf8fe 100644 --- a/dali/public-api/events/touch-event.h +++ b/dali/public-api/events/touch-event.h @@ -90,7 +90,7 @@ struct DALI_CORE_API TouchEvent * @SINCE_1_0.0 * @return Total number of Points */ - unsigned int GetPointCount() const DALI_DEPRECATED_API; + uint32_t GetPointCount() const DALI_DEPRECATED_API; /** * @DEPRECATED_1_1.37 @@ -104,7 +104,7 @@ struct DALI_CORE_API TouchEvent * @note "point" should be less than the value returned by GetPointCount(). * If out of range, then program asserts. */ - const TouchPoint& GetPoint(unsigned int point) const DALI_DEPRECATED_API; + const TouchPoint& GetPoint( uint32_t point ) const DALI_DEPRECATED_API; }; /** diff --git a/dali/public-api/events/touch-point.cpp b/dali/public-api/events/touch-point.cpp index dbc588d57..41a378570 100644 --- a/dali/public-api/events/touch-point.cpp +++ b/dali/public-api/events/touch-point.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ namespace Dali { -TouchPoint::TouchPoint(int id, State state, float screenX, float screenY) +TouchPoint::TouchPoint(int32_t id, State state, float screenX, float screenY) : deviceId(id), state(state), local(screenX, screenY), @@ -29,7 +29,7 @@ TouchPoint::TouchPoint(int id, State state, float screenX, float screenY) { } -TouchPoint::TouchPoint(int id, State state, float screenX, float screenY, float localX, float localY) +TouchPoint::TouchPoint(int32_t id, State state, float screenX, float screenY, float localX, float localY) : deviceId(id), state(state), local(localX, localY), diff --git a/dali/public-api/events/touch-point.h b/dali/public-api/events/touch-point.h index 671ea4d63..e6f099b31 100644 --- a/dali/public-api/events/touch-point.h +++ b/dali/public-api/events/touch-point.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -69,7 +72,7 @@ struct DALI_CORE_API TouchPoint * @param[in] screenX The X co-ordinate relative to the screen's origin * @param[in] screenY The Y co-ordinate relative to the screen's origin */ - TouchPoint(int id, State state, float screenX, float screenY); + TouchPoint(int32_t id, State state, float screenX, float screenY); /** * @brief Constructor. @@ -82,7 +85,7 @@ struct DALI_CORE_API TouchPoint * @param[in] localX The X co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor * @param[in] localY The Y co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor */ - TouchPoint(int id, State state, float screenX, float screenY, float localX, float localY); + TouchPoint(int32_t id, State state, float screenX, float screenY, float localX, float localY); /** * @brief Destructor. @@ -95,7 +98,7 @@ struct DALI_CORE_API TouchPoint /** * @brief Each touch point has a unique device ID which specifies the touch device for that point. */ - int deviceId; + int32_t deviceId; /** * @brief State of the point. diff --git a/dali/public-api/events/wheel-event.cpp b/dali/public-api/events/wheel-event.cpp index 5bbb2717c..7494ef02d 100644 --- a/dali/public-api/events/wheel-event.cpp +++ b/dali/public-api/events/wheel-event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ namespace Dali namespace { -const unsigned int MODIFIER_SHIFT = 0x1; -const unsigned int MODIFIER_CTRL = 0x2; -const unsigned int MODIFIER_ALT = 0x4; +const uint32_t MODIFIER_SHIFT = 0x1; +const uint32_t MODIFIER_CTRL = 0x2; +const uint32_t MODIFIER_ALT = 0x4; } @@ -39,7 +39,7 @@ WheelEvent::WheelEvent() { } -WheelEvent::WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp ) +WheelEvent::WheelEvent( Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t z, uint32_t timeStamp ) : type( type ), direction( direction ), modifiers( modifiers ), diff --git a/dali/public-api/events/wheel-event.h b/dali/public-api/events/wheel-event.h index a0edc8fb8..541b33eee 100644 --- a/dali/public-api/events/wheel-event.h +++ b/dali/public-api/events/wheel-event.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -72,7 +75,7 @@ struct DALI_CORE_API WheelEvent * @param[in] z The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise) * @param[in] timeStamp The time the wheel is being rolled */ - WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp ); + WheelEvent( Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t z, uint32_t timeStamp ); /** * @brief Destructor. @@ -118,12 +121,12 @@ struct DALI_CORE_API WheelEvent * * 0 means the default vertical wheel, and 1 means horizontal wheel. */ - int direction; + int32_t direction; /** * @brief Modifier keys pressed during the event (such as shift, alt and control). */ - unsigned int modifiers; + uint32_t modifiers; /** * @brief The co-ordinates of the cursor relative to the top-left of the screen @@ -135,12 +138,12 @@ struct DALI_CORE_API WheelEvent * @brief The offset of the wheel rolling, where positive value means rolling down or clockwise * and negative value means rolling up or counter-clockwise. */ - int z; + int32_t z; /** * @brief The time when the wheel is being rolled. */ - unsigned int timeStamp; + uint32_t timeStamp; }; diff --git a/dali/public-api/images/buffer-image.cpp b/dali/public-api/images/buffer-image.cpp index 6be47d348..205f4cc81 100644 --- a/dali/public-api/images/buffer-image.cpp +++ b/dali/public-api/images/buffer-image.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ const BufferImage BufferImage::WHITE() return BufferImage(internal); } -BufferImage BufferImage::New(unsigned int width, unsigned int height, Pixel::Format pixelformat) +BufferImage BufferImage::New(uint32_t width, uint32_t height, Pixel::Format pixelformat) { DALI_ASSERT_ALWAYS( 0u != width && "Invalid BufferImage width requested" ); DALI_ASSERT_ALWAYS( 0u != height && "Invalid BufferImage height requested" ); @@ -75,7 +75,7 @@ BufferImage BufferImage::New(unsigned int width, unsigned int height, Pixel::For return BufferImage(internal.Get()); } -BufferImage BufferImage::New(PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride) +BufferImage BufferImage::New(PixelBuffer* pixBuf, uint32_t width, uint32_t height, Pixel::Format pixelformat, uint32_t stride) { DALI_ASSERT_ALWAYS( 0u != width && "Invalid BufferImage width requested" ); DALI_ASSERT_ALWAYS( 0u != height && "Invalid BufferImage height requested" ); @@ -89,12 +89,12 @@ PixelBuffer* BufferImage::GetBuffer() return GetImplementation(*this).GetBuffer(); } -unsigned int BufferImage::GetBufferSize() const +uint32_t BufferImage::GetBufferSize() const { return GetImplementation(*this).GetBufferSize(); } -unsigned int BufferImage::GetBufferStride() const +uint32_t BufferImage::GetBufferStride() const { return GetImplementation(*this).GetBufferStride(); } diff --git a/dali/public-api/images/buffer-image.h b/dali/public-api/images/buffer-image.h index 1515f1183..a6d72ad93 100644 --- a/dali/public-api/images/buffer-image.h +++ b/dali/public-api/images/buffer-image.h @@ -35,8 +35,8 @@ namespace Internal DALI_INTERNAL class BufferImage; } -typedef unsigned char PixelBuffer; ///< pixel data buffer @SINCE_1_0.0 -typedef Rect RectArea; ///< rectangular area (x,y,w,h) @SINCE_1_0.0 +typedef uint8_t PixelBuffer; ///< pixel data buffer @SINCE_1_0.0 +typedef Rect RectArea; ///< rectangular area (x,y,w,h) @SINCE_1_0.0 /** @@ -84,8 +84,8 @@ public: * @note default resource management policies are Immediate and Never * */ - static BufferImage New(unsigned int width, - unsigned int height, + static BufferImage New(uint32_t width, + uint32_t height, Pixel::Format pixelformat=Pixel::RGBA8888) DALI_DEPRECATED_API; /** @@ -113,10 +113,10 @@ public: * @pre width & height are greater than zero */ static BufferImage New(PixelBuffer* pixelBuffer, - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Pixel::Format pixelFormat=Pixel::RGBA8888, - unsigned int stride=0) DALI_DEPRECATED_API; + uint32_t stride=0) DALI_DEPRECATED_API; /** * @DEPRECATED_1_2.41 @@ -200,7 +200,7 @@ public: * @SINCE_1_0.0 * @return The buffer size in bytes */ - unsigned int GetBufferSize() const DALI_DEPRECATED_API; + uint32_t GetBufferSize() const DALI_DEPRECATED_API; /** * @DEPRECATED_1_2.41 @@ -210,7 +210,7 @@ public: * @SINCE_1_0.0 * @return The buffer stride */ - unsigned int GetBufferStride() const DALI_DEPRECATED_API; + uint32_t GetBufferStride() const DALI_DEPRECATED_API; /** * @DEPRECATED_1_2.41 diff --git a/dali/public-api/images/encoded-buffer-image.h b/dali/public-api/images/encoded-buffer-image.h index d1605822d..49893c5ad 100644 --- a/dali/public-api/images/encoded-buffer-image.h +++ b/dali/public-api/images/encoded-buffer-image.h @@ -18,9 +18,6 @@ * */ -// EXTERNAL INCLUDES -#include - // INTERNAL INCLUDES #include #include diff --git a/dali/public-api/images/frame-buffer-image.cpp b/dali/public-api/images/frame-buffer-image.cpp index 5a973690f..572ce79cc 100644 --- a/dali/public-api/images/frame-buffer-image.cpp +++ b/dali/public-api/images/frame-buffer-image.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,12 +51,12 @@ FrameBufferImage& FrameBufferImage::operator=( const FrameBufferImage& rhs ) return *this; } -FrameBufferImage FrameBufferImage::New( unsigned int width, unsigned int height, Pixel::Format pixelformat, RenderBuffer::Format bufferformat ) +FrameBufferImage FrameBufferImage::New( uint32_t width, uint32_t height, Pixel::Format pixelformat, RenderBuffer::Format bufferformat ) { Dali::Vector2 stageSize = Stage::GetCurrent().GetSize(); Internal::FrameBufferImagePtr internal = Internal::FrameBufferImage::New( - (0 == width) ? stageSize.width : width, - (0 == height) ? stageSize.height : height, + (0 == width) ? static_cast( stageSize.width ) : width, + (0 == height) ? static_cast( stageSize.height ) : height, pixelformat, bufferformat); diff --git a/dali/public-api/images/frame-buffer-image.h b/dali/public-api/images/frame-buffer-image.h index d7f4051d0..623093235 100644 --- a/dali/public-api/images/frame-buffer-image.h +++ b/dali/public-api/images/frame-buffer-image.h @@ -91,7 +91,7 @@ public: * @return A handle to a new instance of a FrameBufferImage * @post When the FrameBufferImage is first used as a render target, an exception may be thrown if pixelFormat is not supported on the hardware platform. */ - static FrameBufferImage New(unsigned int width = 0, unsigned int height = 0, Pixel::Format pixelFormat = Pixel::RGBA8888, + static FrameBufferImage New(uint32_t width = 0, uint32_t height = 0, Pixel::Format pixelFormat = Pixel::RGBA8888, RenderBuffer::Format bufferFormat = RenderBuffer::COLOR) DALI_DEPRECATED_API; /** diff --git a/dali/public-api/images/image.cpp b/dali/public-api/images/image.cpp index a51297182..e5888ba76 100644 --- a/dali/public-api/images/image.cpp +++ b/dali/public-api/images/image.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,12 +53,12 @@ Image Image::DownCast( BaseHandle handle ) return Image( dynamic_cast(handle.GetObjectPtr()) ); } -unsigned int Image::GetWidth() const +uint32_t Image::GetWidth() const { return GetImplementation(*this).GetWidth(); } -unsigned int Image::GetHeight() const +uint32_t Image::GetHeight() const { return GetImplementation(*this).GetHeight(); } diff --git a/dali/public-api/images/image.h b/dali/public-api/images/image.h index 66af4ffd9..7c649a253 100644 --- a/dali/public-api/images/image.h +++ b/dali/public-api/images/image.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // uint32_t // INTERNAL INCLUDES #include @@ -138,7 +139,7 @@ public: * @SINCE_1_0.0 * @return Width of the image in pixels */ - unsigned int GetWidth() const DALI_DEPRECATED_API; + uint32_t GetWidth() const DALI_DEPRECATED_API; /** * @DEPRECATED_1_2.41 @@ -150,7 +151,7 @@ public: * @SINCE_1_0.0 * @return Height of the image in pixels */ - unsigned int GetHeight() const DALI_DEPRECATED_API; + uint32_t GetHeight() const DALI_DEPRECATED_API; public: // Signals diff --git a/dali/public-api/images/native-image-interface.h b/dali/public-api/images/native-image-interface.h index ea1811163..a3b45316f 100644 --- a/dali/public-api/images/native-image-interface.h +++ b/dali/public-api/images/native-image-interface.h @@ -2,7 +2,7 @@ #define __DALI_INTEGRATION_NATIVE_IMAGE_INTERFACE_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // uint32_t // INTERNAL INCLUDES #include @@ -69,7 +70,7 @@ public: * @return A GL error code * @pre There is a GL context for the current thread. */ - virtual unsigned int TargetTexture() = 0; + virtual uint32_t TargetTexture() = 0; /** * @brief Called internally for each Bind call for this texture to allow implementation specific operations. @@ -86,7 +87,7 @@ public: * @SINCE_1_0.0 * @return Width */ - virtual unsigned int GetWidth() const = 0; + virtual uint32_t GetWidth() const = 0; /** * @brief Returns the height of the NativeImage. @@ -94,7 +95,7 @@ public: * @SINCE_1_0.0 * @return Height */ - virtual unsigned int GetHeight() const = 0; + virtual uint32_t GetHeight() const = 0; /** * @brief Queries whether blending is required. diff --git a/dali/public-api/images/pixel-data.cpp b/dali/public-api/images/pixel-data.cpp index 1432b5da3..b4e7cb31b 100644 --- a/dali/public-api/images/pixel-data.cpp +++ b/dali/public-api/images/pixel-data.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,7 @@ */ // CLASS HEADER -#include "pixel-data.h" - -// EXTERNAL INLCUDES -#include +#include // INTERNAL INCLUDES #include @@ -27,12 +24,12 @@ namespace Dali { -PixelData PixelData::New(unsigned char* buffer, - unsigned int bufferSize, - unsigned int width, - unsigned int 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 = Internal::PixelData::New( buffer, bufferSize, width, height, pixelFormat, releaseFunction ); return PixelData( internal.Get() ); @@ -62,12 +59,12 @@ PixelData& PixelData::operator=(const PixelData& rhs) return *this; } -unsigned int PixelData::GetWidth() const +uint32_t PixelData::GetWidth() const { return GetImplementation(*this).GetWidth(); } -unsigned int PixelData::GetHeight() const +uint32_t PixelData::GetHeight() const { return GetImplementation(*this).GetHeight(); } diff --git a/dali/public-api/images/pixel-data.h b/dali/public-api/images/pixel-data.h index 234743397..19ffe3091 100644 --- a/dali/public-api/images/pixel-data.h +++ b/dali/public-api/images/pixel-data.h @@ -18,6 +18,10 @@ * */ +// EXTERNAL INCLUDES +#include // uint8_t, uint32_t + +// INTERNAL INCLUDES #include #include @@ -62,10 +66,10 @@ public: * @param[in] releaseFunction The function used to release the memory * @return A handle to the PixelData */ - static PixelData New( unsigned char* buffer, - unsigned int bufferSize, - unsigned int width, - unsigned int height, + static PixelData New( uint8_t* buffer, + uint32_t bufferSize, + uint32_t width, + uint32_t height, Pixel::Format pixelFormat, ReleaseFunction releaseFunction); @@ -107,7 +111,7 @@ public: * @SINCE_1_1.43 * @return The width of the buffer in pixels */ - unsigned int GetWidth() const; + uint32_t GetWidth() const; /** * @brief Gets the height of the buffer in pixels. @@ -115,7 +119,7 @@ public: * @SINCE_1_1.43 * @return The height of the buffer in pixels */ - unsigned int GetHeight() const; + uint32_t GetHeight() const; /** * @brief Gets the pixel format. diff --git a/dali/public-api/images/pixel.cpp b/dali/public-api/images/pixel.cpp index 725d9e0c2..b50816f32 100644 --- a/dali/public-api/images/pixel.cpp +++ b/dali/public-api/images/pixel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,7 +99,7 @@ bool Pixel::HasAlpha(Format pixelformat) return false; } -unsigned int Pixel::GetBytesPerPixel(Format pixelFormat) +uint32_t Pixel::GetBytesPerPixel(Format pixelFormat) { switch (pixelFormat) { diff --git a/dali/public-api/images/pixel.h b/dali/public-api/images/pixel.h index bb801670f..f699af4a3 100644 --- a/dali/public-api/images/pixel.h +++ b/dali/public-api/images/pixel.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include @@ -144,7 +147,7 @@ DALI_CORE_API bool HasAlpha(Format pixelformat); * @param[in] pixelFormat The pixel format * @return The number of bytes per pixel */ -DALI_CORE_API unsigned int GetBytesPerPixel(Format pixelFormat); +DALI_CORE_API uint32_t GetBytesPerPixel(Format pixelFormat); /** * @brief Returns the offset of the byte containing the alpha value from the start of the pixel data diff --git a/dali/public-api/math/math-utils.h b/dali/public-api/math/math-utils.h index 1c707198e..521d26616 100644 --- a/dali/public-api/math/math-utils.h +++ b/dali/public-api/math/math-utils.h @@ -2,7 +2,7 @@ #define __DALI_MATH_UTILS_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -38,9 +41,9 @@ 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 unsigned int NextPowerOfTwo( unsigned int i ) +inline uint32_t NextPowerOfTwo( uint32_t i ) { - DALI_ASSERT_ALWAYS(i <= 1u << (sizeof(unsigned) * 8 - 1) && "Return type cannot represent the next power of two greater than the argument."); + 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) { return 1u; @@ -63,7 +66,7 @@ inline unsigned int NextPowerOfTwo( unsigned int i ) * @param[in] i Input number * @return True if i is power of two. */ -inline bool IsPowerOfTwo( unsigned int i ) +inline bool IsPowerOfTwo( uint32_t i ) { return (i != 0u) && ((i & (i - 1u)) == 0u); } @@ -131,7 +134,7 @@ 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 int absI = absF; + const int32_t absI = static_cast( absF ); // truncated float epsilon = Math::MACHINE_EPSILON_10000; if (absF < 0.1f) @@ -207,12 +210,12 @@ inline bool Equals( float a, float b, float epsilon ) * @param[in] pos decimal place * @return a rounded float */ -inline float Round(float value, int pos) +inline float Round( float value, int32_t pos ) { float temp; - temp = value * powf( 10, pos ); - temp = floorf( temp + 0.5 ); - temp *= powf( 10, -pos ); + temp = value * powf( 10.f, static_cast( pos ) ); + temp = floorf( temp + 0.5f ); + temp *= powf( 10.f, static_cast( -pos ) ); return temp; } @@ -334,7 +337,7 @@ inline float ShortestDistanceInDomain( float a, float b, float start, float end * @return -1 for negative values, +1 for positive values and 0 if value is 0 */ template -int Sign( T value ) +int32_t Sign( T value ) { return ( T(0) < value ) - ( value < T(0) ); } diff --git a/dali/public-api/math/matrix.cpp b/dali/public-api/math/matrix.cpp index f21575b88..81630cd60 100644 --- a/dali/public-api/math/matrix.cpp +++ b/dali/public-api/math/matrix.cpp @@ -192,9 +192,9 @@ static bool InvertMatrix(const float* m, float* out) return false; } - det = 1.0 / det; + det = 1.0f / det; - for (int i = 0; i < 16; i++) + for( int32_t i = 0; i < 16; i++) { out[i] = inv[i] * det; } @@ -274,13 +274,13 @@ void Matrix::Multiply( Matrix& result, const Matrix& lhs, const Matrix& rhs ) #ifndef __ARM_NEON__ - for( int i=0; i < 4; i++ ) + for( int32_t i=0; i < 4; i++ ) { // i<<2 gives the first vector / column - int loc = i<<2; - int loc1 = loc + 1; - int loc2 = loc + 2; - int loc3 = loc + 3; + 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]; @@ -360,13 +360,13 @@ void Matrix::Multiply( Matrix& result, const Matrix& lhs, const Quaternion& rhs #ifndef __ARM_NEON__ - for( int i=0; i < 4; i++ ) + for( int32_t i=0; i < 4; i++ ) { // i<<2 gives the first vector / column - int loc = i<<2; - int loc1 = loc + 1; - int loc2 = loc + 2; - int loc3 = loc + 3; + 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]; diff --git a/dali/public-api/math/matrix3.cpp b/dali/public-api/math/matrix3.cpp index 50f790342..acb274f55 100644 --- a/dali/public-api/math/matrix3.cpp +++ b/dali/public-api/math/matrix3.cpp @@ -136,8 +136,8 @@ bool Matrix3::Invert() // In the case where the determinant is exactly zero, the matrix is non-invertible if( ! EqualsZero( det ) ) { - det = 1.0 / det; - for (int i = 0; i < 9; i++) + det = 1.0f / det; + for( int32_t i = 0; i < 9; i++ ) { mElements[i] = cof[i] * det; } @@ -237,11 +237,11 @@ void Matrix3::Multiply( Matrix3& result, const Matrix3& lhs, const Matrix3& rhs const float* rhsPtr = rhs.AsFloat(); const float* lhsPtr = lhs.AsFloat(); - for( int i=0; i < 3; i++ ) + for( int32_t i=0; i < 3; i++ ) { - int loc = i * 3; - int loc1 = loc + 1; - int loc2 = loc + 2; + int32_t loc = i * 3; + int32_t loc1 = loc + 1; + int32_t loc2 = loc + 2; float value0 = lhsPtr[loc]; float value1 = lhsPtr[loc1]; diff --git a/dali/public-api/math/quaternion.cpp b/dali/public-api/math/quaternion.cpp index 93db03655..853cb09aa 100644 --- a/dali/public-api/math/quaternion.cpp +++ b/dali/public-api/math/quaternion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -470,7 +470,7 @@ float Quaternion::AngleBetween( const Quaternion& q1, const Quaternion& 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 = acos( (2 * X * X) - 1); + float theta = acosf( (2 * X * X) - 1); // float arc cosine return theta; } diff --git a/dali/public-api/math/random.h b/dali/public-api/math/random.h index 2d5d2372a..1b0895694 100644 --- a/dali/public-api/math/random.h +++ b/dali/public-api/math/random.h @@ -2,7 +2,7 @@ #define __DALI_RANDOM_H__ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,13 +54,13 @@ inline float Range(float f0, float f1) static bool initialized( false ); if( !initialized ) { - auto seed = time( NULL ); + uint32_t seed = static_cast( time( NULL ) ); srand( seed ); initialized = true; } - auto randValue = rand(); - return (randValue & 0xfff) * (1.0f/4095.0f) * (max-min) + min; + int32_t randValue = rand(); + return static_cast(randValue & 0xfff) * (1.0f/4095.0f) * (max-min) + min; } /** diff --git a/dali/public-api/math/vector2.h b/dali/public-api/math/vector2.h index 1ecd8f308..2d7df3368 100644 --- a/dali/public-api/math/vector2.h +++ b/dali/public-api/math/vector2.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include // uint32_t #include // INTERNAL INCLUDES @@ -354,7 +355,7 @@ public: * @param[in] index Subscript index * @return The float at the given index */ - const float& operator[](const unsigned int index) const + const float& operator[](const uint32_t index) const { DALI_ASSERT_ALWAYS( index < 2 && "Vector element index out of bounds" ); @@ -369,7 +370,7 @@ public: * @param[in] index Subscript index * @return The float at the given index */ - float& operator[](const unsigned int index) + float& operator[](const uint32_t index) { DALI_ASSERT_ALWAYS( index < 2 && "Vector element index out of bounds" ); diff --git a/dali/public-api/math/vector3.h b/dali/public-api/math/vector3.h index 1d24444df..1a98005ec 100644 --- a/dali/public-api/math/vector3.h +++ b/dali/public-api/math/vector3.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include // uint32_t #include // INTERNAL INCLUDES @@ -382,7 +383,7 @@ struct DALI_CORE_API Vector3 * @param[in] index Subscript index * @return The float at the given index */ - const float& operator[](const unsigned int index) const + const float& operator[](const uint32_t index) const { DALI_ASSERT_ALWAYS( index < 3 && "Vector element index out of bounds" ); @@ -397,7 +398,7 @@ struct DALI_CORE_API Vector3 * @param[in] index Subscript index * @return The float at the given index */ - float& operator[](const unsigned int index) + float& operator[](const uint32_t index) { DALI_ASSERT_ALWAYS( index < 3 && "Vector element index out of bounds" ); diff --git a/dali/public-api/math/vector4.h b/dali/public-api/math/vector4.h index 7516001b1..a42c55a29 100644 --- a/dali/public-api/math/vector4.h +++ b/dali/public-api/math/vector4.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include // uint32_t #include // INTERNAL INCLUDES @@ -388,7 +389,7 @@ struct DALI_CORE_API Vector4 * @param[in] index Subscript index * @return The float at the given index */ - const float& operator[](const unsigned int index) const + const float& operator[](const uint32_t index) const { DALI_ASSERT_ALWAYS( index < 4 && "Vector element index out of bounds" ); @@ -403,7 +404,7 @@ struct DALI_CORE_API Vector4 * @param[in] index Subscript index * @return The float at the given index */ - float& operator[](const unsigned int index) + float& operator[](const uint32_t index) { DALI_ASSERT_ALWAYS( index < 4 && "Vector element index out of bounds" ); diff --git a/dali/public-api/math/viewport.h b/dali/public-api/math/viewport.h index cec1c15a9..b137a64f4 100644 --- a/dali/public-api/math/viewport.h +++ b/dali/public-api/math/viewport.h @@ -2,7 +2,7 @@ #define __DALI_VIEWPORT_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // int32_t + // INTERNAL INCLUDES #include @@ -32,7 +35,7 @@ namespace Dali * @brief Typedef for a viewport ( a rectangle representing a screen area ). * @SINCE_1_0.0 */ -typedef Rect Viewport; +typedef Rect Viewport; /** * @} diff --git a/dali/public-api/object/any.h b/dali/public-api/object/any.h index 4752fc057..e3fac2a38 100644 --- a/dali/public-api/object/any.h +++ b/dali/public-api/object/any.h @@ -41,7 +41,7 @@ namespace Dali * Any floatVariable( 4.5f ); * Any strVariable( std::string( "Hello world" ) ); * uintVariable = 1u; - * unsigned int variable = AnyCast< unsigned int >( uintVariable ); + * uint32_t variable = AnyCast< uint32_t >( uintVariable ); * if ( typeid( int ) == uintVariable.GetType() ) * \endcode * @SINCE_1_0.0 diff --git a/dali/public-api/object/handle.cpp b/dali/public-api/object/handle.cpp index 962824042..f5a91716c 100644 --- a/dali/public-api/object/handle.cpp +++ b/dali/public-api/object/handle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +75,7 @@ bool Handle::Supports( Capability capability ) const return GetImplementation(*this).Supports( capability ); } -unsigned int Handle::GetPropertyCount() const +uint32_t Handle::GetPropertyCount() const { return GetImplementation(*this).GetPropertyCount(); } @@ -168,7 +168,7 @@ void Handle::RemoveConstraints() GetImplementation(*this).RemoveConstraints(); } -void Handle::RemoveConstraints( unsigned int tag ) +void Handle::RemoveConstraints( uint32_t tag ) { GetImplementation(*this).RemoveConstraints( tag ); } diff --git a/dali/public-api/object/handle.h b/dali/public-api/object/handle.h index a7fcb3615..18942357b 100644 --- a/dali/public-api/object/handle.h +++ b/dali/public-api/object/handle.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // uint32_t // INTERNAL INCLUDES #include @@ -155,7 +156,7 @@ public: * @SINCE_1_0.0 * @return The number of properties */ - unsigned int GetPropertyCount() const; + uint32_t GetPropertyCount() const; /** * @brief Queries the name of a property. @@ -390,7 +391,7 @@ public: * @param[in] tag The tag of the constraints which will be removed * @pre The Object has been initialized. */ - void RemoveConstraints( unsigned int tag ); + void RemoveConstraints( uint32_t tag ); }; /** diff --git a/dali/public-api/object/property-array.cpp b/dali/public-api/object/property-array.cpp index eca8182d1..7fe844732 100644 --- a/dali/public-api/object/property-array.cpp +++ b/dali/public-api/object/property-array.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -105,7 +105,7 @@ Property::Array& Property::Array::operator=( const Property::Array& other ) std::ostream& operator<<( std::ostream& stream, const Property::Array& array ) { stream << "Array(" << array.Count() << ") = ["; - for( unsigned int i=0; i0 ) { diff --git a/dali/public-api/object/property-map.cpp b/dali/public-api/object/property-map.cpp index ebd95a8b9..675d91068 100644 --- a/dali/public-api/object/property-map.cpp +++ b/dali/public-api/object/property-map.cpp @@ -327,7 +327,7 @@ std::ostream& operator<<( std::ostream& stream, const Property::Map& map ) { stream << "Map(" << map.Count() << ") = {"; - int count = 0; + int32_t count = 0; // Output the String-Value pairs for ( StringValueContainer::iterator iter = map.mImpl->mStringValueContainer.begin(), endIter = map.mImpl->mStringValueContainer.end(); iter != endIter; ++iter ) { diff --git a/dali/public-api/object/property-types.cpp b/dali/public-api/object/property-types.cpp index 67264aec6..f9ac88caf 100644 --- a/dali/public-api/object/property-types.cpp +++ b/dali/public-api/object/property-types.cpp @@ -41,7 +41,7 @@ const char* const PROPERTY_TYPE_NAMES[] = "MAP", "EXTENTS", }; -const unsigned int PROPERTY_TYPE_NAMES_COUNT = sizeof( PROPERTY_TYPE_NAMES ) / sizeof( const char* ); +const uint32_t PROPERTY_TYPE_NAMES_COUNT = static_cast( sizeof( PROPERTY_TYPE_NAMES ) / sizeof( const char* ) ); } namespace PropertyTypes diff --git a/dali/public-api/object/property-value.cpp b/dali/public-api/object/property-value.cpp index 6c3738d6d..e02e8ce29 100644 --- a/dali/public-api/object/property-value.cpp +++ b/dali/public-api/object/property-value.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ struct Property::Value::Impl floatValue( floatValue ) { } - Impl( int integerValue ) + Impl( int32_t integerValue ) : type( Property::INTEGER ), integerValue( integerValue ) { } @@ -119,7 +119,7 @@ struct Property::Value::Impl { } - Impl( const Rect& rectValue ) + Impl( const Rect& rectValue ) : type( Property::RECTANGLE ), rectValue( new Rect( rectValue ) ) { @@ -220,7 +220,7 @@ public: // Data Type type; union { - int integerValue; + int32_t integerValue; float floatValue; // must use pointers for any class value pre c++ 11 Vector2* vector2Value; @@ -230,7 +230,7 @@ public: // Data Matrix* matrixValue; AngleAxis* angleAxisValue; std::string* stringValue; - Rect* rectValue; + Rect* rectValue; Property::Array* arrayValue; Property::Map* mapValue; Extents* extentsValue; @@ -257,7 +257,7 @@ Property::Value::Value( float floatValue ) { } -Property::Value::Value( int integerValue ) +Property::Value::Value( int32_t integerValue ) : mImpl( new Impl( integerValue ) ) { } @@ -372,7 +372,7 @@ Property::Value::Value( Type type ) } case Property::RECTANGLE: { - mImpl = new Impl( Rect(0,0,0,0) ); + mImpl = new Impl( Rect(0,0,0,0) ); break; } case Property::ROTATION: @@ -663,7 +663,7 @@ bool Property::Value::Get( int& integerValue ) const } else if( mImpl->type == FLOAT ) { - integerValue = static_cast< int >( mImpl->floatValue ); + integerValue = static_cast< int32_t >( mImpl->floatValue ); converted = true; } } diff --git a/dali/public-api/object/property-value.h b/dali/public-api/object/property-value.h index 4cb607e34..b0548109a 100755 --- a/dali/public-api/object/property-value.h +++ b/dali/public-api/object/property-value.h @@ -71,7 +71,7 @@ public: * @SINCE_1_0.0 * @param[in] integerValue An integer value */ - Value( int integerValue ); + Value( int32_t integerValue ); /** * @brief Creates a float property value. @@ -127,7 +127,7 @@ public: * @SINCE_1_0.0 * @param[in] vectorValue A vector of 4 integer values */ - Value( const Rect& vectorValue ); + Value( const Rect& vectorValue ); /** * @brief Creates an orientation property value. @@ -270,7 +270,7 @@ public: * @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( int& integerValue ) const; + bool Get( int32_t& integerValue ) const; /** * @brief Retrieves an integer rectangle. @@ -280,7 +280,7 @@ public: * @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. */ - bool Get( Rect& rect ) const; + bool Get( Rect& rect ) const; /** * @brief Retrieves a vector value. diff --git a/dali/public-api/object/property.cpp b/dali/public-api/object/property.cpp index ba6cf7da2..1ac845347 100644 --- a/dali/public-api/object/property.cpp +++ b/dali/public-api/object/property.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,9 @@ namespace Dali { -const int Property::INVALID_INDEX = -1; -const int Property::INVALID_KEY = -1; -const int Property::INVALID_COMPONENT_INDEX = -1; +const int32_t Property::INVALID_INDEX = -1; +const int32_t Property::INVALID_KEY = -1; +const int32_t Property::INVALID_COMPONENT_INDEX = -1; Property::Property(Handle& obj, Property::Index propIndex) : object(obj), @@ -35,7 +35,7 @@ Property::Property(Handle& obj, Property::Index propIndex) { } -Property::Property(Handle& obj, Property::Index propIndex, int compIndex) +Property::Property(Handle& obj, Property::Index propIndex, int32_t compIndex) : object(obj), propertyIndex(propIndex), componentIndex(compIndex) @@ -50,7 +50,7 @@ Property::Property(Handle& obj, const std::string& propertyName) propertyIndex = object.GetPropertyIndex( propertyName ); } -Property::Property(Handle& obj, const std::string& propertyName, int compIndex) +Property::Property(Handle& obj, const std::string& propertyName, int32_t compIndex) : object(obj), propertyIndex(Property::INVALID_INDEX), componentIndex(compIndex) diff --git a/dali/public-api/object/property.h b/dali/public-api/object/property.h index 54bf2ec82..60236e9cf 100644 --- a/dali/public-api/object/property.h +++ b/dali/public-api/object/property.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include // int32_t // INTERNAL INCLUDES #include @@ -45,11 +46,11 @@ struct DALI_CORE_API Property * @brief A valid property index is zero or greater. * @SINCE_1_0.0 */ - typedef int Index; + typedef int32_t Index; - static const int INVALID_INDEX; ///< -1 is not a valid property index - static const int INVALID_KEY; ///< -1 is not a valid property key - static const int INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index + static const int32_t INVALID_INDEX; ///< -1 is not a valid property index + static const int32_t INVALID_KEY; ///< -1 is not a valid property key + static const int32_t INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices @SINCE_1_0.0 @@ -128,7 +129,7 @@ struct DALI_CORE_API Property * @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, int componentIndex ); + Property( Handle& object, Property::Index propertyIndex, int32_t componentIndex ); /** * @brief Creates a Property instance. @@ -151,7 +152,7 @@ struct DALI_CORE_API Property * @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, int componentIndex ); + Property( Handle& object, const std::string& propertyName, int32_t componentIndex ); /** * @brief Non-virtual destructor; Property is not intended as a base class. @@ -163,7 +164,7 @@ struct DALI_CORE_API Property Index propertyIndex; ///< The index of a property provided by object. - int componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property + int32_t componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property }; /** diff --git a/dali/public-api/object/ref-object.cpp b/dali/public-api/object/ref-object.cpp index 3060f4b48..cdd3546cb 100644 --- a/dali/public-api/object/ref-object.cpp +++ b/dali/public-api/object/ref-object.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -161,7 +161,7 @@ void RefObject::Unreference() } } -int RefObject::ReferenceCount() +uint32_t RefObject::ReferenceCount() { return mCount; } diff --git a/dali/public-api/object/ref-object.h b/dali/public-api/object/ref-object.h index 3ead40092..553a1fe83 100644 --- a/dali/public-api/object/ref-object.h +++ b/dali/public-api/object/ref-object.h @@ -19,6 +19,9 @@ */ // EXTERNAL INCLUDES +#include // uint32_t + +// INTERNAL INCLUDES #include #include @@ -62,7 +65,7 @@ public: * @SINCE_1_0.0 * @return The reference count */ - int ReferenceCount(); + uint32_t ReferenceCount(); protected: @@ -101,7 +104,7 @@ protected: private: - volatile int mCount; ///< Reference count + volatile uint32_t mCount; ///< Reference count }; /** diff --git a/dali/public-api/object/type-registry.cpp b/dali/public-api/object/type-registry.cpp index ed1bb70ca..40686c915 100644 --- a/dali/public-api/object/type-registry.cpp +++ b/dali/public-api/object/type-registry.cpp @@ -149,7 +149,7 @@ AnimatablePropertyRegistration::AnimatablePropertyRegistration( TypeRegistration Internal::TypeRegistry::Get()->RegisterAnimatableProperty( registered, name, index, value ); } -AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int 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 ) ); diff --git a/dali/public-api/object/type-registry.h b/dali/public-api/object/type-registry.h index 89d28bdb5..7f5715db2 100644 --- a/dali/public-api/object/type-registry.h +++ b/dali/public-api/object/type-registry.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include +#include // uint32_t // INTERNAL INCLUDES #include @@ -378,7 +379,7 @@ public: * @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, unsigned int componentIndex ); + AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex ); }; /** diff --git a/dali/public-api/render-tasks/render-task-list.cpp b/dali/public-api/render-tasks/render-task-list.cpp index 7bd754b3c..8f8359c74 100644 --- a/dali/public-api/render-tasks/render-task-list.cpp +++ b/dali/public-api/render-tasks/render-task-list.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,12 +58,12 @@ void RenderTaskList::RemoveTask( RenderTask task ) GetImplementation(*this).RemoveTask( task ); } -unsigned int RenderTaskList::GetTaskCount() const +uint32_t RenderTaskList::GetTaskCount() const { return GetImplementation(*this).GetTaskCount(); } -RenderTask RenderTaskList::GetTask( unsigned int index ) const +RenderTask RenderTaskList::GetTask( uint32_t index ) const { return GetImplementation(*this).GetTask( index ); } diff --git a/dali/public-api/render-tasks/render-task-list.h b/dali/public-api/render-tasks/render-task-list.h index 7f4b55785..47bcb7a4e 100644 --- a/dali/public-api/render-tasks/render-task-list.h +++ b/dali/public-api/render-tasks/render-task-list.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include @@ -113,7 +116,7 @@ public: * @SINCE_1_0.0 * @return The number of render-tasks */ - unsigned int GetTaskCount() const; + uint32_t GetTaskCount() const; /** * @brief Retrieves a render-task. @@ -123,7 +126,7 @@ public: * @return A handle to the render-task * @pre index should be in range i.e. less than GetTaskCount(). */ - RenderTask GetTask( unsigned int index ) const; + RenderTask GetTask( uint32_t index ) const; public: // Not intended for application developers diff --git a/dali/public-api/render-tasks/render-task.cpp b/dali/public-api/render-tasks/render-task.cpp index b9545ab2f..099a0aded 100644 --- a/dali/public-api/render-tasks/render-task.cpp +++ b/dali/public-api/render-tasks/render-task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,12 +43,12 @@ static bool FullScreenFrameBufferFunction( Vector2& coordinates ) RenderTask::ConstScreenToFrameBufferFunction RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION = DefaultScreenToFrameBufferFunction; RenderTask::ConstScreenToFrameBufferFunction RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION = FullScreenFrameBufferFunction; -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 bool RenderTask::DEFAULT_CLEAR_ENABLED = false; -const bool RenderTask::DEFAULT_CULL_MODE = true; -const unsigned int RenderTask::DEFAULT_REFRESH_RATE = REFRESH_ALWAYS; +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 bool RenderTask::DEFAULT_CLEAR_ENABLED = false; +const bool RenderTask::DEFAULT_CULL_MODE = true; +const uint32_t RenderTask::DEFAULT_REFRESH_RATE = REFRESH_ALWAYS; RenderTask::RenderTask() { @@ -241,12 +241,12 @@ bool RenderTask::GetCullMode() const return GetImplementation(*this).GetCullMode(); } -void RenderTask::SetRefreshRate( unsigned int refreshRate ) +void RenderTask::SetRefreshRate( uint32_t refreshRate ) { GetImplementation(*this).SetRefreshRate( refreshRate ); } -unsigned int RenderTask::GetRefreshRate() const +uint32_t RenderTask::GetRefreshRate() const { return GetImplementation(*this).GetRefreshRate(); } diff --git a/dali/public-api/render-tasks/render-task.h b/dali/public-api/render-tasks/render-task.h index 6ca2b0655..064f5359f 100644 --- a/dali/public-api/render-tasks/render-task.h +++ b/dali/public-api/render-tasks/render-task.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -171,12 +174,12 @@ public: REFRESH_ALWAYS = 1 ///< Process every frame. @SINCE_1_0.0 }; - static const bool DEFAULT_EXCLUSIVE; ///< false - static const bool DEFAULT_INPUT_ENABLED; ///< true - static const Vector4 DEFAULT_CLEAR_COLOR; ///< Color::BLACK - static const bool DEFAULT_CLEAR_ENABLED; ///< false - static const bool DEFAULT_CULL_MODE; ///< true - static const unsigned int DEFAULT_REFRESH_RATE; ///< REFRESH_ALWAYS + static const bool DEFAULT_EXCLUSIVE; ///< false + static const bool DEFAULT_INPUT_ENABLED; ///< true + static const Vector4 DEFAULT_CLEAR_COLOR; ///< Color::BLACK + static const bool DEFAULT_CLEAR_ENABLED; ///< false + static const bool DEFAULT_CULL_MODE; ///< true + static const uint32_t DEFAULT_REFRESH_RATE; ///< REFRESH_ALWAYS /** * @brief Creates an empty RenderTask handle. @@ -473,14 +476,14 @@ public: * @SINCE_1_0.0 * @param[in] refreshRate The new refresh rate */ - void SetRefreshRate( unsigned int refreshRate ); + void SetRefreshRate( uint32_t refreshRate ); /** * @brief Queries the refresh-rate of the RenderTask. * @SINCE_1_0.0 * @return The refresh-rate */ - unsigned int GetRefreshRate() const; + uint32_t GetRefreshRate() const; /** * @brief Gets viewport coordinates for given world position. diff --git a/dali/public-api/rendering/frame-buffer.cpp b/dali/public-api/rendering/frame-buffer.cpp index af6b8e14c..607a79bc0 100644 --- a/dali/public-api/rendering/frame-buffer.cpp +++ b/dali/public-api/rendering/frame-buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use *this file except in compliance with the License. @@ -25,7 +25,7 @@ namespace Dali { -FrameBuffer FrameBuffer::New( unsigned int width, unsigned int height, unsigned int attachments ) +FrameBuffer FrameBuffer::New( uint32_t width, uint32_t height, uint32_t attachments ) { Internal::FrameBufferPtr frameBuffer = Internal::FrameBuffer::New( width, height, attachments ); return FrameBuffer( frameBuffer.Get() ); @@ -65,7 +65,7 @@ void FrameBuffer::AttachColorTexture( Texture& texture ) AttachColorTexture( texture, 0u, 0u ); } -void FrameBuffer::AttachColorTexture( Texture& texture, unsigned int mipmapLevel, unsigned int layer ) +void FrameBuffer::AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer ) { if( texture ) { diff --git a/dali/public-api/rendering/frame-buffer.h b/dali/public-api/rendering/frame-buffer.h index 9663d55cc..30c5e6de4 100644 --- a/dali/public-api/rendering/frame-buffer.h +++ b/dali/public-api/rendering/frame-buffer.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include // uint32_t + // INTERNAL INCLUDES #include #include @@ -72,7 +75,7 @@ public: * @param[in] attachments The attachments comprising the format of the FrameBuffer (the type is int to allow multiple bitmasks to be ORd) * @return A handle to a newly allocated FrameBuffer */ - static FrameBuffer New( unsigned int width, unsigned int height, unsigned int attachments ); + static FrameBuffer New( uint32_t width, uint32_t height, uint32_t attachments ); /** * @brief Default constructor, creates an empty handle. @@ -133,7 +136,7 @@ public: * @note The specified texture mipmap has to have the same size than the FrameBuffer * otherwise it won't be attached. */ - void AttachColorTexture( Texture& texture, unsigned int mipmapLevel, unsigned int layer ); + void AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer ); /** * @brief Gets the color texture used as output in the FrameBuffer. diff --git a/dali/public-api/rendering/geometry.cpp b/dali/public-api/rendering/geometry.cpp index 43dfb0d8b..81b9e8e18 100644 --- a/dali/public-api/rendering/geometry.cpp +++ b/dali/public-api/rendering/geometry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use *this file except in compliance with the License. @@ -70,7 +70,7 @@ void Geometry::RemoveVertexBuffer( std::size_t index ) GetImplementation(*this).RemoveVertexBuffer( index ); } -void Geometry::SetIndexBuffer( const unsigned short* indices, size_t count ) +void Geometry::SetIndexBuffer( const uint16_t* indices, size_t count ) { GetImplementation(*this).SetIndexBuffer( indices, count ); } diff --git a/dali/public-api/rendering/geometry.h b/dali/public-api/rendering/geometry.h index 1c1732e6c..70c94c979 100644 --- a/dali/public-api/rendering/geometry.h +++ b/dali/public-api/rendering/geometry.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include // std::size_t +#include // uint16_t // INTERNAL INCLUDES #include // Dali::Handle @@ -144,7 +145,7 @@ public: * @param[in] indices Array of indices * @param[in] count Number of indices in the array */ - void SetIndexBuffer( const unsigned short* indices, size_t count ); + void SetIndexBuffer( const uint16_t* indices, size_t count ); /** * @brief Sets the type of primitives this geometry contains. diff --git a/dali/public-api/rendering/property-buffer.cpp b/dali/public-api/rendering/property-buffer.cpp index b62e5e69c..75e2b0c67 100644 --- a/dali/public-api/rendering/property-buffer.cpp +++ b/dali/public-api/rendering/property-buffer.cpp @@ -58,7 +58,7 @@ PropertyBuffer& PropertyBuffer::operator=( const PropertyBuffer& handle ) void PropertyBuffer::SetData( const void* data, std::size_t size ) { - GetImplementation(*this).SetData( data, size ); + GetImplementation(*this).SetData( data, static_cast( size ) ); // only support 4,294,967,295 bytes } std::size_t PropertyBuffer::GetSize() const diff --git a/dali/public-api/rendering/property-buffer.h b/dali/public-api/rendering/property-buffer.h index ca8b913a4..fb51a1349 100644 --- a/dali/public-api/rendering/property-buffer.h +++ b/dali/public-api/rendering/property-buffer.h @@ -56,7 +56,7 @@ class PropertyBuffer; * texturedQuadVertices.SetData( texturedQuadVertexData, 4 ); * * // Create indices - * unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 }; + * uint32_t indexData[6] = { 0, 3, 1, 0, 2, 3 }; * * // Create the geometry object * Geometry texturedQuadGeometry = Geometry::New(); diff --git a/dali/public-api/rendering/texture-set.cpp b/dali/public-api/rendering/texture-set.cpp index 261e597e9..cc48b113b 100644 --- a/dali/public-api/rendering/texture-set.cpp +++ b/dali/public-api/rendering/texture-set.cpp @@ -61,17 +61,17 @@ void TextureSet::SetTexture( size_t index, Texture texture ) if( texture ) { Internal::TexturePtr texturePtr( &GetImplementation( texture ) ); - GetImplementation(*this).SetTexture( index, texturePtr ); + GetImplementation(*this).SetTexture( static_cast( index ), texturePtr ); // only support 4,294,967,295 textures } else { - GetImplementation(*this).SetTexture( index, NULL ); + GetImplementation(*this).SetTexture( static_cast( index ), NULL ); // only support 4,294,967,295 textures } } Texture TextureSet::GetTexture( size_t index ) const { - Internal::Texture* texturePtr = GetImplementation(*this).GetTexture( index ); + Internal::Texture* texturePtr = GetImplementation(*this).GetTexture( static_cast( index ) ); // only support 4,294,967,295 textures return Dali::Texture( texturePtr ); } @@ -80,17 +80,17 @@ void TextureSet::SetSampler( size_t index, Sampler sampler ) if( sampler ) { Internal::SamplerPtr samplerPtr( &GetImplementation( sampler ) ); - GetImplementation(*this).SetSampler( index, samplerPtr ); + GetImplementation(*this).SetSampler( static_cast( index ), samplerPtr ); // only support 4,294,967,295 samplers } else { - GetImplementation(*this).SetSampler( index, NULL ); + GetImplementation(*this).SetSampler( static_cast( index ), NULL ); // only support 4,294,967,295 samplers } } Sampler TextureSet::GetSampler( size_t index ) const { - Internal::Sampler* samplerPtr = GetImplementation(*this).GetSampler( index ); + Internal::Sampler* samplerPtr = GetImplementation(*this).GetSampler( static_cast( index ) ); // only support 4,294,967,295 samplers return Dali::Sampler( samplerPtr ); } diff --git a/dali/public-api/rendering/texture.cpp b/dali/public-api/rendering/texture.cpp index 79720cf11..f23a3f22e 100644 --- a/dali/public-api/rendering/texture.cpp +++ b/dali/public-api/rendering/texture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use *this file except in compliance with the License. @@ -26,7 +26,7 @@ namespace Dali { -Texture Texture::New( TextureType::Type type, Pixel::Format format, unsigned int width, unsigned int 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() ); @@ -69,9 +69,9 @@ bool Texture::Upload( PixelData pixelData ) } bool Texture::Upload( PixelData pixelData, - unsigned int layer, unsigned int mipmap, - unsigned int xOffset, unsigned int yOffset, - unsigned int width, unsigned int height ) + 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 ); @@ -82,12 +82,12 @@ void Texture::GenerateMipmaps() return GetImplementation(*this).GenerateMipmaps(); } -unsigned int Texture::GetWidth() const +uint32_t Texture::GetWidth() const { return GetImplementation(*this).GetWidth(); } -unsigned int Texture::GetHeight() const +uint32_t Texture::GetHeight() const { return GetImplementation(*this).GetHeight(); } diff --git a/dali/public-api/rendering/texture.h b/dali/public-api/rendering/texture.h index bbf2e6735..35699047c 100644 --- a/dali/public-api/rendering/texture.h +++ b/dali/public-api/rendering/texture.h @@ -55,12 +55,12 @@ namespace CubeMapLayer * These constants should be used as the "layer" parameter when uploading a cube-map with Texture::Upload. * @SINCE_1_1.43 */ - const unsigned int POSITIVE_X = 0u; ///< CubeMap image for +x @SINCE_1_1.43 - const unsigned int NEGATIVE_X = 1u; ///< CubeMap image for -x @SINCE_1_1.43 - const unsigned int POSITIVE_Y = 2u; ///< CubeMap image for +y @SINCE_1_1.43 - const unsigned int NEGATIVE_Y = 3u; ///< CubeMap image for -y @SINCE_1_1.43 - const unsigned int POSITIVE_Z = 4u; ///< CubeMap image for +z @SINCE_1_1.43 - const unsigned int 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 @@ -83,7 +83,7 @@ public: * @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, unsigned int width, unsigned int 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. @@ -161,9 +161,9 @@ public: * @return True if the PixelData object has compatible pixel format and fits in the rectangle specified, false otherwise */ bool Upload( PixelData pixelData, - unsigned int layer, unsigned int mipmap, - unsigned int xOffset, unsigned int yOffset, - unsigned int width, unsigned int height ); + uint32_t layer, uint32_t mipmap, + uint32_t xOffset, uint32_t yOffset, + uint32_t width, uint32_t height ); /** * @brief Generates mipmaps for the texture. @@ -179,7 +179,7 @@ public: * @SINCE_1_1.43 * @return The width, in pixels, of the texture */ - unsigned int GetWidth() const; + uint32_t GetWidth() const; /** * @brief Returns the height of the texture. @@ -187,7 +187,7 @@ public: * @SINCE_1_1.43 * @return The height, in pixels, of the texture */ - unsigned int GetHeight() const; + uint32_t GetHeight() const; public: diff --git a/dali/public-api/signals/base-signal.cpp b/dali/public-api/signals/base-signal.cpp index c84393ac6..b03f9d0f6 100644 --- a/dali/public-api/signals/base-signal.cpp +++ b/dali/public-api/signals/base-signal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ namespace { -const int INVALID_CALLBACK_INDEX = -1; +const int32_t INVALID_CALLBACK_INDEX = -1; } // unnamed namespace @@ -120,7 +120,7 @@ void BaseSignal::OnConnect( CallbackBase* callback ) { DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Connect()" ); - int index = FindCallback( callback ); + int32_t index = FindCallback( callback ); // Don't double-connect the same callback if( INVALID_CALLBACK_INDEX == index ) @@ -141,7 +141,7 @@ void BaseSignal::OnDisconnect( CallbackBase* callback ) { DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Disconnect()" ); - int index = FindCallback( callback ); + int32_t index = FindCallback( callback ); if( index > INVALID_CALLBACK_INDEX ) { @@ -157,7 +157,7 @@ void BaseSignal::OnConnect( ConnectionTrackerInterface* tracker, CallbackBase* c DALI_ASSERT_ALWAYS( NULL != tracker && "Invalid ConnectionTrackerInterface pointer passed to Connect()" ); DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Connect()" ); - int index = FindCallback( callback ); + int32_t index = FindCallback( callback ); // Don't double-connect the same callback if( INVALID_CALLBACK_INDEX == index ) @@ -182,7 +182,7 @@ void BaseSignal::OnDisconnect( ConnectionTrackerInterface* tracker, CallbackBase DALI_ASSERT_ALWAYS( NULL != tracker && "Invalid ConnectionTrackerInterface pointer passed to Disconnect()" ); DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Disconnect()" ); - int index = FindCallback( callback ); + int32_t index = FindCallback( callback ); if( index > INVALID_CALLBACK_INDEX ) { @@ -239,23 +239,22 @@ CallbackBase* BaseSignal::GetCallback( std::size_t connectionIndex ) const return callback; } -int BaseSignal::FindCallback( CallbackBase* callback ) +int32_t BaseSignal::FindCallback( CallbackBase* callback ) { - int 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 ) + const std::size_t count = mSignalConnections.Count(); + for( std::size_t i = 0; i < count; ++i ) { const CallbackBase* connectionCallback = GetCallback( i ); // Note that values are set to NULL in DeleteConnection - if( connectionCallback && - ( *connectionCallback == *callback ) ) + if( connectionCallback && ( *connectionCallback == *callback ) ) { - index = i; + index = static_cast( i ); // only 2,147,483,647 connections supported, no error check break; } } diff --git a/dali/public-api/signals/base-signal.h b/dali/public-api/signals/base-signal.h index 159cc6ed7..5de01379b 100755 --- a/dali/public-api/signals/base-signal.h +++ b/dali/public-api/signals/base-signal.h @@ -494,7 +494,7 @@ private: * @param[in] callback The call back object * @return A valid index if the callback is connected */ - int FindCallback( CallbackBase* callback ); + int32_t FindCallback( CallbackBase* callback ); /** * @brief Deletes a connection object from the list of connections.