PropertyBuffer SetData clean-up 22/63022/3
authorPaul Wisbey <p.wisbey@samsung.com>
Mon, 21 Mar 2016 16:14:36 +0000 (16:14 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 21 Mar 2016 16:38:32 +0000 (16:38 +0000)
Removed potentially dangerous disconnect between size parameter,
and the actual size of the data. Note that there is not actual
SIZE property as implied by the old comments.

Change-Id: Ifa6ec50069e9609a4675c34d09cb571e8a86158b

15 files changed:
automated-tests/src/dali-devel/utc-Dali-Geometry.cpp
automated-tests/src/dali-devel/utc-Dali-PropertyBuffer.cpp
automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp
automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp
dali/devel-api/object/property-buffer.cpp
dali/devel-api/object/property-buffer.h
dali/internal/event/actors/image-actor-impl.cpp
dali/internal/event/common/property-buffer-impl.cpp
dali/internal/event/common/property-buffer-impl.h
dali/internal/render/common/render-manager.cpp
dali/internal/render/common/render-manager.h
dali/internal/render/renderers/render-property-buffer.cpp
dali/internal/render/renderers/render-property-buffer.h
dali/internal/update/manager/update-manager.cpp
dali/internal/update/manager/update-manager.h

index 961072a..40e5685 100644 (file)
@@ -57,8 +57,8 @@ PropertyBuffer CreateVertexBuffer( const std::string& aPosition, const std::stri
   vertexFormat[aPosition] = Property::VECTOR2;
   vertexFormat[aTexCoord] = Property::VECTOR2;
 
-  PropertyBuffer vertexData = PropertyBuffer::New( vertexFormat, 4 );
-  vertexData.SetData(texturedQuadVertexData);
+  PropertyBuffer vertexData = PropertyBuffer::New( vertexFormat );
+  vertexData.SetData( texturedQuadVertexData, 4 );
 
   return vertexData;
 }
@@ -70,8 +70,8 @@ PropertyBuffer CreateIndexBuffer()
 
   Property::Map indexFormat;
   indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat, numberElements );
-  indices.SetData(indexData);
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+  indices.SetData( indexData, numberElements );
 
   return indices;
 }
index d6e09e7..f04e214 100644 (file)
@@ -49,7 +49,7 @@ int UtcDaliPropertyBufferNew01(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
 
   DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
   END_TEST;
@@ -71,7 +71,7 @@ int UtcDaliPropertyBufferDownCast01(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
 
   BaseHandle handle(propertyBuffer);
   PropertyBuffer propertyBuffer2 = PropertyBuffer::DownCast(handle);
@@ -98,7 +98,7 @@ int UtcDaliPropertyBufferCopyConstructor(void)
   PropertyBuffer propertyBufferCopy(propertyBuffer);
 
   DALI_TEST_EQUALS( (bool)propertyBufferCopy, true, TEST_LOCATION );
-  DALI_TEST_EQUALS( propertyBufferCopy.GetSize(), 4u, TEST_LOCATION );
+  DALI_TEST_EQUALS( propertyBufferCopy.GetSize(), 0u, TEST_LOCATION );
 
   END_TEST;
 }
@@ -114,7 +114,7 @@ int UtcDaliPropertyBufferAssignmentOperator(void)
 
   propertyBuffer2 = propertyBuffer;
   DALI_TEST_EQUALS( (bool)propertyBuffer2, true, TEST_LOCATION );
-  DALI_TEST_EQUALS( propertyBuffer2.GetSize(), 4u, TEST_LOCATION );
+  DALI_TEST_EQUALS( propertyBuffer2.GetSize(), 0u, TEST_LOCATION );
 
   END_TEST;
 }
