From 656874af27bb2e1583d9cb43ed3452f53793b80d Mon Sep 17 00:00:00 2001 From: Francisco Santos Date: Thu, 19 Mar 2015 16:50:41 +0000 Subject: [PATCH] PropertyBuffers implementation. Change-Id: Iedf35d2e4124efb54ead2cccc31f38f00a27deb9 --- .../internal/event/common/property-buffer-impl.cpp | 221 +++++++++++++++++++-- dali/internal/event/common/property-buffer-impl.h | 101 +++++++++- dali/internal/render/renderers/render-geometry.cpp | 2 +- .../update/common/scene-graph-property-buffer.cpp | 69 ++++--- .../update/common/scene-graph-property-buffer.h | 111 ++++++++++- .../update/geometry/scene-graph-geometry.cpp | 6 - dali/public-api/object/property-buffer.cpp | 11 +- dali/public-api/object/property-buffer.h | 2 +- 8 files changed, 455 insertions(+), 68 deletions(-) diff --git a/dali/internal/event/common/property-buffer-impl.cpp b/dali/internal/event/common/property-buffer-impl.cpp index 4279169..6d0b5db 100644 --- a/dali/internal/event/common/property-buffer-impl.cpp +++ b/dali/internal/event/common/property-buffer-impl.cpp @@ -18,19 +18,24 @@ // CLASS HEADER #include // Dali::Internal::PropertyBuffer +// EXTERNAL INCLUDE +#include // std::sort + // INTERNAL INCLUDES -#include // Dali::Internal::PropertyBuffer +#include // Dali::Internal::PropertyBuffer #include // Dali::Internal::ObjectHelper #include // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END #include #include -// @todo MESH_REWORK remove this comment - Don't include "stage.h" - use GetEventThreadServices() instead. namespace Dali { namespace Internal { +using SceneGraph::PropertyBufferMetadata::Format; +using SceneGraph::PropertyBufferMetadata::Component; + namespace { @@ -48,27 +53,40 @@ const ObjectImplHelper PROPERTY_BUFFER_IMPL = { DEFAULT_ PropertyBufferPtr PropertyBuffer::New() { - return PropertyBufferPtr( new PropertyBuffer() ); + PropertyBufferPtr propertyBuffer( new PropertyBuffer() ); + propertyBuffer->Initialize(); + + return propertyBuffer; } void PropertyBuffer::SetSize( std::size_t size ) { - //TODO: MESH_REWORK - DALI_ASSERT_ALWAYS( false && "MESH_REWORK" ); + mSize = size; + + SizeChanged(); + + SceneGraph::SetSizeMessage( GetEventThreadServices(), + *mSceneObject, + mSize ); } std::size_t PropertyBuffer::GetSize() const { - //TODO: MESH_REWORK - DALI_ASSERT_ALWAYS( false && "MESH_REWORK" ); - - return 0; + return mSize; } -void PropertyBuffer::SetData( void* data ) +void PropertyBuffer::SetData( const void* data ) { - //TODO: MESH_REWORK - DALI_ASSERT_ALWAYS( false && "MESH_REWORK" ); + DALI_ASSERT_DEBUG( mFormat.Count() && "Format must be set before setting the data." ); + + DALI_ASSERT_ALWAYS( mSize && "Size of the buffer must be set before setting the data." ); + + const char* source = static_cast( data ); + std::copy( source, source + mBuffer.Size(), &mBuffer[0] ); + + SceneGraph::SetDataMessage( GetEventThreadServices(), + *mSceneObject, + new SceneGraph::PropertyBuffer::BufferType( mBuffer ) ); } Dali::Property::Index PropertyBuffer::GetPropertyIndex( const std::string name, std::size_t index ) @@ -83,6 +101,40 @@ const SceneGraph::PropertyBuffer* PropertyBuffer::GetPropertyBufferSceneObject() return mSceneObject; } +void PropertyBuffer::SetType( Dali::PropertyBuffer::Type type ) +{ + DALI_ASSERT_DEBUG( !mTypeSet && "Type of property buffer can only be set once." ); + + switch(type) + { + case Dali::PropertyBuffer::STATIC: + { + mIsAnimatable = false; + break; + } + case Dali::PropertyBuffer::ANIMATABLE: + { + mIsAnimatable = true; + break; + } + } + +#ifdef DEBUG_ENABLED + mTypeSet = true; +#endif // DEBUG_ENABLED +} + +void PropertyBuffer::SetFormat( Dali::Property::Map& format ) +{ + DALI_ASSERT_ALWAYS( format.Count() && "Format cannot be empty." ); + + DALI_ASSERT_DEBUG( 0 == mFormat.Count() && "Format of property buffer can only be set once." ); + + mFormat = format; + + FormatChanged(); +} + unsigned int PropertyBuffer::GetDefaultPropertyCount() const { return PROPERTY_BUFFER_IMPL.GetDefaultPropertyCount(); @@ -246,10 +298,153 @@ void PropertyBuffer::Disconnect() mOnStage = false; } +PropertyBuffer::~PropertyBuffer() +{ +} + PropertyBuffer::PropertyBuffer() -: mSceneObject(NULL), +: mSceneObject( NULL ), + mBufferFormat( NULL ), + mSize( 0 ), + mIsAnimatable( false ), mOnStage( false ) +#ifdef DEBUG_ENABLED + , mTypeSet( false ) +#endif +{ +} + +void PropertyBuffer::Initialize() +{ + EventThreadServices& eventThreadServices = GetEventThreadServices(); + SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager(); + + DALI_ASSERT_ALWAYS( EventThreadServices::IsCoreRunning() && "Core is not running" ); + + mSceneObject = new SceneGraph::PropertyBuffer(); + AddMessage( updateManager, updateManager.GetPropertyBufferOwner(), *mSceneObject ); +} + +void PropertyBuffer::FormatChanged() +{ + size_t numComponents = mFormat.Count(); + + // Create the format + DALI_ASSERT_DEBUG( mBufferFormat == NULL && "PropertyFormat should not be set yet" ); + Format* bufferFormat = new Format(); + bufferFormat->components.resize( numComponents ); + + unsigned int elementSize = 0; + for( size_t i = 0u; i < numComponents; ++i ) + { + StringValuePair component = mFormat.GetPair( i ); + + // Get the name + bufferFormat->components[i].name = component.first; + + // Get the size + Property::Type type = Property::Type( component.second.Get() ); + elementSize += GetPropertyImplementationSize( type ); + + // write the accumulatedSize + bufferFormat->components[i].accumulatedSize = elementSize; + } + + mBufferFormat = bufferFormat; + + SceneGraph::SetFormatMessage( GetEventThreadServices(), + *mSceneObject, + bufferFormat ); + + if( mSize ) + { + SizeChanged(); + } +} + +void PropertyBuffer::SizeChanged() { + // Check if format and size have been set yet + if( mBufferFormat != NULL ) + { + unsigned int bufferSize = mBufferFormat->GetElementSize() * mSize; + mBuffer.Resize( bufferSize ); + } +} + +unsigned int GetPropertyImplementationSize( Property::Type& propertyType ) +{ + unsigned int size = 0u; + + switch( propertyType ) + { + case Property::NONE: + case Property::TYPE_COUNT: + case Property::STRING: + case Property::ARRAY: + case Property::MAP: + { + DALI_ASSERT_ALWAYS( "No size for properties with no type, or dynamic sizes" ); + break; + } + case Property::BOOLEAN: + { + size = sizeof( PropertyImplementationType< Property::BOOLEAN >::Type ); + break; + } + case Property::FLOAT: + { + size = sizeof( PropertyImplementationType< Property::FLOAT >::Type ); + break; + } + case Property::INTEGER: + { + size = sizeof( PropertyImplementationType< Property::INTEGER >::Type ); + break; + } + case Property::UNSIGNED_INTEGER: + { + size = sizeof( PropertyImplementationType< Property::UNSIGNED_INTEGER >::Type ); + break; + } + case Property::VECTOR2: + { + size = sizeof( PropertyImplementationType< Property::VECTOR2 >::Type ); + break; + } + case Property::VECTOR3: + { + size = sizeof( PropertyImplementationType< Property::VECTOR3 >::Type ); + break; + } + case Property::VECTOR4: + { + size = sizeof( PropertyImplementationType< Property::VECTOR4 >::Type ); + break; + } + case Property::MATRIX3: + { + size = sizeof( PropertyImplementationType< Property::MATRIX3 >::Type ); + break; + } + case Property::MATRIX: + { + size = sizeof( PropertyImplementationType< Property::MATRIX >::Type ); + break; + } + case Property::RECTANGLE: + { + size = sizeof( PropertyImplementationType< Property::RECTANGLE >::Type ); + break; + } + case Property::ROTATION: + { + size = sizeof( PropertyImplementationType< Property::ROTATION >::Type ); + break; + } + } + + return size; } } // namespace Internal diff --git a/dali/internal/event/common/property-buffer-impl.h b/dali/internal/event/common/property-buffer-impl.h index e8846c5..060982e 100644 --- a/dali/internal/event/common/property-buffer-impl.h +++ b/dali/internal/event/common/property-buffer-impl.h @@ -22,6 +22,7 @@ #include // DALI_ASSERT_ALWAYS #include // Dali::IntrusivePtr #include // Dali::PropertyBuffer +#include // Dali::Property::Map #include // Dali::Internal::Connectable #include // Dali::Internal::ObjectConnector #include // Dali::Internal::Object @@ -33,7 +34,13 @@ namespace Internal namespace SceneGraph { class PropertyBuffer; -} + +namespace PropertyBufferMetadata +{ +struct Format; +} // namespace PropertyBufferMetadata + +} // namespace SceneGraph class PropertyBuffer; typedef IntrusivePtr PropertyBufferPtr; @@ -64,7 +71,7 @@ public: /** * @copydoc PropertBuffer::SetData() */ - void SetData( void* data ); + void SetData( const void* data ); /** * @copydoc PropertBuffer::GetPropertyIndex() @@ -78,6 +85,24 @@ public: */ const SceneGraph::PropertyBuffer* GetPropertyBufferSceneObject() const; + /** + * @brief Set the type of PropertyBuffer + * + * @pre Has not been set yet + * + * @param[in] type of PropertyBuffer + */ + void SetType( Dali::PropertyBuffer::Type type ); + + /** + * @brief Set the format of the PropertyBuffer + * + * @pre Has not been set yet + * + * @param[in] format of the PropertyBuffer + */ + void SetFormat( Dali::Property::Map& format ); + public: // Default property extensions from Object /** @@ -167,7 +192,7 @@ public: // Functions from Connectable virtual bool OnStage() const; /** - * @copydoc Dali::Internal::Connectable::Connect() + * @copydoc Dali::Internal::Connectable::Contnect() */ virtual void Connect(); @@ -176,18 +201,84 @@ public: // Functions from Connectable */ virtual void Disconnect(); +protected: + /** + * @brief Destructor + */ + ~PropertyBuffer(); + private: // implementation + /** + * @brief Default constructor + */ PropertyBuffer(); + /** + * Second stage initialization + */ + void Initialize(); + + /** + * Update the buffer when the format changes + */ + void FormatChanged(); + + /** + * Update the buffer when the size changes + */ + void SizeChanged(); + private: // unimplemented methods PropertyBuffer( const PropertyBuffer& ); PropertyBuffer& operator=( const PropertyBuffer& ); private: // data - SceneGraph::PropertyBuffer* mSceneObject; - bool mOnStage; + SceneGraph::PropertyBuffer* mSceneObject; ///< Update side object + + Property::Map mFormat; ///< Format of the property buffer + const SceneGraph::PropertyBufferMetadata::Format* mBufferFormat; ///< Metadata for the format of the property buffer + + unsigned int mSize; ///< Size of the buffer + bool mIsAnimatable; ///< Flag to know if the property buffer is animatable + + Dali::Vector< char > mBuffer; + + bool mOnStage; ///< Flag to know if the object is on stage + +#ifdef DEBUG_ENABLED +private: + bool mTypeSet; // used to ensure the type doesn't change at runtime +#endif // DEBUG_ENABLED }; +/** + * Get the implementation type from a Property::Type + */ +template struct PropertyImplementationType +{ + // typedef ... Type; not defined, only support types declared bellow +}; +template<> struct PropertyImplementationType< Property::BOOLEAN > { typedef bool Type; }; +template<> struct PropertyImplementationType< Property::FLOAT > { typedef float Type; }; +template<> struct PropertyImplementationType< Property::INTEGER > { typedef int Type; }; +template<> struct PropertyImplementationType< Property::UNSIGNED_INTEGER > { typedef unsigned int Type; }; +template<> struct PropertyImplementationType< Property::VECTOR2 > { typedef Vector2 Type; }; +template<> struct PropertyImplementationType< Property::VECTOR3 > { typedef Vector3 Type; }; +template<> struct PropertyImplementationType< Property::VECTOR4 > { typedef Vector4 Type; }; +template<> struct PropertyImplementationType< Property::MATRIX3 > { typedef Matrix3 Type; }; +template<> struct PropertyImplementationType< Property::MATRIX > { typedef Matrix Type; }; +template<> struct PropertyImplementationType< Property::RECTANGLE > { typedef Rect Type; }; +template<> struct PropertyImplementationType< Property::ROTATION > { typedef Quaternion Type; }; + +/** + * Get the size of the implementation of a Property::Type + * + * @param[in] propertyType Property::Type used to check the size + * + * @return Size given by sizeof for the implementation this propertyType + */ +unsigned int GetPropertyImplementationSize( Property::Type& propertyType ); + } // namespace Internal // Helpers for public-api forwarding methods diff --git a/dali/internal/render/renderers/render-geometry.cpp b/dali/internal/render/renderers/render-geometry.cpp index 8ebf81c..0c91482 100644 --- a/dali/internal/render/renderers/render-geometry.cpp +++ b/dali/internal/render/renderers/render-geometry.cpp @@ -190,7 +190,7 @@ void RenderGeometry::Draw( Context* context, BufferIndex bufferIndex, const Geom if( indexBuffer ) { - numIndices = indexBuffer->GetDataSize(bufferIndex) / indexBuffer->GetElementSize(bufferIndex); + numIndices = /* TODO: MESH_REWORK remove this 2, should implement unsigned short properties */ 2 * indexBuffer->GetDataSize(bufferIndex) / indexBuffer->GetElementSize(bufferIndex); } switch(type) diff --git a/dali/internal/update/common/scene-graph-property-buffer.cpp b/dali/internal/update/common/scene-graph-property-buffer.cpp index f4f57bf..f405202 100644 --- a/dali/internal/update/common/scene-graph-property-buffer.cpp +++ b/dali/internal/update/common/scene-graph-property-buffer.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "scene-graph-property-buffer.h" +#include namespace Dali { @@ -23,7 +23,27 @@ namespace Internal namespace SceneGraph { +namespace PropertyBufferMetadata +{ + +unsigned int Format::GetComponentOffset( unsigned int index ) const +{ + DALI_ASSERT_DEBUG( index >= 0 && index < components.size() && "Index not within the correct boundaries." ); + return index > 0 ? components[index-1u].accumulatedSize : 0; +} + +unsigned int Format::GetElementSize() const +{ + unsigned int numComponents = components.size(); + return numComponents ? components.back().accumulatedSize : 0; +} + +} // namespace PropertyBufferMetadata + + PropertyBuffer::PropertyBuffer() +: mRenderBufferData( NULL ), + mSize(0u) { } @@ -31,53 +51,42 @@ PropertyBuffer::~PropertyBuffer() { } -//@todo MESH_REWORK Remove when we have working property buffers -PropertyBuffer* PropertyBuffer::NewQuadVertices() +std::size_t PropertyBuffer::GetDataSize( BufferIndex bufferIndex ) const { - PropertyBuffer* propertyBuffer = new PropertyBuffer(); - propertyBuffer->mElementSize = sizeof(Vector4); - propertyBuffer->mData.Resize( propertyBuffer->mElementSize * 4 ); - Vector4* vertices = reinterpret_cast(&propertyBuffer->mData[0]); - - vertices[ 0 ] = Vector4( -0.5f, -0.5f, 0.0f, 0.0f ); - vertices[ 1 ] = Vector4( 0.5f, -0.5f, 1.0f, 0.0f ); - vertices[ 2 ] = Vector4( -0.5f, 0.5f, 0.0f, 1.0f ); - vertices[ 3 ] = Vector4( 0.5f, 0.5f, 1.0f, 1.0f ); + DALI_ASSERT_DEBUG( mFormat && "Format must have been set!" ); - return propertyBuffer; + // @todo MESH_REWORK mData should be double buffered? + return mFormat->components.back().accumulatedSize * mSize; } -//@todo MESH_REWORK Remove when we have working property buffers -PropertyBuffer* PropertyBuffer::NewQuadIndices() +std::size_t PropertyBuffer::GetElementSize( BufferIndex bufferIndex ) const { - PropertyBuffer* propertyBuffer = new PropertyBuffer(); + DALI_ASSERT_DEBUG( mFormat && "Format must have been set!" ); - propertyBuffer->mElementSize = sizeof( unsigned short ); - propertyBuffer->mData.Resize( propertyBuffer->mElementSize * 6 ); - unsigned short* indices = reinterpret_cast(&propertyBuffer->mData[0]); - - indices[0] = 0; indices[1] = 3; indices[2] = 1; - indices[3] = 0; indices[4] = 2; indices[5] = 3; + // @todo MESH_REWORK mData should be double buffered? + return mFormat->GetElementSize(); +} - return propertyBuffer; +void PropertyBuffer::SetFormat( PropertyBufferMetadata::Format* format ) +{ + mFormat = format; } -std::size_t PropertyBuffer::GetDataSize( BufferIndex bufferIndex ) const +//TODO:: MESH_REWORK Remove this, should be a property +void PropertyBuffer::SetSize( unsigned int size ) { - // @todo MESH_REWORK mData should be double buffered - return mData.Count(); + mSize = size; } -std::size_t PropertyBuffer::GetElementSize( BufferIndex bufferIndex ) const +void PropertyBuffer::SetData( BufferType* data ) { - // @todo MESH_REWORK mElementSize should be double buffered - return mElementSize; + mBufferData = data; } const void* PropertyBuffer::GetData( BufferIndex bufferIndex ) const { // @todo MESH_REWORK mData should be double buffered - return reinterpret_cast< const void* >(&mData[0]); + return reinterpret_cast< const void* >(&(*mBufferData.Get())[0]); } void PropertyBuffer::ConnectToSceneGraph( SceneController& sceneController, BufferIndex bufferIndex ) diff --git a/dali/internal/update/common/scene-graph-property-buffer.h b/dali/internal/update/common/scene-graph-property-buffer.h index 879b260..06e0781 100644 --- a/dali/internal/update/common/scene-graph-property-buffer.h +++ b/dali/internal/update/common/scene-graph-property-buffer.h @@ -17,9 +17,9 @@ * limitations under the License. */ -#include #include #include +#include namespace Dali { @@ -29,14 +29,51 @@ namespace SceneGraph { class SceneController; +namespace PropertyBufferMetadata +{ +/** + * Structure that holds name and size of a component in the PropertyBuffer. + */ +struct Component +{ + std::string name; + unsigned int accumulatedSize; +}; + +/** + * Structure that holds the meta-data of the format of PropertyBuffer. + */ +struct Format +{ + std::vector components; + + /** + * @brief Get the offset of a component within an element + * + * @pre index must be within 0 and components.Size()-1 + * + * @return The offset for a component within an element + */ + unsigned int GetComponentOffset( unsigned int index ) const; + + /** + * @brief Get the size of an element + * + * @return The size of an element + */ + unsigned int GetElementSize() const; +}; + +} // PropertyBufferMetadata + class PropertyBuffer : public PropertyOwner { public: - //@todo MESH_REWORK Remove when we have working property buffers - static PropertyBuffer* NewQuadVertices(); - //@todo MESH_REWORK Remove when we have working property buffers - static PropertyBuffer* NewQuadIndices(); + /** + * Type for the data contained in the buffer + */ + typedef Dali::Vector< char > BufferType; /** * Constructor @@ -61,6 +98,21 @@ public: std::size_t GetElementSize( BufferIndex bufferIndex ) const; /** + * Set the format of the buffer + * @param[in] format The format for the PropertyBuffer + */ + void SetFormat( PropertyBufferMetadata::Format* format ); + + /** + * Set the data of the PropertyBuffer + * @param[in] data The new data of the PropertyBuffer + */ + void SetData( BufferType* data ); + + //TODO:: MESH_REWORK Remove this, should be a property + void SetSize( unsigned int size ); + + /** * Get the property buffer data * @return the property buffer's data array */ @@ -80,13 +132,54 @@ public: void DisconnectFromSceneGraph( SceneController& sceneController, BufferIndex bufferIndex ); private: + OwnerPointer mFormat; ///< Format of the buffer + OwnerPointer mBufferData; ///< Data + BufferType* mRenderBufferData; - // @todo MESH_REWORK - TEMPORARY TYPES - REMOVE WHEN WE HAVE WORKING BUFFERS - typedef Dali::Vector< char > CharBuffer; - CharBuffer mData; - std::size_t mElementSize; + //TODO: MESH_REWORK should be double buffered property + unsigned int mSize; ///< Size of the buffer }; +inline void SetFormatMessage( EventThreadServices& eventThreadServices, + const PropertyBuffer& propertyBuffer, + PropertyBufferMetadata::Format* format ) +{ + typedef MessageValue1< PropertyBuffer, OwnerPointer > LocalType; + + // Reserve some memory inside the message queue + unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &propertyBuffer, &PropertyBuffer::SetFormat, format ); +} + +//TODO:: MESH_REWORK Remove this, should be a property +inline void SetSizeMessage( EventThreadServices& eventThreadServices, + const PropertyBuffer& propertyBuffer, + unsigned int size ) +{ + typedef MessageValue1< PropertyBuffer, unsigned int > LocalType; + + // Reserve some memory inside the message queue + unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &propertyBuffer, &PropertyBuffer::SetSize, size ); +} + +inline void SetDataMessage( EventThreadServices& eventThreadServices, + const PropertyBuffer& propertyBuffer, + PropertyBuffer::BufferType* data ) +{ + typedef MessageValue1< PropertyBuffer, OwnerPointer > LocalType; + + // Reserve some memory inside the message queue + unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &propertyBuffer, &PropertyBuffer::SetData, data ); +} + } // namespace SceneGraph } // namespace Internal } // namespace Dali diff --git a/dali/internal/update/geometry/scene-graph-geometry.cpp b/dali/internal/update/geometry/scene-graph-geometry.cpp index 7bb9d2a..c951fb7 100644 --- a/dali/internal/update/geometry/scene-graph-geometry.cpp +++ b/dali/internal/update/geometry/scene-graph-geometry.cpp @@ -29,12 +29,6 @@ Geometry::Geometry() mGeometryType(Dali::Geometry::TRIANGLES), mRequiresDepthTest(false) { - // @todo MESH_REWORK Remove this code when we have working property buffers - // @todo It's also the wrong place to do this temporary work - PropertyBuffer* vertexPropertyBuffer = PropertyBuffer::NewQuadVertices(); - mVertexBuffers.PushBack( vertexPropertyBuffer ); - - mIndexBuffer = PropertyBuffer::NewQuadIndices(); // Observe our own PropertyOwner's uniform map AddUniformMapObserver( *this ); diff --git a/dali/public-api/object/property-buffer.cpp b/dali/public-api/object/property-buffer.cpp index 2e89cd5..4f28f49 100644 --- a/dali/public-api/object/property-buffer.cpp +++ b/dali/public-api/object/property-buffer.cpp @@ -26,10 +26,15 @@ namespace Dali { -PropertyBuffer PropertyBuffer::New( Type type, Dali::Property::Map bufferFormat, std::size_t size ) +PropertyBuffer PropertyBuffer::New( Type type, Dali::Property::Map& bufferFormat, std::size_t size ) { - Internal::PropertyBufferPtr renderer = Internal::PropertyBuffer::New(); - return PropertyBuffer( renderer.Get() ); + Internal::PropertyBufferPtr propertyBuffer = Internal::PropertyBuffer::New(); + + propertyBuffer->SetType( type ); + propertyBuffer->SetFormat( bufferFormat ); + propertyBuffer->SetSize( size ); + + return PropertyBuffer( propertyBuffer.Get() ); } PropertyBuffer::PropertyBuffer() diff --git a/dali/public-api/object/property-buffer.h b/dali/public-api/object/property-buffer.h index b6a40bd..e9b277d 100644 --- a/dali/public-api/object/property-buffer.h +++ b/dali/public-api/object/property-buffer.h @@ -73,7 +73,7 @@ public: * @param[in] size The number of elements in the property buffer * @return Handle to a newly allocated PropertyBuffer */ - static PropertyBuffer New( Type type, Dali::Property::Map bufferFormat, std::size_t size ); + static PropertyBuffer New( Type type, Dali::Property::Map& bufferFormat, std::size_t size ); /** * @brief Default constructor, creates an empty handle -- 2.7.4