From 8732b064201460bb08b5d29155f245df08472903 Mon Sep 17 00:00:00 2001 From: adun Date: Fri, 9 Mar 2018 10:12:52 +0800 Subject: [PATCH] [Tizen] Add codes for Dali Windows Backend Change-Id: Id2b35b615d6243028253163638265de62f4edc7e --- CMakeLists.txt | 183 +++++++++++++++++++++ dali/devel-api/images/distance-field.cpp | 5 +- dali/devel-api/threading/conditional-wait.h | 2 +- dali/devel-api/threading/mutex.h | 2 +- dali/integration-api/debug.h | 34 ++-- dali/integration-api/lockless-buffer.cpp | 14 +- dali/integration-api/lockless-buffer.h | 4 +- dali/internal/common/image-attributes.cpp | 2 +- dali/internal/event/actors/actor-impl.h | 10 +- dali/internal/event/rendering/renderer-impl.h | 12 +- dali/internal/file.list | 1 - dali/internal/render/common/render-tracker-debug.h | 6 +- dali/internal/render/common/render-tracker.cpp | 13 +- dali/internal/render/common/render-tracker.h | 4 +- .../render/data-providers/render-data-provider.h | 1 + dali/internal/render/gl-resources/gl-call-debug.h | 4 +- dali/internal/render/renderers/render-renderer.h | 18 +- dali/internal/render/renderers/render-texture.h | 2 +- dali/internal/render/shaders/program.cpp | 8 +- .../internal/update/common/scene-graph-buffers.cpp | 2 +- dali/internal/update/common/scene-graph-buffers.h | 4 +- dali/internal/update/nodes/node.cpp | 16 -- dali/internal/update/nodes/node.h | 22 ++- dali/internal/update/nodes/scene-graph-layer.cpp | 9 - dali/internal/update/nodes/scene-graph-layer.h | 10 +- .../render-tasks/scene-graph-render-task-debug.h | 8 +- .../update/rendering/scene-graph-renderer.h | 10 +- dali/public-api/animation/alpha-function.h | 4 +- dali/public-api/common/dali-common.h | 23 ++- dali/public-api/math/matrix.h | 2 +- dali/public-api/math/matrix3.h | 2 +- dali/public-api/math/random.h | 2 + dali/public-api/object/property-array.h | 2 +- dali/public-api/object/property-map.h | 2 +- dali/public-api/object/property-value.h | 2 +- dali/public-api/object/ref-object.cpp | 6 +- dali/public-api/object/ref-object.h | 5 +- dali/public-api/signals/base-signal.h | 2 +- dali/public-api/signals/callback.h | 24 ++- 39 files changed, 342 insertions(+), 140 deletions(-) create mode 100755 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..45c3c81 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,183 @@ +cmake_minimum_required(VERSION 3.11) + +if (WIN32) + +PROJECT (dali-core) + +add_subdirectory(dali/devel-api) +add_subdirectory(dali/integration-api) +#add_subdirectory(dali/internal) +add_subdirectory(dali/public-api) + +SET(INTERNAL_DIR ${dali_SOURCE_DIR}/dali-core/dali/internal) + +SET(SOURCES ${SOURCES} + ${dali_SOURCE_DIR}/dali-core/dali/integration-api/trace.cpp + ${INTERNAL_DIR}/common/blending-options.cpp + ${INTERNAL_DIR}/common/core-impl.cpp + ${INTERNAL_DIR}/common/internal-constants.cpp + ${INTERNAL_DIR}/common/math.cpp + ${INTERNAL_DIR}/common/message-buffer.cpp + ${INTERNAL_DIR}/common/mutex-trace.cpp + ${INTERNAL_DIR}/common/image-sampler.cpp + ${INTERNAL_DIR}/common/image-attributes.cpp + ${INTERNAL_DIR}/common/fixed-size-memory-pool.cpp + + ${INTERNAL_DIR}/event/actors/actor-impl.cpp + ${INTERNAL_DIR}/event/actors/custom-actor-internal.cpp + ${INTERNAL_DIR}/event/actors/layer-impl.cpp + ${INTERNAL_DIR}/event/actors/layer-list.cpp + ${INTERNAL_DIR}/event/actors/camera-actor-impl.cpp + ${INTERNAL_DIR}/event/animation/animation-impl.cpp + ${INTERNAL_DIR}/event/animation/animation-playlist.cpp + ${INTERNAL_DIR}/event/animation/constrainer.cpp + ${INTERNAL_DIR}/event/animation/constraint-base.cpp + ${INTERNAL_DIR}/event/animation/key-frames-impl.cpp + ${INTERNAL_DIR}/event/animation/linear-constrainer-impl.cpp + ${INTERNAL_DIR}/event/animation/path-impl.cpp + ${INTERNAL_DIR}/event/animation/path-constrainer-impl.cpp + ${INTERNAL_DIR}/event/common/event-thread-services.cpp + ${INTERNAL_DIR}/event/common/notification-manager.cpp + ${INTERNAL_DIR}/event/common/object-impl.cpp + ${INTERNAL_DIR}/event/common/object-registry-impl.cpp + ${INTERNAL_DIR}/event/common/projection.cpp + ${INTERNAL_DIR}/event/common/property-buffer-impl.cpp + ${INTERNAL_DIR}/event/common/property-conditions-impl.cpp + ${INTERNAL_DIR}/event/common/property-metadata.cpp + ${INTERNAL_DIR}/event/common/property-notification-impl.cpp + ${INTERNAL_DIR}/event/common/property-notification-manager.cpp + ${INTERNAL_DIR}/event/common/property-helper.cpp + ${INTERNAL_DIR}/event/common/stage-impl.cpp + ${INTERNAL_DIR}/event/common/system-overlay-impl.cpp + ${INTERNAL_DIR}/event/common/thread-local-storage.cpp + ${INTERNAL_DIR}/event/common/type-info-impl.cpp + ${INTERNAL_DIR}/event/common/type-registry-impl.cpp + ${INTERNAL_DIR}/event/effects/shader-factory.cpp + ${INTERNAL_DIR}/event/events/actor-gesture-data.cpp + ${INTERNAL_DIR}/event/events/actor-observer.cpp + ${INTERNAL_DIR}/event/events/event-processor.cpp + ${INTERNAL_DIR}/event/events/key-event-impl.cpp + ${INTERNAL_DIR}/event/events/key-event-processor.cpp + ${INTERNAL_DIR}/event/events/gesture-detector-impl.cpp + ${INTERNAL_DIR}/event/events/gesture-event-processor.cpp + ${INTERNAL_DIR}/event/events/gesture-processor.cpp + ${INTERNAL_DIR}/event/events/hit-test-algorithm-impl.cpp + ${INTERNAL_DIR}/event/events/hover-event-processor.cpp + ${INTERNAL_DIR}/event/events/long-press-gesture-detector-impl.cpp + ${INTERNAL_DIR}/event/events/long-press-gesture-processor.cpp + ${INTERNAL_DIR}/event/events/wheel-event-processor.cpp + ${INTERNAL_DIR}/event/events/multi-point-event-util.cpp + ${INTERNAL_DIR}/event/events/pan-gesture-detector-impl.cpp + ${INTERNAL_DIR}/event/events/pan-gesture-processor.cpp + ${INTERNAL_DIR}/event/events/pinch-gesture-detector-impl.cpp + ${INTERNAL_DIR}/event/events/pinch-gesture-processor.cpp + ${INTERNAL_DIR}/event/events/tap-gesture-detector-impl.cpp + ${INTERNAL_DIR}/event/events/tap-gesture-processor.cpp + ${INTERNAL_DIR}/event/events/touch-data-impl.cpp + ${INTERNAL_DIR}/event/events/touch-event-processor.cpp + ${INTERNAL_DIR}/event/images/bitmap-packed-pixel.cpp + ${INTERNAL_DIR}/event/images/bitmap-compressed.cpp + ${INTERNAL_DIR}/event/images/image-impl.cpp + ${INTERNAL_DIR}/event/images/buffer-image-impl.cpp + ${INTERNAL_DIR}/event/images/frame-buffer-image-impl.cpp + ${INTERNAL_DIR}/event/images/encoded-buffer-image-impl.cpp + ${INTERNAL_DIR}/event/images/nine-patch-image-impl.cpp + ${INTERNAL_DIR}/event/images/resource-image-impl.cpp + ${INTERNAL_DIR}/event/images/native-image-impl.cpp + ${INTERNAL_DIR}/event/images/pixel-data-impl.cpp + ${INTERNAL_DIR}/event/object/custom-object-internal.cpp + ${INTERNAL_DIR}/event/render-tasks/render-task-impl.cpp + ${INTERNAL_DIR}/event/render-tasks/render-task-list-impl.cpp + ${INTERNAL_DIR}/event/rendering/frame-buffer-impl.cpp + ${INTERNAL_DIR}/event/rendering/geometry-impl.cpp + ${INTERNAL_DIR}/event/rendering/texture-impl.cpp + ${INTERNAL_DIR}/event/rendering/texture-set-impl.cpp + ${INTERNAL_DIR}/event/rendering/renderer-impl.cpp + ${INTERNAL_DIR}/event/rendering/sampler-impl.cpp + ${INTERNAL_DIR}/event/rendering/shader-impl.cpp + ${INTERNAL_DIR}/event/size-negotiation/memory-pool-relayout-container.cpp + ${INTERNAL_DIR}/event/size-negotiation/relayout-controller-impl.cpp + + ${INTERNAL_DIR}/render/common/render-algorithms.cpp + ${INTERNAL_DIR}/render/common/render-debug.cpp + ${INTERNAL_DIR}/render/common/render-instruction.cpp + ${INTERNAL_DIR}/render/common/render-instruction-container.cpp + ${INTERNAL_DIR}/render/common/render-item.cpp + ${INTERNAL_DIR}/render/common/render-tracker.cpp + ${INTERNAL_DIR}/render/common/render-manager.cpp + ${INTERNAL_DIR}/render/data-providers/render-data-provider.cpp + ${INTERNAL_DIR}/render/gl-resources/context.cpp + ${INTERNAL_DIR}/render/gl-resources/frame-buffer-state-cache.cpp + ${INTERNAL_DIR}/render/gl-resources/gl-call-debug.cpp + ${INTERNAL_DIR}/render/gl-resources/gpu-buffer.cpp + ${INTERNAL_DIR}/render/queue/render-queue.cpp + ${INTERNAL_DIR}/render/renderers/render-frame-buffer.cpp + ${INTERNAL_DIR}/render/renderers/render-geometry.cpp + ${INTERNAL_DIR}/render/renderers/render-property-buffer.cpp + ${INTERNAL_DIR}/render/renderers/render-renderer.cpp + ${INTERNAL_DIR}/render/renderers/render-texture.cpp + ${INTERNAL_DIR}/render/shaders/program.cpp + ${INTERNAL_DIR}/render/shaders/program-controller.cpp + ${INTERNAL_DIR}/render/shaders/scene-graph-shader.cpp + + ${INTERNAL_DIR}/update/animation/scene-graph-animation.cpp + ${INTERNAL_DIR}/update/animation/scene-graph-constraint-base.cpp + ${INTERNAL_DIR}/update/common/discard-queue.cpp + ${INTERNAL_DIR}/update/common/property-base.cpp + ${INTERNAL_DIR}/update/common/property-owner-messages.cpp + ${INTERNAL_DIR}/update/common/property-condition-functions.cpp + ${INTERNAL_DIR}/update/common/property-condition-step-functions.cpp + ${INTERNAL_DIR}/update/common/property-condition-variable-step-functions.cpp + ${INTERNAL_DIR}/update/common/property-owner.cpp + ${INTERNAL_DIR}/update/common/scene-graph-buffers.cpp + ${INTERNAL_DIR}/update/common/scene-graph-connection-change-propagator.cpp + ${INTERNAL_DIR}/update/common/scene-graph-property-notification.cpp + ${INTERNAL_DIR}/update/common/uniform-map.cpp + ${INTERNAL_DIR}/update/controllers/render-message-dispatcher.cpp + ${INTERNAL_DIR}/update/controllers/scene-controller-impl.cpp + ${INTERNAL_DIR}/update/gestures/pan-gesture-profiling.cpp + ${INTERNAL_DIR}/update/gestures/scene-graph-pan-gesture.cpp + ${INTERNAL_DIR}/update/queue/update-message-queue.cpp + ${INTERNAL_DIR}/update/manager/render-instruction-processor.cpp + ${INTERNAL_DIR}/update/manager/render-task-processor.cpp + ${INTERNAL_DIR}/update/manager/transform-manager.cpp + ${INTERNAL_DIR}/update/manager/update-algorithms.cpp + ${INTERNAL_DIR}/update/manager/update-manager.cpp + ${INTERNAL_DIR}/update/manager/update-manager-debug.cpp + ${INTERNAL_DIR}/update/render-tasks/scene-graph-camera.cpp + ${INTERNAL_DIR}/update/nodes/node.cpp + ${INTERNAL_DIR}/update/nodes/node-messages.cpp + ${INTERNAL_DIR}/update/nodes/scene-graph-layer.cpp + ${INTERNAL_DIR}/update/render-tasks/scene-graph-render-task.cpp + ${INTERNAL_DIR}/update/render-tasks/scene-graph-render-task-list.cpp + ${INTERNAL_DIR}/update/rendering/scene-graph-texture-set.cpp + ${INTERNAL_DIR}/update/rendering/scene-graph-renderer.cpp + ) + +link_directories( +${dali_SOURCE_DIR}/dali-adaptor/dali-windows-backend/ExLib +) + +ADD_DEFINITIONS( +/vmg +/NODEFAULTLIB:"libcmt.lib" +/FI"${dali_SOURCE_DIR}/dali-adaptor/dali-windows-backend/ExInclude/PreprocessorDefinitions.h" +/DBUILDING_DALI_CORE +/MP +) +#head file path +INCLUDE_DIRECTORIES( +./ +${dali_SOURCE_DIR}/dali-adaptor/dali-windows-backend/ExInclude +) + +set(LIBRARY_OUTPUT_PATH ${dali_SOURCE_DIR}/bin) + +ADD_LIBRARY(dali-core SHARED ${SOURCES}) + +target_link_libraries(dali-core WindowsPlatform.lib) + +endif() + +#add link library +#TARGET_LINK_LIBRARIES(${FS_BUILD_BINARY_PREFIX}sqrt ${LIBRARIES}) \ No newline at end of file diff --git a/dali/devel-api/images/distance-field.cpp b/dali/devel-api/images/distance-field.cpp index 6e4346d..63a5150 100644 --- a/dali/devel-api/images/distance-field.cpp +++ b/dali/devel-api/images/distance-field.cpp @@ -84,8 +84,9 @@ const float MAX_DISTANCE( 1e20 ); */ void DistanceTransform( float *source, float* dest, unsigned int length ) { - int parabolas[length]; // Locations of parabolas in lower envelope - float edge[length + 1]; // Locations of boundaries between parabolas + std::vector parabolas(length); // Locations of parabolas in lower envelope + std::vector edge(length + 1); // Locations of boundaries between parabolas + int rightmost(0); // Index of rightmost parabola in lower envelope parabolas[0] = 0; diff --git a/dali/devel-api/threading/conditional-wait.h b/dali/devel-api/threading/conditional-wait.h index 24a0874..79de016 100644 --- a/dali/devel-api/threading/conditional-wait.h +++ b/dali/devel-api/threading/conditional-wait.h @@ -35,7 +35,7 @@ public: * @brief Allows client code to synchronize updates to its own state with the * internal state of a ConditionalWait object. */ - class ScopedLock + class DALI_CORE_API ScopedLock { public: /** diff --git a/dali/devel-api/threading/mutex.h b/dali/devel-api/threading/mutex.h index 26dfe11..2173edc 100644 --- a/dali/devel-api/threading/mutex.h +++ b/dali/devel-api/threading/mutex.h @@ -57,7 +57,7 @@ public: * Note! this class *does not* prevent a deadlock in the case when same thread is * locking the same mutex twice. */ - class ScopedLock + class DALI_CORE_API ScopedLock { public: diff --git a/dali/integration-api/debug.h b/dali/integration-api/debug.h index 0bb89d1..de2f768 100644 --- a/dali/integration-api/debug.h +++ b/dali/integration-api/debug.h @@ -109,44 +109,44 @@ DALI_CORE_API void UninstallLogFunction(); /** * Provides unfiltered logging for global error level messages */ -#define DALI_LOG_ERROR(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, "%s " format, __PRETTY_FUNCTION__, ## args) +#define DALI_LOG_ERROR(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, "%s " format, __FUNCTION__, ## __VA_ARGS__) -#define DALI_LOG_ERROR_NOFN(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, format, ## args) +#define DALI_LOG_ERROR_NOFN(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, format, ## __VA_ARGS__) -#define DALI_LOG_WARNING_NOFN(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, format, ## args) +#define DALI_LOG_WARNING_NOFN(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, format, ## __VA_ARGS__) /** * Provides unfiltered logging for fps monitor */ -#define DALI_LOG_FPS(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## args) +#define DALI_LOG_FPS(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## __VA_ARGS__) /** * Provides unfiltered logging for update status */ -#define DALI_LOG_UPDATE_STATUS(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## args) +#define DALI_LOG_UPDATE_STATUS(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## __VA_ARGS__) /** * Provides unfiltered logging for render information */ -#define DALI_LOG_RENDER_INFO(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## args) +#define DALI_LOG_RENDER_INFO(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## __VA_ARGS__) /** * Provides unfiltered logging for release */ -#define DALI_LOG_RELEASE_INFO(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## args) +#define DALI_LOG_RELEASE_INFO(format, args, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## __VA_ARGS__) #ifdef DEBUG_ENABLED /** * Provides unfiltered logging for global warning level messages */ -#define DALI_LOG_WARNING(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, "%s " format, __PRETTY_FUNCTION__, ## args) +#define DALI_LOG_WARNING(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, "%s " format, __PRETTY_FUNCTION__, ## __VA_ARGS__) #else // DEBUG_ENABLED // Don't warn on release build -#define DALI_LOG_WARNING(format, args...) +#define DALI_LOG_WARNING(format, ...) #endif @@ -309,12 +309,12 @@ public: #ifdef DEBUG_ENABLED -#define DALI_LOG_INFO(filter, level, format, args...) \ - if(filter && filter->IsEnabledFor(level)) { filter->Log(level, format, ## args); } +#define DALI_LOG_INFO(filter, level, format, ...) \ + if(filter && filter->IsEnabledFor(level)) { filter->Log(level, format, ## __VA_ARGS__); } #else // DEBUG_ENABLED -#define DALI_LOG_INFO(filter, level, format, args...) +#define DALI_LOG_INFO(filter, level, format, ...) #endif // DEBUG_ENABLED @@ -342,8 +342,8 @@ public: }; -#define DALI_LOG_TRACE_METHOD_FMT(filter, format, args...) \ - Dali::Integration::Log::TraceObj debugTraceObj(filter, "%s: " format, __PRETTY_FUNCTION__, ## args) +#define DALI_LOG_TRACE_METHOD_FMT(filter, format, ...) \ + Dali::Integration::Log::TraceObj debugTraceObj(filter, "%s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__) #define DALI_LOG_TRACE_METHOD(filter) \ Dali::Integration::Log::TraceObj debugTraceObj(filter, __PRETTY_FUNCTION__) @@ -351,7 +351,7 @@ public: #else // DEBUG_ENABLED -#define DALI_LOG_TRACE_METHOD_FMT(filter, format, args...) +#define DALI_LOG_TRACE_METHOD_FMT(filter, format, ...) #define DALI_LOG_TRACE_METHOD(filter) @@ -395,7 +395,7 @@ public: \ /** * Allows one object to set another object's std::string easily */ -#define DALI_LOG_FMT_OBJECT_STRING(object, fmt, args...) (object->mDebugString = FormatToString(fmt, ## args)) +#define DALI_LOG_FMT_OBJECT_STRING(object, fmt, ...) (object->mDebugString = FormatToString(fmt, ## __VA_ARGS__)) /** * Allows one object to get another object's debug string @@ -418,7 +418,7 @@ public: \ #define DALI_LOG_OBJECT_STRING_DECLARATION #define DALI_LOG_ACTOR_TREE(node) #define DALI_LOG_SET_OBJECT_STRING(object, string) -#define DALI_LOG_FMT_OBJECT_STRING(object, fmt, args...) +#define DALI_LOG_FMT_OBJECT_STRING(object, fmt, ...) #define DALI_LOG_GET_OBJECT_STRING(object) #define DALI_LOG_GET_OBJECT_C_STR(object) "" #define DALI_LOG_OBJECT(filter, object) diff --git a/dali/integration-api/lockless-buffer.cpp b/dali/integration-api/lockless-buffer.cpp index b704dbc..a1a7541 100644 --- a/dali/integration-api/lockless-buffer.cpp +++ b/dali/integration-api/lockless-buffer.cpp @@ -50,7 +50,8 @@ void LocklessBuffer::Write( const unsigned char *src, size_t size ) DALI_ASSERT_ALWAYS( size <= mSize ); // set WRITING bit - BufferState currentState( __sync_fetch_and_or( &mState, WRITING ) ); + BufferState currentState( std::atomic_fetch_or( &mState, WRITING ) ); + DALI_ASSERT_DEBUG( !(currentState & WRITING_MASK) ); // WRITING bit should never be set when we get here // copy data to current write buffer, negate state to get actual index (recap: R0W1 = 0, R1W0 = 1) @@ -58,9 +59,9 @@ void LocklessBuffer::Write( const unsigned char *src, size_t size ) memcpy( mBuffer[index], src, size ); // unset WRITING bit, set UPDATED bit - BufferState checkState = __sync_val_compare_and_swap( &mState, - static_cast(currentState | WRITING), - static_cast(index | UPDATED) ); + BufferState writingState = static_cast(currentState | WRITING); + BufferState checkState = mState; + mState.compare_exchange_strong( writingState, static_cast(index | UPDATED) ); DALI_ASSERT_DEBUG( checkState & WRITING ); (void)checkState; // Avoid unused variable warning @@ -76,9 +77,8 @@ const unsigned char* LocklessBuffer::Read() { // Try to swap buffers. // This will set mState to 1 if readbuffer 0 was updated, 0 if readbuffer 1 was updated and fail if WRITING is set - if( __sync_bool_compare_and_swap( &mState, - static_cast(currentWriteBuf | UPDATED), - static_cast(!currentWriteBuf) ) ) + BufferState writingState = static_cast(currentWriteBuf | UPDATED); + if( mState.compare_exchange_strong( writingState, static_cast(!currentWriteBuf) ) ) { // swap successful return mBuffer[currentWriteBuf]; diff --git a/dali/integration-api/lockless-buffer.h b/dali/integration-api/lockless-buffer.h index 8c0530d..5a7cc58 100644 --- a/dali/integration-api/lockless-buffer.h +++ b/dali/integration-api/lockless-buffer.h @@ -25,6 +25,8 @@ #include #include +#include + namespace Dali { @@ -102,7 +104,7 @@ private: private: unsigned char* mBuffer[2]; ///< bitmap buffers - BufferState volatile mState; ///< readbuffer number and whether we're currently writing into writebuffer or not + volatile std::__atomic_base mState; ///< readbuffer number and whether we're currently writing into writebuffer or not size_t mSize; ///< size of buffers }; diff --git a/dali/internal/common/image-attributes.cpp b/dali/internal/common/image-attributes.cpp index 25e53b8..b13b530 100644 --- a/dali/internal/common/image-attributes.cpp +++ b/dali/internal/common/image-attributes.cpp @@ -70,7 +70,7 @@ struct ImageAttributes::ImageAttributesImpl unsigned int width : 16; ///< image width in pixels unsigned int height : 16; ///< image height in pixels ScalingMode scaling : 3; ///< scaling option, ShrinkToFit is default - FilterMode filtering : 3; ///< filtering option. Box is the default + FilterMode filtering : 4; ///< filtering option. Box is the default bool mOrientationCorrection : 1; ///< If true, image pixels are reordered according to orientation metadata on load. }; diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index b9734c7..3826e73 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -2017,11 +2017,11 @@ protected: bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not. bool mVisible : 1; ///< Cached: Whether the actor is visible or not. bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent. - LayoutDirection::Type mLayoutDirection : 1; ///< Layout direction, Left to Right or Right to Left. - DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn - PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited - ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited - ClippingMode::Type mClippingMode : 2; ///< Cached: Determines which clipping mode (if any) to use. + LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left. + DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn + PositionInheritanceMode mPositionInheritanceMode : 3; ///< Cached: Determines how position is inherited + ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited + ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use. private: diff --git a/dali/internal/event/rendering/renderer-impl.h b/dali/internal/event/rendering/renderer-impl.h index e4911a2..5d8bade 100644 --- a/dali/internal/event/rendering/renderer-impl.h +++ b/dali/internal/event/rendering/renderer-impl.h @@ -322,14 +322,12 @@ private: // data Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask - float mOpacity; ///< Local copy of the opacity - - DepthFunction::Type mDepthFunction:3; ///< Local copy of the depth function - FaceCullingMode::Type mFaceCullingMode:2; ///< Local copy of the mode of face culling - BlendMode::Type mBlendMode:2; ///< Local copy of the mode of blending - DepthWriteMode::Type mDepthWriteMode:2; ///< Local copy of the depth write mode - DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode + DepthFunction::Type mDepthFunction:4; ///< Local copy of the depth function + FaceCullingMode::Type mFaceCullingMode:3; ///< Local copy of the mode of face culling + BlendMode::Type mBlendMode:3; ///< Local copy of the mode of blending + DepthWriteMode::Type mDepthWriteMode:3; ///< Local copy of the depth write mode + DepthTestMode::Type mDepthTestMode:3; ///< Local copy of the depth test mode bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required }; diff --git a/dali/internal/file.list b/dali/internal/file.list index bae7b47..44eb3fd 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -86,7 +86,6 @@ internal_src_files = \ $(internal_src_dir)/event/rendering/shader-impl.cpp \ $(internal_src_dir)/event/size-negotiation/memory-pool-relayout-container.cpp \ $(internal_src_dir)/event/size-negotiation/relayout-controller-impl.cpp \ - \ $(internal_src_dir)/render/common/render-algorithms.cpp \ $(internal_src_dir)/render/common/render-debug.cpp \ $(internal_src_dir)/render/common/render-instruction.cpp \ diff --git a/dali/internal/render/common/render-tracker-debug.h b/dali/internal/render/common/render-tracker-debug.h index 498e8f2..78c3ef9 100644 --- a/dali/internal/render/common/render-tracker-debug.h +++ b/dali/internal/render/common/render-tracker-debug.h @@ -34,11 +34,11 @@ Debug::Filter* gRenderTrackerLogFilter = Debug::Filter::New(Debug::NoLogging, fa #define TRACKER_LOG(level) \ DALI_LOG_INFO(gRenderTrackerLogFilter, level, "RenderTracker::%s: this:%p\n", __FUNCTION__, this) -#define TRACKER_LOG_FMT(level, format, args...) \ - DALI_LOG_INFO(gRenderTrackerLogFilter, level, "RenderTracker::%s: this:%p " format, __FUNCTION__, this, ## args) +#define TRACKER_LOG_FMT(level, format, ...) \ + DALI_LOG_INFO(gRenderTrackerLogFilter, level, "RenderTracker::%s: this:%p " format, __FUNCTION__, this, ## __VA_ARGS__) #else #define TRACKER_LOG(level) -#define TRACKER_LOG_FMT(level, format, args...) +#define TRACKER_LOG_FMT(level, format, ...) #endif } // Render diff --git a/dali/internal/render/common/render-tracker.cpp b/dali/internal/render/common/render-tracker.cpp index a7a356e..022f120 100644 --- a/dali/internal/render/common/render-tracker.cpp +++ b/dali/internal/render/common/render-tracker.cpp @@ -82,21 +82,24 @@ void RenderTracker::PollSyncObject() bool RenderTracker::IsSynced() { - int x = __sync_val_compare_and_swap(&mSyncTrigger, 0xFF, 0x0); + int flag = 0xFF; + bool ret = mSyncTrigger.compare_exchange_strong( flag, 0 ); - TRACKER_LOG_FMT(Debug::General, " = %s\n", x!=0?"T":"F"); - return x != 0; + TRACKER_LOG_FMT( Debug::General, " = %s\n", true == ret ? "T" : "F" ); + return ret; } void RenderTracker::ResetSyncFlag() { TRACKER_LOG(Debug::General); - (void)__sync_lock_test_and_set(&mSyncTrigger, 0x0); + int flag = 0xFF; + mSyncTrigger.compare_exchange_strong( flag, 0 ); } void RenderTracker::SetSyncFlag() { - (void)__sync_lock_test_and_set(&mSyncTrigger, 0xFF); + int flag = 0; + mSyncTrigger.compare_exchange_strong( flag, 0xFF ); } } // Render diff --git a/dali/internal/render/common/render-tracker.h b/dali/internal/render/common/render-tracker.h index 307e101..0d26838 100644 --- a/dali/internal/render/common/render-tracker.h +++ b/dali/internal/render/common/render-tracker.h @@ -21,6 +21,8 @@ #include #include +#include + namespace Dali { namespace Internal @@ -77,7 +79,7 @@ private: Integration::GlSyncAbstraction* mGlSyncAbstraction; // The sync abstraction Integration::GlSyncAbstraction::SyncObject* mSyncObject; // Associated sync object - volatile int mSyncTrigger; // Trigger that update thread can read + volatile std::atomic mSyncTrigger; // Trigger that update thread can read }; diff --git a/dali/internal/render/data-providers/render-data-provider.h b/dali/internal/render/data-providers/render-data-provider.h index 478718e..aae4262 100644 --- a/dali/internal/render/data-providers/render-data-provider.h +++ b/dali/internal/render/data-providers/render-data-provider.h @@ -38,6 +38,7 @@ namespace SceneGraph { class PropertyBuffer; class Shader; +class Renderer; /** * Wraps all the data providers for the renderer. This allows the diff --git a/dali/internal/render/gl-resources/gl-call-debug.h b/dali/internal/render/gl-resources/gl-call-debug.h index 866d5ea..dcd440e 100644 --- a/dali/internal/render/gl-resources/gl-call-debug.h +++ b/dali/internal/render/gl-resources/gl-call-debug.h @@ -52,8 +52,8 @@ extern Debug::Filter* gGlLogFilter; #endif // DEBUG_ENABLED // Don't put guards around here (LOG_INFO has it's own guards) -#define LOG_GL(format, args...) \ - DALI_LOG_INFO(gGlLogFilter, Debug::General, format, ## args) +#define LOG_GL(format, ...) \ + DALI_LOG_INFO(gGlLogFilter, Debug::General, format, ## __VA_ARGS__) } diff --git a/dali/internal/render/renderers/render-renderer.h b/dali/internal/render/renderers/render-renderer.h index 6e1a1f7..55bac57 100644 --- a/dali/internal/render/renderers/render-renderer.h +++ b/dali/internal/render/renderers/render-renderer.h @@ -82,11 +82,11 @@ public: int stencilFunctionMask; ///< The stencil function mask int stencilFunctionReference; ///< The stencil function reference int stencilMask; ///< The stencil mask - RenderMode::Type renderMode:3; ///< The render mode - StencilFunction::Type stencilFunction:3; ///< The stencil function - StencilOperation::Type stencilOperationOnFail:3; ///< The stencil operation for stencil test fail - StencilOperation::Type stencilOperationOnZFail:3; ///< The stencil operation for depth test fail - StencilOperation::Type stencilOperationOnZPass:3; ///< The stencil operation for depth test pass + RenderMode::Type renderMode:4; ///< The render mode + StencilFunction::Type stencilFunction:4; ///< The stencil function + StencilOperation::Type stencilOperationOnFail:4; ///< The stencil operation for stencil test fail + StencilOperation::Type stencilOperationOnZFail:4; ///< The stencil operation for depth test fail + StencilOperation::Type stencilOperationOnZPass:4; ///< The stencil operation for depth test pass }; /** @@ -429,10 +429,10 @@ private: size_t mIndexedDrawFirstElement; ///< Offset of first element to draw size_t mIndexedDrawElementsCount; ///< Number of elements to draw - DepthFunction::Type mDepthFunction:3; ///< The depth function - FaceCullingMode::Type mFaceCullingMode:2; ///< The mode of face culling - DepthWriteMode::Type mDepthWriteMode:2; ///< The depth write mode - DepthTestMode::Type mDepthTestMode:2; ///< The depth test mode + DepthFunction::Type mDepthFunction:4; ///< The depth function + FaceCullingMode::Type mFaceCullingMode:3; ///< The mode of face culling + DepthWriteMode::Type mDepthWriteMode:3; ///< The depth write mode + DepthTestMode::Type mDepthTestMode:3; ///< The depth test mode bool mUpdateAttributesLocation:1; ///< Indicates attribute locations have changed bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required diff --git a/dali/internal/render/renderers/render-texture.h b/dali/internal/render/renderers/render-texture.h index d9192e0..771fca0 100644 --- a/dali/internal/render/renderers/render-texture.h +++ b/dali/internal/render/renderers/render-texture.h @@ -155,7 +155,7 @@ private: uint16_t mWidth; ///< Width of the texture uint16_t mHeight; ///< Height of the texture uint16_t mMaxMipMapLevel; ///< Maximum mipmap level - Type mType:2; ///< Type of the texture + Type mType:3; ///< Type of the texture bool mHasAlpha : 1; ///< Whether the format has an alpha channel bool mIsCompressed : 1; ///< Whether the format is compressed diff --git a/dali/internal/render/shaders/program.cpp b/dali/internal/render/shaders/program.cpp index 451de0b..530b629 100644 --- a/dali/internal/render/shaders/program.cpp +++ b/dali/internal/render/shaders/program.cpp @@ -248,7 +248,7 @@ void Program::GetActiveSamplerUniforms() mGlAbstraction.GetProgramiv( mProgramId, GL_ACTIVE_UNIFORM_MAX_LENGTH, &uniformMaxNameLength ); std::vector samplerNames; - char name[uniformMaxNameLength+1]; // Allow for null terminator + std::vector name(uniformMaxNameLength + 1); // Allow for null terminator std::vector< LocationPosition > samplerUniformLocations; { @@ -259,12 +259,12 @@ void Program::GetActiveSamplerUniforms() for( int i=0; i( i ), uniformMaxNameLength, - &nameLength, &number, &type, name ); + &nameLength, &number, &type, name.data() ); if( type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES ) { - GLuint location = mGlAbstraction.GetUniformLocation( mProgramId, name ); - samplerNames.push_back(name); + GLuint location = mGlAbstraction.GetUniformLocation( mProgramId, name.data() ); + samplerNames.push_back( name.data() ); samplerUniformLocations.push_back(LocationPosition(location, -1)); } } diff --git a/dali/internal/update/common/scene-graph-buffers.cpp b/dali/internal/update/common/scene-graph-buffers.cpp index c6e6161..e12a13c 100644 --- a/dali/internal/update/common/scene-graph-buffers.cpp +++ b/dali/internal/update/common/scene-graph-buffers.cpp @@ -42,7 +42,7 @@ SceneGraphBuffers::~SceneGraphBuffers() void SceneGraphBuffers::Swap() { - mUpdateBufferIndex = __sync_fetch_and_xor( &mEventBufferIndex, 1 ); + mUpdateBufferIndex = std::atomic_fetch_xor(&mEventBufferIndex, 1); } } // namespace SceneGraph diff --git a/dali/internal/update/common/scene-graph-buffers.h b/dali/internal/update/common/scene-graph-buffers.h index b9fb6e0..d0450c4 100644 --- a/dali/internal/update/common/scene-graph-buffers.h +++ b/dali/internal/update/common/scene-graph-buffers.h @@ -20,6 +20,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -77,8 +78,7 @@ private: SceneGraphBuffers& operator=(const SceneGraphBuffers& rhs); private: - - BufferIndex mEventBufferIndex; ///< 0 or 1 (opposite of mUpdateBufferIndex) + std::atomic mEventBufferIndex; ///< 0 or 1 (opposite of mUpdateBufferIndex) BufferIndex mUpdateBufferIndex; ///< 0 or 1 (opposite of mEventBufferIndex) }; diff --git a/dali/internal/update/nodes/node.cpp b/dali/internal/update/nodes/node.cpp index aa7f777..4731897 100644 --- a/dali/internal/update/nodes/node.cpp +++ b/dali/internal/update/nodes/node.cpp @@ -357,22 +357,6 @@ void Node::RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex ) } // namespace SceneGraph -template <> -void OwnerPointer::Reset() -{ - if( mObject != NULL ) - { - Dali::Internal::SceneGraph::Node::Delete( mObject ); - mObject = NULL; - } -} - } // namespace Internal -template <> -void OwnerContainer::Delete(Dali::Internal::SceneGraph::Node* pointer) -{ - Dali::Internal::SceneGraph::Node::Delete( pointer ); -} - } // namespace Dali diff --git a/dali/internal/update/nodes/node.h b/dali/internal/update/nodes/node.h index 71102fb..3850580 100644 --- a/dali/internal/update/nodes/node.h +++ b/dali/internal/update/nodes/node.h @@ -887,9 +887,9 @@ protected: // flags, compressed to bitfield unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties - DrawMode::Type mDrawMode:2; ///< How the Node and its children should be drawn - ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough - ClippingMode::Type mClippingMode:2; ///< The clipping mode of this node + DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn + ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough + ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node bool mIsRoot:1; ///< True if the node cannot have a parent bool mIsLayer:1; ///< True if the node is a layer bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position @@ -1035,14 +1035,22 @@ inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadS // Template specialisation for OwnerPointer, because delete is protected template <> -void OwnerPointer::Reset(); - +inline void OwnerPointer::Reset() +{ + if (mObject != NULL) + { + Dali::Internal::SceneGraph::Node::Delete(mObject); + mObject = NULL; + } +} } // namespace Internal // Template specialisations for OwnerContainer, because delete is protected template <> -void OwnerContainer::Delete( Dali::Internal::SceneGraph::Node* pointer ); - +inline void OwnerContainer::Delete( Dali::Internal::SceneGraph::Node* pointer ) +{ + Dali::Internal::SceneGraph::Node::Delete(pointer); +} } // namespace Dali #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H diff --git a/dali/internal/update/nodes/scene-graph-layer.cpp b/dali/internal/update/nodes/scene-graph-layer.cpp index 46bb14c..4519171 100644 --- a/dali/internal/update/nodes/scene-graph-layer.cpp +++ b/dali/internal/update/nodes/scene-graph-layer.cpp @@ -113,15 +113,6 @@ void Layer::ClearRenderables() } // namespace SceneGraph -template <> -void OwnerPointer::Reset() -{ - if( mObject != NULL ) - { - Dali::Internal::SceneGraph::Node::Delete( mObject ); - mObject = NULL; - } -} } // namespace Internal } // namespace Dali diff --git a/dali/internal/update/nodes/scene-graph-layer.h b/dali/internal/update/nodes/scene-graph-layer.h index f56bdd3..26b217e 100644 --- a/dali/internal/update/nodes/scene-graph-layer.h +++ b/dali/internal/update/nodes/scene-graph-layer.h @@ -334,8 +334,14 @@ inline void SetDepthTestDisabledMessage( EventThreadServices& eventThreadService // Template specialisation for OwnerPointer, because delete is protected template <> -void OwnerPointer::Reset(); - +inline void OwnerPointer::Reset() +{ + if (mObject != NULL) + { + Dali::Internal::SceneGraph::Node::Delete(mObject); + mObject = NULL; + } +} } // namespace Internal } // namespace Dali diff --git a/dali/internal/update/render-tasks/scene-graph-render-task-debug.h b/dali/internal/update/render-tasks/scene-graph-render-task-debug.h index adcaf05..655fa26 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task-debug.h +++ b/dali/internal/update/render-tasks/scene-graph-render-task-debug.h @@ -30,14 +30,12 @@ Debug::Filter* gRenderTaskLogFilter = Debug::Filter::New(Debug::NoLogging, false #define TASK_LOG(level) \ DALI_LOG_INFO(gRenderTaskLogFilter, level, "SceneGraph::RenderTask::%s: this:%p\n", __FUNCTION__, this) -#define TASK_LOG_FMT(level, format, args...) \ - DALI_LOG_INFO(gRenderTaskLogFilter, level, "SceneGraph::RenderTask::%s: this:%p " format, __FUNCTION__, this, ## args) - +#define TASK_LOG_FMT(level, format, ...) \ + DALI_LOG_INFO(gRenderTaskLogFilter, level, "SceneGraph::RenderTask::%s: this:%p " format, __FUNCTION__, this, ## __VA_ARGS__) #else #define TASK_LOG(level) -#define TASK_LOG_FMT(level, format, args...) - +#define TASK_LOG_FMT(level, format, ...) #endif #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_DEBUG_H__ diff --git a/dali/internal/update/rendering/scene-graph-renderer.h b/dali/internal/update/rendering/scene-graph-renderer.h index f1ef2a7..5865014 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.h +++ b/dali/internal/update/rendering/scene-graph-renderer.h @@ -451,11 +451,11 @@ private: unsigned int mRegenerateUniformMap; ///< 2 if the map should be regenerated, 1 if it should be copied. unsigned int mResendFlag; ///< Indicate whether data should be resent to the renderer - DepthFunction::Type mDepthFunction:3; ///< Local copy of the depth function - FaceCullingMode::Type mFaceCullingMode:2; ///< Local copy of the mode of face culling - BlendMode::Type mBlendMode:2; ///< Local copy of the mode of blending - DepthWriteMode::Type mDepthWriteMode:2; ///< Local copy of the depth write mode - DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode + DepthFunction::Type mDepthFunction:4; ///< Local copy of the depth function + FaceCullingMode::Type mFaceCullingMode:3; ///< Local copy of the mode of face culling + BlendMode::Type mBlendMode:3; ///< Local copy of the mode of blending + DepthWriteMode::Type mDepthWriteMode:3; ///< Local copy of the depth write mode + DepthTestMode::Type mDepthTestMode:3; ///< Local copy of the depth test mode bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required diff --git a/dali/public-api/animation/alpha-function.h b/dali/public-api/animation/alpha-function.h index 5f92d43..7444ec7 100644 --- a/dali/public-api/animation/alpha-function.h +++ b/dali/public-api/animation/alpha-function.h @@ -161,8 +161,8 @@ private: Vector4 mBezierControlPoints; //< Control points for the bezier alpha function AlphaFunctionPrototype mCustom; //< Pointer to an alpha function - BuiltinFunction mBuiltin : Log::value+1; //< Enum indicating the built-in alpha function - Mode mMode : 2; //< Enum indicating the functioning mode of the AlphaFunction + BuiltinFunction mBuiltin : Log::value+2; //< Enum indicating the built-in alpha function + Mode mMode : 3; //< Enum indicating the functioning mode of the AlphaFunction }; /** diff --git a/dali/public-api/common/dali-common.h b/dali/public-api/common/dali-common.h index 4b7c4aa..78cfb62 100755 --- a/dali/public-api/common/dali-common.h +++ b/dali/public-api/common/dali-common.h @@ -43,12 +43,26 @@ # define DALI_INTERNAL __attribute__ ((visibility ("hidden"))) # endif #else -/** Visibility attribute to show method definitions */ -# define DALI_EXPORT_API +#ifdef WIN32 + /** Visibility attribute to show declarations */ +# define DALI_EXPORT_API __declspec(dllexport) //Deprecated + +#ifdef BUILDING_DALI_CORE + /** Visibility attribute to hide declarations */ +# define DALI_CORE_API __declspec(dllexport) +#else +/** Visibility attribute to hide declarations */ +# define DALI_CORE_API __declspec(dllimport) +#endif + +#else + /** Visibility attribute to show declarations */ +# define DALI_EXPORT_API //Deprecated /** Visibility attribute to show declarations */ # define DALI_IMPORT_API /** Visibility attribute to show declarations */ # define DALI_CORE_API +#endif /** Visibility attribute to hide declarations */ # define DALI_INTERNAL #endif @@ -73,8 +87,13 @@ * DALI_UNLIKELY should be used when a branch is almost never taken. * @SINCE_1_0.0 */ +#ifdef __GNUC #define DALI_LIKELY(expression) __builtin_expect( !!(expression), 1 ) #define DALI_UNLIKELY(expression) __builtin_expect( !!(expression), 0 ) +#else +#define DALI_LIKELY(expression) !!(expression) +#define DALI_UNLIKELY(expression) !!(expression) +#endif /** * @brief The DALi namespace. diff --git a/dali/public-api/math/matrix.h b/dali/public-api/math/matrix.h index 9391124..c9153f1 100644 --- a/dali/public-api/math/matrix.h +++ b/dali/public-api/math/matrix.h @@ -46,7 +46,7 @@ class DALI_CORE_API Matrix { public: - friend std::ostream& operator<< (std::ostream& o, const Matrix& matrix); + friend DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Matrix& matrix); /** * @brief Constructor. diff --git a/dali/public-api/math/matrix3.h b/dali/public-api/math/matrix3.h index 16b52eb..46f7607 100644 --- a/dali/public-api/math/matrix3.h +++ b/dali/public-api/math/matrix3.h @@ -42,7 +42,7 @@ class DALI_CORE_API Matrix3 { public: - friend std::ostream& operator<< (std::ostream& o, const Matrix3& matrix); + friend DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Matrix3& matrix); /** * @brief The identity matrix. diff --git a/dali/public-api/math/random.h b/dali/public-api/math/random.h index 2d5d237..bc6fcbd 100644 --- a/dali/public-api/math/random.h +++ b/dali/public-api/math/random.h @@ -17,6 +17,8 @@ * limitations under the License. * */ +// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES #include diff --git a/dali/public-api/object/property-array.h b/dali/public-api/object/property-array.h index ef47612..331d1e9 100644 --- a/dali/public-api/object/property-array.h +++ b/dali/public-api/object/property-array.h @@ -200,7 +200,7 @@ public: * @brief Output to stream. * @SINCE_1_1.28 */ - friend std::ostream& operator<<( std::ostream& stream, const Property::Array& array ); + friend DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Array& array ); private: struct DALI_INTERNAL Impl; ///< Private data diff --git a/dali/public-api/object/property-map.h b/dali/public-api/object/property-map.h index 8f77396..44a132f 100644 --- a/dali/public-api/object/property-map.h +++ b/dali/public-api/object/property-map.h @@ -363,7 +363,7 @@ public: * @brief Output to stream. * @SINCE_1_1.28 */ - friend std::ostream& operator<<( std::ostream& stream, const Property::Map& map ); + friend DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Map& map ); private: struct DALI_INTERNAL Impl; ///< Private data diff --git a/dali/public-api/object/property-value.h b/dali/public-api/object/property-value.h index fa66e05..4cb607e 100644 --- a/dali/public-api/object/property-value.h +++ b/dali/public-api/object/property-value.h @@ -412,7 +412,7 @@ public: * @brief Output to stream. * @SINCE_1_0.0 */ - friend std::ostream& operator<<( std::ostream& ouputStream, const Property::Value& value ); + friend DALI_CORE_API std::ostream& operator<<( std::ostream& ouputStream, const Property::Value& value ); private: diff --git a/dali/public-api/object/ref-object.cpp b/dali/public-api/object/ref-object.cpp index 3060f4b..6ed98ba 100644 --- a/dali/public-api/object/ref-object.cpp +++ b/dali/public-api/object/ref-object.cpp @@ -101,8 +101,7 @@ void RefObject::Reference() #else - // gcc > 4.1 builtin atomic add and fetch: - __sync_add_and_fetch( &mCount, 1 ); + std::atomic_fetch_add(&mCount, 1); #endif } @@ -150,8 +149,7 @@ void RefObject::Unreference() #else - // gcc > 4.1 builtin atomic subtract and fetch (--mCount; return mCount) - newValue = __sync_sub_and_fetch( &mCount, 1 ); + newValue = ( mCount -= 1 ); #endif diff --git a/dali/public-api/object/ref-object.h b/dali/public-api/object/ref-object.h index 3ead400..76acbe2 100644 --- a/dali/public-api/object/ref-object.h +++ b/dali/public-api/object/ref-object.h @@ -22,6 +22,8 @@ #include #include +#include + namespace Dali { /** @@ -100,8 +102,7 @@ protected: RefObject& operator=(const RefObject& rhs); private: - - volatile int mCount; ///< Reference count + volatile std::atomic mCount; ///< Reference count }; /** diff --git a/dali/public-api/signals/base-signal.h b/dali/public-api/signals/base-signal.h index 2ea9770..159cc6e 100644 --- a/dali/public-api/signals/base-signal.h +++ b/dali/public-api/signals/base-signal.h @@ -113,7 +113,7 @@ public: * @brief Used to guard against nested Emit() calls. * @SINCE_1_0.0 */ - struct EmitGuard + struct DALI_CORE_API EmitGuard { /** * @brief Creates the guard. diff --git a/dali/public-api/signals/callback.h b/dali/public-api/signals/callback.h index 5224ee8..2c0f48c 100644 --- a/dali/public-api/signals/callback.h +++ b/dali/public-api/signals/callback.h @@ -25,6 +25,12 @@ #include #include +#ifdef WIN32 +#define STDCALL __stdcall +#else +#define STDCALL +#endif + namespace Dali { /** @@ -112,7 +118,7 @@ public: } else if( !callback.mImpl && callback.mFunction ) { - typedef R(*Function1)(); + typedef R(STDCALL *Function1)(); returnVal = (*(reinterpret_cast< Function1 >( callback.mFunction )))(); } @@ -143,7 +149,7 @@ public: else if( !callback.mImpl && callback.mFunction ) { // convert function type - typedef void(*Function1)(P1); + typedef void(STDCALL *Function1)(P1); (*(reinterpret_cast< Function1 >( callback.mFunction )))( param1 ); } } @@ -174,7 +180,7 @@ public: else if( !callback.mImpl && callback.mFunction ) { // convert function type - typedef R(*Function1)(P1); + typedef R(STDCALL *Function1)(P1); returnVal = (*(reinterpret_cast< Function1 >( callback.mFunction )))( param1 ); } @@ -206,7 +212,7 @@ public: else if( !callback.mImpl && callback.mFunction ) { // convert function type - typedef void(*Function2)(P1,P2); + typedef void(STDCALL *Function2)(P1,P2); (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2 ); } } @@ -238,7 +244,7 @@ public: else if( !callback.mImpl && callback.mFunction ) { // convert function type - typedef R(*Function2)(P1,P2); + typedef R(STDCALL *Function2)(P1,P2); returnVal = (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2 ); } @@ -271,7 +277,7 @@ public: else if( !callback.mImpl && callback.mFunction ) { // convert function type - typedef void(*Function2)(P1,P2,P3); + typedef void(STDCALL *Function2)(P1,P2,P3); (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2, param3 ); } } @@ -304,7 +310,7 @@ public: else if( !callback.mImpl && callback.mFunction ) { // convert function type - typedef R(*Function2)(P1,P2,P3); + typedef R(STDCALL *Function2)(P1,P2,P3); returnVal = (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2, param3 ); } @@ -317,13 +323,13 @@ protected: // Constructors for deriving classes * @brief Function with static linkage. * @SINCE_1_0.0 */ - typedef void(*Function)(void); + typedef void(STDCALL *Function)(void); /** * @brief Member function. * @SINCE_1_0.0 */ - typedef void (CallbackBase::*MemberFunction)( void ); + typedef void (STDCALL CallbackBase::*MemberFunction)( void ); /** * @brief Used to call the correct member function. -- 2.7.4