@@ -127,7 +127,7 @@ int UtcDaliPropertyBufferSetData01(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
   DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
 
   const float halfQuadSize = .5f;
@@ -138,7 +138,7 @@ int UtcDaliPropertyBufferSetData01(void)
     { Vector2(-halfQuadSize,  halfQuadSize), Vector2(0.f, 1.f) },
     { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
 
-  propertyBuffer.SetData( texturedQuadVertexData );
+  propertyBuffer.SetData( texturedQuadVertexData, 4 );
 
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( propertyBuffer );
@@ -173,7 +173,7 @@ int UtcDaliPropertyBufferSetData02(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
+  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
   DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
 
   const float halfQuadSize = .5f;
@@ -184,7 +184,7 @@ int UtcDaliPropertyBufferSetData02(void)
     { Vector2(-halfQuadSize,  halfQuadSize), Vector2(0.f, 1.f) },
     { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
 
-  propertyBuffer.SetData( texturedQuadVertexData );
+  propertyBuffer.SetData( texturedQuadVertexData, 4 );
 
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( propertyBuffer );
@@ -211,7 +211,7 @@ int UtcDaliPropertyBufferSetData02(void)
   }
 
   // Re-upload the data on the propertyBuffer
-  propertyBuffer.SetData( texturedQuadVertexData );
+  propertyBuffer.SetData( texturedQuadVertexData, 4 );
 
   application.SendNotification();
   application.Render(0);
@@ -237,51 +237,3 @@ int UtcDaliPropertyBufferSetData02(void)
 
   END_TEST;
 }
-
-int UtcDaliPropertyBufferSetGetSize01(void)
-{
-  TestApplication application;
-
-  Property::Map texturedQuadVertexFormat;
-  texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
-  texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
-
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, 4u );
-  DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
-
-  size_t size = propertyBuffer.GetSize();
-  DALI_TEST_EQUALS( size, 4u, TEST_LOCATION );
-
-  propertyBuffer.SetSize( 10u );
-  size = propertyBuffer.GetSize();
-  DALI_TEST_EQUALS( size, 10u, TEST_LOCATION );
-
-  END_TEST;
-}
-
-//Todo: also test that the SetSize function is equivalent to setting the property SIZE
-int UtcDaliPropertyBufferSetGetSize02(void)
-{
-  TestApplication application;
-
-  Property::Map texturedQuadVertexFormat;
-  texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
-  texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
-
-  std::size_t size = 5u;
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat, size );
-  DALI_TEST_EQUALS( propertyBuffer.GetSize(), size, TEST_LOCATION );
-  DALI_TEST_EQUALS( propertyBuffer.GetSize(), size, TEST_LOCATION );
-
-  size += 3u;
-  propertyBuffer.SetSize( size );
-  DALI_TEST_EQUALS( propertyBuffer.GetSize(), size, TEST_LOCATION );
-  DALI_TEST_EQUALS( propertyBuffer.GetSize(), size, TEST_LOCATION );
-
-  size += 2u;
-  propertyBuffer.SetSize( size );
-  DALI_TEST_EQUALS( propertyBuffer.GetSize(), size, TEST_LOCATION );
-
-  END_TEST;
-}
-
index 1761530..bed8463 100644 (file)
@@ -70,15 +70,15 @@ Geometry CreateGeometry()
   Property::Map texturedQuadVertexFormat;
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aTexCoord"] = Property::VECTOR2;
-  PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
-  texturedQuadVertices.SetData(texturedQuadVertexData);
+  PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat );
+  texturedQuadVertices.SetData( texturedQuadVertexData, 4 );
 
   // Create indices
   unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
   Property::Map indexFormat;
   indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat, sizeof(indexData)/sizeof(indexData[0]) );
-  indices.SetData(indexData);
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+  indices.SetData( indexData, sizeof(indexData)/sizeof(indexData[0]) );
 
   // Create the geometry object
   Geometry texturedQuadGeometry = Geometry::New();
index dff2386..378cfc2 100644 (file)
@@ -43,7 +43,7 @@ PropertyBuffer CreatePropertyBuffer()
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer vertexData = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
+  PropertyBuffer vertexData = PropertyBuffer::New( texturedQuadVertexFormat );
   return vertexData;
 }
 
@@ -62,13 +62,13 @@ Geometry CreateQuadGeometryFromBuffer( PropertyBuffer vertexData )
     { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
     { Vector2(-halfQuadSize,  halfQuadSize), Vector2(0.f, 1.f) },
     { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
-  vertexData.SetData(texturedQuadVertexData);
+  vertexData.SetData(texturedQuadVertexData, 4);
 
   unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
   Property::Map indexFormat;
   indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat, sizeof(indexData)/sizeof(indexData[0]) );
-  indices.SetData(indexData);
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+  indices.SetData( indexData, sizeof(indexData)/sizeof(indexData[0]) );
 
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexData );
index 4b8b4e4..f017f98 100644 (file)
 namespace Dali
 {
 
-PropertyBuffer PropertyBuffer::New( Dali::Property::Map& bufferFormat, std::size_t size )
+PropertyBuffer PropertyBuffer::New( Dali::Property::Map& bufferFormat )
 {
-  Internal::PropertyBufferPtr propertyBuffer = Internal::PropertyBuffer::New();
-
-  propertyBuffer->SetFormat( bufferFormat );
-  propertyBuffer->SetSize( size );
+  Internal::PropertyBufferPtr propertyBuffer = Internal::PropertyBuffer::New( bufferFormat );
 
   return PropertyBuffer( propertyBuffer.Get() );
 }
@@ -59,9 +56,9 @@ PropertyBuffer& PropertyBuffer::operator=( const PropertyBuffer& handle )
   return *this;
 }
 
-void PropertyBuffer::SetSize( std::size_t size )
+void PropertyBuffer::SetData( const void* data, std::size_t size )
 {
-  GetImplementation(*this).SetSize( size );
+  GetImplementation(*this).SetData( data, size );
 }
 
 std::size_t PropertyBuffer::GetSize() const
@@ -69,10 +66,6 @@ std::size_t PropertyBuffer::GetSize() const
   return  GetImplementation(*this).GetSize();
 }
 
-void PropertyBuffer::SetData( const void* data )
-{
-  GetImplementation(*this).SetData( data );
-}
 
 PropertyBuffer::PropertyBuffer( Internal::PropertyBuffer* pointer )
 : BaseHandle( pointer )
index 350c1ce..84593cb 100644 (file)
@@ -52,15 +52,15 @@ class PropertyBuffer;
  *  Property::Map texturedQuadVertexFormat;
  *  texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
  *  texturedQuadVertexFormat["aTexCoord"] = Property::VECTOR2;
- *  PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat, 4 );
- *  texturedQuadVertices.SetData(texturedQuadVertexData);
+ *  PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat );
+ *  texturedQuadVertices.SetData( texturedQuadVertexData, 4 );
  *
  *  // Create indices
  *  unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
  *  Property::Map indexFormat;
  *  indexFormat["indices"] = Property::INTEGER;
- *  PropertyBuffer indices = PropertyBuffer::New( indexFormat, 6 );
- *  indices.SetData(indexData);
+ *  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+ *  indices.SetData( indexData, 6 );
  *
  *  // Create the geometry object
  *  Geometry texturedQuadGeometry = Geometry::New();
@@ -81,7 +81,7 @@ public:
    * @param[in] size The number of elements in the property buffer
    * @return Handle to a newly allocated PropertyBuffer
    */
-  static PropertyBuffer New( Dali::Property::Map& bufferFormat, std::size_t size );
+  static PropertyBuffer New( Dali::Property::Map& bufferFormat );
 
   /**
    * @brief Default constructor, creates an empty handle
@@ -118,22 +118,6 @@ public:
   PropertyBuffer& operator=( const PropertyBuffer& handle );
 
   /**
-   * @brief Set the number of elements in the buffer
-   *
-   * Calling this function is equivalent to setting the property SIZE
-   *
-   * @param[in] size Number of elements to expand or contract the buffer
-   */
-  void SetSize( std::size_t size );
-
-  /**
-   * @brief Get the number of elements in the buffer
-   *
-   * @return Number of elements to expand or contract the buffer
-   */
-  std::size_t GetSize() const;
-
-  /**
    * @brief Update the whole buffer information
    *
    * This function expects a pointer to an array of structures with the same
@@ -152,8 +136,16 @@ public:
    * </pre>
    *
    * @param[in] data A pointer to the data that will be copied to the buffer.
+   * @param[in] size Number of elements to expand or contract the buffer.
    */
-  void SetData( const void* data );
+  void SetData( const void* data, std::size_t size );
+
+  /**
+   * @brief Get the number of elements in the buffer
+   *
+   * @return Number of elements to expand or contract the buffer
+   */
+  std::size_t GetSize() const;
 
 public:
   /**
index 1a85477..246f518 100644 (file)
@@ -111,26 +111,21 @@ GeometryPtr CreateGeometry( unsigned int gridWidth, unsigned int gridHeight, con
     }
   }
 
-
   Property::Map vertexFormat;
   vertexFormat[ "aPosition" ] = Property::VECTOR3;
   vertexFormat[ "aTexCoord" ] = Property::VECTOR2;
-  PropertyBufferPtr vertexPropertyBuffer = PropertyBuffer::New();
-  vertexPropertyBuffer->SetFormat( vertexFormat );
-  vertexPropertyBuffer->SetSize( vertices.size() );
+  PropertyBufferPtr vertexPropertyBuffer = PropertyBuffer::New( vertexFormat );
   if( vertices.size() > 0 )
   {
-    vertexPropertyBuffer->SetData( &vertices[ 0 ] );
+    vertexPropertyBuffer->SetData( &vertices[ 0 ], vertices.size() );
   }
 
   Property::Map indexFormat;
   indexFormat[ "indices" ] = Property::INTEGER;
-  PropertyBufferPtr indexPropertyBuffer = PropertyBuffer::New();
-  indexPropertyBuffer->SetFormat( indexFormat );
-  indexPropertyBuffer->SetSize( indices.Size() );
+  PropertyBufferPtr indexPropertyBuffer = PropertyBuffer::New( indexFormat );
   if( indices.Size() > 0 )
   {
-    indexPropertyBuffer->SetData( &indices[ 0 ] );
+    indexPropertyBuffer->SetData( &indices[ 0 ], indices.Size() );
   }
 
   // Create the geometry object
@@ -140,7 +135,6 @@ GeometryPtr CreateGeometry( unsigned int gridWidth, unsigned int gridHeight, con
   geometry->SetGeometryType( Dali::Geometry::TRIANGLE_STRIP );
 
   return geometry;
-
 }
 
 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
index 30f1ed5..c49fc58 100644 (file)
  */
 
 // CLASS HEADER
-#include <dali/internal/event/common/property-buffer-impl.h>  // Dali::Internal::PropertyBuffer
-
-// EXTERNAL INCLUDE
-#include <algorithm> // std::sort
+#include <dali/internal/event/common/property-buffer-impl.h>
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/object/property-buffer.h> // Dali::Internal::PropertyBuffer
+#include <dali/devel-api/object/property-buffer.h>
 #include <dali/internal/event/common/stage-impl.h>
 #include <dali/internal/update/manager/update-manager.h>
 
@@ -124,49 +121,38 @@ unsigned int GetPropertyImplementationAlignment( Property::Type& propertyType )
 
 } // unnamed namespace
 
-PropertyBufferPtr PropertyBuffer::New()
+PropertyBufferPtr PropertyBuffer::New( Dali::Property::Map& format )
 {
+  DALI_ASSERT_ALWAYS( format.Count() && "Format cannot be empty." );
+
   PropertyBufferPtr propertyBuffer( new PropertyBuffer() );
-  propertyBuffer->Initialize();
+  propertyBuffer->Initialize( format );
 
   return propertyBuffer;
 }
 
-void PropertyBuffer::SetSize( std::size_t size )
-{
-  mSize = size;
-
-  SizeChanged();
-
-  SceneGraph::SetPropertyBufferSize(mEventThreadServices.GetUpdateManager(),*mRenderObject, mSize );
-}
-
-std::size_t PropertyBuffer::GetSize() const
-{
-  return mSize;
-}
-
-void PropertyBuffer::SetData( const void* data )
+void PropertyBuffer::SetData( const void* data, std::size_t size )
 {
   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." );
+  mSize = size;
+
+  // Check if format and size have been set yet
+  if( mBufferFormat != NULL )
+  {
+    unsigned int bufferSize = mBufferFormat->size * mSize;
+    mBuffer.Resize( bufferSize );
+  }
 
   const char* source = static_cast<const char*>( data );
   std::copy( source, source + mBuffer.Size(), &mBuffer[0] );
 
-  SceneGraph::SetPropertyBufferData(mEventThreadServices.GetUpdateManager(),*mRenderObject,new Dali::Vector<char>( mBuffer ));
+  SceneGraph::SetPropertyBufferData( mEventThreadServices.GetUpdateManager(), *mRenderObject, new Dali::Vector<char>( mBuffer ), mSize );
 }
 
-void PropertyBuffer::SetFormat( Dali::Property::Map& format )
+std::size_t PropertyBuffer::GetSize() const
 {
-  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();
+  return mSize;
 }
 
 const Render::PropertyBuffer* PropertyBuffer::GetRenderObject() const
@@ -183,21 +169,20 @@ PropertyBuffer::~PropertyBuffer()
 }
 
 PropertyBuffer::PropertyBuffer()
-:mEventThreadServices( *Stage::GetCurrent() )
-,mRenderObject(NULL)
-,mBufferFormat( NULL )
-,mSize( 0 )
+: mEventThreadServices( *Stage::GetCurrent() ),
+  mRenderObject( NULL ),
+  mBufferFormat( NULL ),
+  mSize( 0 )
 {
 }
 
-void PropertyBuffer::Initialize()
+void PropertyBuffer::Initialize( Dali::Property::Map& formatMap )
 {
   mRenderObject = new Render::PropertyBuffer();
   SceneGraph::AddPropertyBuffer(mEventThreadServices.GetUpdateManager(), *mRenderObject );
-}
 
-void PropertyBuffer::FormatChanged()
-{
+  mFormat = formatMap;
+
   size_t numComponents = mFormat.Count();
 
   // Create the format
@@ -261,20 +246,6 @@ void PropertyBuffer::FormatChanged()
   mBufferFormat = format;
 
   SceneGraph::SetPropertyBufferFormat(mEventThreadServices.GetUpdateManager(), *mRenderObject, format );
-  if( mSize )
-  {
-    SizeChanged();
-  }
-}
-
-void PropertyBuffer::SizeChanged()
-{
-  // Check if format and size have been set yet
-  if( mBufferFormat != NULL )
-  {
-    unsigned int bufferSize = mBufferFormat->size * mSize;
-    mBuffer.Resize( bufferSize );
-  }
 }
 
 unsigned int GetPropertyImplementationSize( Property::Type& propertyType )
index 9148856..b046ebb 100644 (file)
@@ -46,32 +46,18 @@ public:
   /**
    * @copydoc PropertBuffer::New()
    */
-  static PropertyBufferPtr New();
+  static PropertyBufferPtr New( Dali::Property::Map& format );
 
   /**
-   * @copydoc PropertBuffer::SetSize()
+   * @copydoc PropertBuffer::SetData()
    */
-  void SetSize( std::size_t size );
+  void SetData( const void* data, std::size_t size );
 
   /**
    * @copydoc PropertBuffer::GetSize()
    */
   std::size_t GetSize() const;
 
-  /**
-   * @copydoc PropertBuffer::SetData()
-   */
-  void SetData( const void* data );
-
-  /**
-   * @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
 
   /**
@@ -96,17 +82,7 @@ private: // implementation
   /**
    * Second stage initialization
    */
-  void Initialize();
-
-  /**
-   * Update the buffer when the format changes
-   */
-  void FormatChanged();
-
-  /**
-   * Update the buffer when the size changes
-   */
-  void SizeChanged();
+  void Initialize( Dali::Property::Map& format );
 
 private: // unimplemented methods
   PropertyBuffer( const PropertyBuffer& );
index 5a37c02..23868a2 100644 (file)
@@ -329,14 +329,9 @@ void RenderManager::SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuff
   propertyBuffer->SetFormat( format );
 }
 
-void RenderManager::SetPropertyBufferData(Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data)
+void RenderManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size )
 {
-  propertyBuffer->SetData( data );
-}
-
-void RenderManager::SetPropertyBufferSize(Render::PropertyBuffer* propertyBuffer, size_t size )
-{
-  propertyBuffer->SetSize( size );
+  propertyBuffer->SetData( data, size );
 }
 
 void RenderManager::AddGeometry( RenderGeometry* renderGeometry )
index 2b56a42..a3bb7f5 100644 (file)
@@ -238,21 +238,15 @@ public:
    * @param[in] propertyBuffer The property buffer.
    * @param[in] format The new format of the buffer
    */
-  void SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format );
+  void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format );
 
   /**
    * Sets the data of an existing property buffer
    * @param[in] propertyBuffer The property buffer.
    * @param[in] data The new data of the buffer
-   */
-  void SetPropertyBufferData(Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data);
-
-  /**
-   * Sets the size of an existing property buffer
-   * @param[in] propertyBuffer The property buffer.
    * @param[in] size The new size of the buffer
    */
-  void SetPropertyBufferSize(Render::PropertyBuffer* propertyBuffer, size_t size );
+  void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size );
 
   /**
    * Set the geometry type of an existing render geometry
index 0ce34f5..eb17d9e 100644 (file)
@@ -118,19 +118,13 @@ void PropertyBuffer::SetFormat( PropertyBuffer::Format* format )
   mDataChanged = true;
 }
 
-void PropertyBuffer::SetData( Dali::Vector<char>* data )
+void PropertyBuffer::SetData( Dali::Vector<char>* data, size_t size )
 {
   mData = data;
-  mDataChanged = true;
-}
-
-void PropertyBuffer::SetSize( unsigned int size )
-{
   mSize = size;
   mDataChanged = true;
 }
 
-
 bool PropertyBuffer::Update( Context& context, bool isIndexBuffer )
 {
   if( !mData || !mFormat || !mSize )
index ce2fef9..5cc92f4 100644 (file)
@@ -74,8 +74,9 @@ public:
    *
    * This function takes ownership of the pointer
    * @param[in] data The new data of the PropertyBuffer
+   * @param[in] size The new size of the buffer
    */
-  void SetData( Dali::Vector<char>* data );
+  void SetData( Dali::Vector<char>* data, size_t size );
 
   /**
    * @brief Set the number of elements
index 3d4fd3f..88667d2 100644 (file)
@@ -1207,26 +1207,15 @@ void UpdateManager::SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuff
   new (slot) DerivedType( &mImpl->renderManager,  &RenderManager::SetPropertyBufferFormat, propertyBuffer, format );
 }
 
-void UpdateManager::SetPropertyBufferData(Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data)
+void UpdateManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size )
 {
-  typedef MessageValue2< RenderManager, Render::PropertyBuffer*, Dali::Vector<char>* > DerivedType;
+  typedef MessageValue3< RenderManager, Render::PropertyBuffer*, Dali::Vector<char>*, size_t > DerivedType;
 
   // Reserve some memory inside the render queue
   unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
 
   // Construct message in the render queue memory; note that delete should not be called on the return value
-  new (slot) DerivedType( &mImpl->renderManager,  &RenderManager::SetPropertyBufferData, propertyBuffer, data );
-}
-
-void UpdateManager::SetPropertyBufferSize(Render::PropertyBuffer* propertyBuffer, size_t size )
-{
-  typedef MessageValue2< RenderManager, Render::PropertyBuffer*, size_t > DerivedType;
-
-  // Reserve some memory inside the render queue
-  unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
-  // Construct message in the render queue memory; note that delete should not be called on the return value
-  new (slot) DerivedType( &mImpl->renderManager,  &RenderManager::SetPropertyBufferSize, propertyBuffer, size );
+  new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetPropertyBufferData, propertyBuffer, data, size );
 }
 
 } // namespace SceneGraph
index 1cad203..d508104 100644 (file)
@@ -415,17 +415,10 @@ public:
    * Sets the data of an existing property buffer
    * @param[in] propertyBuffer The property buffer.
    * @param[in] data The new data of the buffer
-   * @post Sends a message to RenderManager to set the new data to the property buffer.
-   */
-  void SetPropertyBufferData(Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data);
-
-  /**
-   * Sets the size of an existing property buffer
-   * @param[in] propertyBuffer The property buffer.
    * @param[in] size The new size of the buffer
-   * @post Sends a message to RenderManager to set the new size to the property buffer.
+   * @post Sends a message to RenderManager to set the new data to the property buffer.
    */
-  void SetPropertyBufferSize(Render::PropertyBuffer* propertyBuffer, size_t size );
+  void SetPropertyBufferData(Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size);
 
 public:
 
@@ -965,29 +958,17 @@ inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuf
   new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format );
 }
 
-inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Vector<char>* data )
+inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Vector<char>* data, size_t size )
 {
-  typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, Vector<char>*  > LocalType;
+  typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, Vector<char>*, size_t  > LocalType;
 
   // Reserve some memory inside the message queue
   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data );
+  new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size );
 }
 
-inline void SetPropertyBufferSize( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, size_t size )
-{
-  typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, size_t  > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferSize, &propertyBuffer, size );
-}
-
-
 } // namespace SceneGraph
 
 } // namespace Internal