PropertyBuffer SetData clean-up 24/63024/3
authorPaul Wisbey <p.wisbey@samsung.com>
Mon, 21 Mar 2016 17:06:40 +0000 (17:06 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 21 Mar 2016 18:49:11 +0000 (18:49 +0000)
Change-Id: Ie99400f090ee5516f8fcb90e8fea307fe41bbf48

16 files changed:
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
dali-toolkit/internal/controls/model3d-view/obj-loader.cpp
dali-toolkit/internal/controls/renderers/border/border-renderer.cpp
dali-toolkit/internal/controls/renderers/debug/debug-renderer.cpp
dali-toolkit/internal/controls/renderers/image/image-renderer.cpp
dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.cpp
dali-toolkit/internal/controls/renderers/renderer-factory-cache.cpp
dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp
node-addon/examples/line-mesh.js
node-addon/examples/mesh-morph.js
node-addon/examples/point-mesh.js
node-addon/examples/texture-mesh.js
plugins/dali-script-v8/src/object/property-buffer-api.cpp

index 26f6798033a923e251de61f61f7609beebc4cb4d..1f5b966782c4b965abe5f82da0934ecf83ba4401 100644 (file)
@@ -307,13 +307,13 @@ Geometry BubbleEmitter::CreateGeometry( unsigned int numOfPatch )
   vertexFormat["aIndex"] = Property::FLOAT;
   vertexFormat["aPosition"] = Property::VECTOR2;
   vertexFormat["aTexCoord"] = Property::VECTOR2;
-  PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, numVertex  );
-  vertices.SetData( &vertexData[0] );
+  PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
+  vertices.SetData( &vertexData[0], numVertex );
 
   Property::Map indexFormat;
   indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat, numIndex  );
-  indices.SetData( &indexData[0] );
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+  indices.SetData( &indexData[0], numIndex );
 
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertices );
index 396ac483d69e015174157232c0604202c8789e8f..5e67b1ed143cd7691ceb2967a6846b4bdcd1425d 100644 (file)
@@ -499,8 +499,8 @@ Geometry ObjLoader::CreateGeometry(Toolkit::Model3dView::IlluminationType illumi
   Property::Map vertexFormat;
   vertexFormat["aPosition"] = Property::VECTOR3;
   vertexFormat["aNormal"] = Property::VECTOR3;
-  PropertyBuffer surfaceVertices = PropertyBuffer::New( vertexFormat, vertices.Size() );
-  surfaceVertices.SetData( &vertices[0] );
+  PropertyBuffer surfaceVertices = PropertyBuffer::New( vertexFormat );
+  surfaceVertices.SetData( &vertices[0], vertices.Size() );
 
   Geometry surface = Geometry::New();
   surface.AddVertexBuffer( surfaceVertices );
@@ -510,8 +510,8 @@ Geometry ObjLoader::CreateGeometry(Toolkit::Model3dView::IlluminationType illumi
   {
     Property::Map textureFormat;
     textureFormat["aTexCoord"] = Property::VECTOR2;
-    PropertyBuffer extraVertices = PropertyBuffer::New( textureFormat, textures.Size() );
-    extraVertices.SetData( &textures[0] );
+    PropertyBuffer extraVertices = PropertyBuffer::New( textureFormat );
+    extraVertices.SetData( &textures[0], textures.Size() );
 
     surface.AddVertexBuffer( extraVertices );
   }
@@ -522,8 +522,8 @@ Geometry ObjLoader::CreateGeometry(Toolkit::Model3dView::IlluminationType illumi
     Property::Map vertexExtFormat;
     vertexExtFormat["aTangent"] = Property::VECTOR3;
     vertexExtFormat["aBiNormal"] = Property::VECTOR3;
-    PropertyBuffer extraVertices = PropertyBuffer::New( vertexExtFormat, verticesExt.Size() );
-    extraVertices.SetData( &verticesExt[0] );
+    PropertyBuffer extraVertices = PropertyBuffer::New( vertexExtFormat );
+    extraVertices.SetData( &verticesExt[0], verticesExt.Size() );
 
     surface.AddVertexBuffer( extraVertices );
   }
@@ -533,8 +533,8 @@ Geometry ObjLoader::CreateGeometry(Toolkit::Model3dView::IlluminationType illumi
     //Indices
     Property::Map indicesVertexFormat;
     indicesVertexFormat["aIndices"] = Property::INTEGER;
-    PropertyBuffer indicesToVertices = PropertyBuffer::New( indicesVertexFormat, indices.Size() );
-    indicesToVertices.SetData(&indices[0]);
+    PropertyBuffer indicesToVertices = PropertyBuffer::New( indicesVertexFormat );
+    indicesToVertices.SetData( &indices[0], indices.Size() );
 
     surface.SetIndexBuffer ( indicesToVertices );
   }
index 116d6c77f9d69e9dee41f53da12476dfdc10679f..6432ae0a9ae0e03972b83574c51283806bf9cd40 100644 (file)
@@ -292,15 +292,15 @@ Geometry BorderRenderer::CreateBorderGeometry()
   Property::Map borderVertexFormat;
   borderVertexFormat[POSITION_ATTRIBUTE_NAME] = Property::VECTOR2;
   borderVertexFormat[DRIFT_ATTRIBUTE_NAME] = Property::VECTOR2;
-  PropertyBuffer borderVertices = PropertyBuffer::New( borderVertexFormat, 16 );
-  borderVertices.SetData(borderVertexData);
+  PropertyBuffer borderVertices = PropertyBuffer::New( borderVertexFormat );
+  borderVertices.SetData( borderVertexData, 16 );
 
   // Create indices
   unsigned int indexData[24] = { 1,5,2,6,3,7,7,6,11,10,15,14,14,10,13,9,12,8,8,9,4,5,0,1};
   Property::Map indexFormat;
   indexFormat[INDEX_NAME] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat, 24 );
-  indices.SetData(indexData);
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+  indices.SetData( indexData, 24 );
 
   // Create the geometry object
   Geometry geometry = Geometry::New();
index d8640981378b318a2ec847fd7639f2c2ebf3900b..7ab33c7612f0f3fb777623bd52d6e49f096c95a1 100644 (file)
@@ -114,15 +114,15 @@ Geometry DebugRenderer::CreateQuadWireframeGeometry()
 
   Property::Map quadVertexFormat;
   quadVertexFormat[POSITION_ATTRIBUTE_NAME] = Property::VECTOR2;
-  PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat, 4 );
-  quadVertices.SetData(quadVertexData);
+  PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+  quadVertices.SetData( quadVertexData, 4 );
 
   // Create indices
   unsigned int indexData[10] = { 0, 1, 1, 2, 2, 3, 3, 0 };
   Property::Map indexFormat;
   indexFormat[INDEX_NAME] = 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 geometry = Geometry::New();
index 32f90c21d8903e7fc4e8160a52f622881fbbc9e1..10a6bc679ea55d3db1e97b24c448185c881752b4 100644 (file)
@@ -114,18 +114,18 @@ Geometry GenerateGeometry( const Vector< Vector2 >& vertices, const Vector< unsi
 {
   Property::Map vertexFormat;
   vertexFormat[ "aPosition" ] = Property::VECTOR2;
-  PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat, vertices.Size() );
+  PropertyBuffer 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;
-  PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat, indices.Size() );
+  PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat );
   if( indices.Size() > 0 )
   {
-    indexPropertyBuffer.SetData( &indices[ 0 ] );
+    indexPropertyBuffer.SetData( &indices[ 0 ], indices.Size() );
   }
 
   // Create the geometry object
index e423ad2b33a478297b6c0d04eee001dde87bdd53..4f7fe40968d848a75552b2de5499bb452ca649e9 100644 (file)
@@ -127,18 +127,18 @@ Geometry GenerateGeometry( const Vector< Vector2 >& vertices, const Vector< unsi
 {
   Property::Map vertexFormat;
   vertexFormat[ "aPosition" ] = Property::VECTOR2;
-  PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat, vertices.Size() );
+  PropertyBuffer 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;
-  PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat, indices.Size() );
+  PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat );
   if( indices.Size() > 0 )
   {
-    indexPropertyBuffer.SetData( &indices[ 0 ] );
+    indexPropertyBuffer.SetData( &indices[ 0 ], indices.Size() );
   }
 
   // Create the geometry object
index 47fd771484dffa5e450b794c7ada94a3dc767a1e..0c1b3e1685eacf0cb6d88eec69e8e6043d86d9ee 100644 (file)
@@ -165,8 +165,8 @@ Geometry RendererFactoryCache::CreateQuadGeometry()
 
   Property::Map quadVertexFormat;
   quadVertexFormat["aPosition"] = Property::VECTOR2;
-  PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat, 4 );
-  quadVertices.SetData(quadVertexData);
+  PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+  quadVertices.SetData( quadVertexData, 4 );
 
   // Create the geometry object
   Geometry geometry = Geometry::New();
index 9969f779d6f4f47ea8e2d59e456e7fda6e8f73f0..2218ddcf070210eb73687029ce4bddd9599a7e37 100644 (file)
@@ -114,14 +114,14 @@ Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
   Property::Map vertexFormat;
   vertexFormat["aPosition1"] = Property::VECTOR3;
   vertexFormat["aPosition2"] = Property::VECTOR3;
-  PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 20u );
-  vertices.SetData( vertexData );
+  PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
+  vertices.SetData( vertexData, 20u );
 
   unsigned int indexData[30] = { 0,3,1,0,2,3,4,7,5,4,6,7,8,11,9,8,10,11,12,15,13,12,14,15,16,19,17,16,18,19};
   Property::Map indexFormat;
   indexFormat["indices"] = Property::INTEGER;
-  PropertyBuffer indices = PropertyBuffer::New( indexFormat, 30u );
-  indices.SetData( indexData );
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+  indices.SetData( indexData, 30u );
 
   Geometry meshGeometry = Geometry::New();
   meshGeometry.AddVertexBuffer( vertices );
index 7f032d7bb7c4d9f8b821758f91a036b6c2cd36d7..1791a8d452c71b0ed4c0d7650ea8361036c31fe5 100644 (file)
@@ -1048,26 +1048,18 @@ struct Decorator::Impl : public ConnectionTracker
           indices.PushBack( v + 3 );
         }
 
-        if( mQuadVertices )
+        if( mQuadVertices )
         {
-          mQuadVertices.SetSize( vertices.Size() );
-        }
-        else
-        {
-          mQuadVertices = PropertyBuffer::New( mQuadVertexFormat, vertices.Size() );
+          mQuadVertices = PropertyBuffer::New( mQuadVertexFormat );
         }
 
-        if( mQuadIndices )
-        {
-          mQuadIndices.SetSize( indices.Size() );
-        }
-        else
+        if( ! mQuadIndices )
         {
-          mQuadIndices = PropertyBuffer::New( mQuadIndexFormat, indices.Size() );
+          mQuadIndices = PropertyBuffer::New( mQuadIndexFormat );
         }
 
-        mQuadVertices.SetData( &vertices[ 0 ] );
-        mQuadIndices.SetData( &indices[ 0 ] );
+        mQuadVertices.SetData( &vertices[ 0 ], vertices.Size() );
+        mQuadIndices.SetData( &indices[ 0 ], indices.Size() );
 
         if( !mQuadGeometry )
         {
index 7b82d21ffc1f210288b23456ad7f71a2b9529235..f4692dc5a4dd07bf213f33991838bf1d7250f4ed 100644 (file)
@@ -480,10 +480,10 @@ struct AtlasRenderer::Impl
 
   Actor CreateMeshActor( const MeshRecord& meshRecord, const Vector2& actorSize )
   {
-    PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, meshRecord.mMesh.mVertices.Size() );
-    PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, meshRecord.mMesh.mIndices.Size() );
-    quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ) );
-    quadIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ) );
+    PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat );
+    PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat );
+    quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ), meshRecord.mMesh.mVertices.Size() );
+    quadIndices.SetData(  const_cast< unsigned int* >(           &meshRecord.mMesh.mIndices[ 0 ] ),  meshRecord.mMesh.mIndices.Size() );
 
     Geometry quadGeometry = Geometry::New();
     quadGeometry.AddVertexBuffer( quadVertices );
index bcd4b075a7107ec20a9f3a5d39076fc9bddb99a7..b8ecd96d7736ba0cd6b88d3b53ca3d75d79d62b4 100644 (file)
@@ -100,8 +100,8 @@ Geometry CreateQuadGeometry()
 
   Property::Map quadVertexFormat;
   quadVertexFormat["aPosition"] = Property::VECTOR2;
-  PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat, 4 );
-  quadVertices.SetData(quadVertexData);
+  PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+  quadVertices.SetData( quadVertexData, 4 );
 
   // Create the geometry object
   Geometry geometry = Geometry::New();
index a7c0cc1de30f37ead9d1a4a50eb27f6b4b2294fe..b68df19cf8a755ad54c01e1fbecc562a88f84686 100644 (file)
@@ -71,8 +71,8 @@ daliApp.createMeshActor = function() {
 
       var pentagonVertexDataArray = new Float32Array(pentagonVertexData.length);
       pentagonVertexDataArray.set(pentagonVertexData, 0);
-      var pentagonVertices = new dali.PropertyBuffer(pentagonVertexFormat, 5);
-      pentagonVertices.setData(pentagonVertexDataArray);
+      var pentagonVertices = new dali.PropertyBuffer(pentagonVertexFormat);
+      pentagonVertices.setData(pentagonVertexDataArray, 5);
 
       var pentacleVertexFormat ={ "aPosition2" : dali.PROPERTY_VECTOR2};
 
@@ -84,8 +84,8 @@ daliApp.createMeshActor = function() {
 
       var pentacleVertexDataArray = new Float32Array(pentacleVertexData.length);
       pentacleVertexDataArray.set(pentacleVertexData, 0);
-      var pentacleVertices = new dali.PropertyBuffer(pentacleVertexFormat, 5);
-      pentacleVertices.setData(pentacleVertexDataArray);
+      var pentacleVertices = new dali.PropertyBuffer(pentacleVertexFormat);
+      pentacleVertices.setData(pentacleVertexDataArray, 5);
 
       var indexFormat ={ "indices" : dali.PROPERTY_INTEGER };
 
@@ -93,8 +93,8 @@ daliApp.createMeshActor = function() {
 
       var indexDataArray = new Uint32Array(indexData.length);
       indexDataArray.set(indexData, 0);
-      var indices = new dali.PropertyBuffer(indexFormat, 10);
-      indices.setData(indexDataArray);
+      var indices = new dali.PropertyBuffer(indexFormat);
+      indices.setData(indexDataArray, 10);
 
       // Create geometry
       var geometry = new dali.Geometry();
index 7570405bdad3a55ca78fc1cc47b2a0b1308db84e..7d6bc49771f6875ff6a60bd096ef6a1a2d6eb3f3 100644 (file)
@@ -110,8 +110,8 @@ daliApp.createMeshActor = function() {
 
       var initialPositionVertexDataArray = new Float32Array(initialPositionVertexData.length);
       initialPositionVertexDataArray.set(initialPositionVertexData, 0);
-      var initialPositionVertices = new dali.PropertyBuffer(initialPositionVertexFormat, 27);
-      initialPositionVertices.setData(initialPositionVertexDataArray);
+      var initialPositionVertices = new dali.PropertyBuffer(initialPositionVertexFormat);
+      initialPositionVertices.setData(initialPositionVertexDataArray, 27);
 
       // Create vertex buffer for final positions
       var finalPositionVertexFormat = { "aFinalPos" : dali.PROPERTY_VECTOR2 };
@@ -164,8 +164,8 @@ daliApp.createMeshActor = function() {
 
       var finalPositionVertexDataArray = new Float32Array(finalPositionVertexData.length);
       finalPositionVertexDataArray.set(finalPositionVertexData, 0);
-      var finalPositionVertices = new dali.PropertyBuffer(finalPositionVertexFormat, 27);
-      finalPositionVertices.setData(finalPositionVertexDataArray);
+      var finalPositionVertices = new dali.PropertyBuffer(finalPositionVertexFormat);
+      finalPositionVertices.setData(finalPositionVertexDataArray, 27);
 
       // Create vertex buffer for color
       var colorVertexFormat = { "aColor" : dali.PROPERTY_VECTOR3 };
@@ -215,8 +215,8 @@ daliApp.createMeshActor = function() {
 
       var colorVertexDataArray = new Float32Array(colorVertexData.length);
       colorVertexDataArray.set(colorVertexData, 0);
-      var colorVertices = new dali.PropertyBuffer(colorVertexFormat, 27);
-      colorVertices.setData(colorVertexDataArray);
+      var colorVertices = new dali.PropertyBuffer(colorVertexFormat);
+      colorVertices.setData(colorVertexDataArray, 27);
 
       // Create geometry
       var geometry = new dali.Geometry();
index ee9cebe0292aa1099cc2699f19d318d6ecf3d27b..eb1c83042bf47534a1e9833e6e87083413062e15 100644 (file)
@@ -107,8 +107,8 @@ daliApp.createMeshActor = function() {
 
       var polyhedraVertexDataArray = new Float32Array(polyhedraVertexData.length);
       polyhedraVertexDataArray.set(polyhedraVertexData, 0);
-      var polyhedraVertices = new dali.PropertyBuffer(polyhedraVertexFormat, numSides);
-      polyhedraVertices.setData(polyhedraVertexDataArray);
+      var polyhedraVertices = new dali.PropertyBuffer(polyhedraVertexFormat);
+      polyhedraVertices.setData(polyhedraVertexDataArray, numSides);
 
       // Create geometry
       var geometry = new dali.Geometry();
index add7f032e8411f2a750289ac37ce6ba5ad6fb571..bacde6b4c8d4c674b6932724e071364096e06aca 100644 (file)
@@ -84,8 +84,8 @@ daliApp.createMeshActor = function() {
 
       var texturedQuadVertexDataArray = new Float32Array(texturedQuadVertexData.length);
       texturedQuadVertexDataArray.set(texturedQuadVertexData, 0);
-      var texturedQuadVertices = new dali.PropertyBuffer(texturedQuadVertexFormat, 4);
-      texturedQuadVertices.setData(texturedQuadVertexDataArray);
+      var texturedQuadVertices = new dali.PropertyBuffer(texturedQuadVertexFormat);
+      texturedQuadVertices.setData(texturedQuadVertexDataArray, 4);
 
       var indexFormat ={ "indices" : dali.PROPERTY_INTEGER };
 
@@ -93,8 +93,8 @@ daliApp.createMeshActor = function() {
 
       var indexDataArray = new Uint32Array(indexData.length);
       indexDataArray.set(indexData, 0);
-      var indices = new dali.PropertyBuffer(indexFormat, 6);
-      indices.setData(indexDataArray);
+      var indices = new dali.PropertyBuffer(indexFormat);
+      indices.setData(indexDataArray, 6);
 
       // Create geometry
       var geometry = new dali.Geometry();
index cde2ed1c3ec42bf1b54cbd894856760c848fd092..46de3b3bd48829b46e0ab64a44a737701edb0e0f 100644 (file)
@@ -34,18 +34,15 @@ namespace // unnamed namespace
 struct PropertyBufferParameters
 {
   PropertyBufferParameters()
-      : mSize( 0 )
   {
   }
 
   PropertyBuffer NewPropertyBuffer()
   {
-    return PropertyBuffer::New( mBufferFormat,
-                                mSize);
+    return PropertyBuffer::New( mBufferFormat );
   }
 
   Property::Map mBufferFormat;
-  std::size_t mSize;
 };
 
 } // unnamed space
@@ -145,15 +142,7 @@ PropertyBuffer PropertyBufferApi::New( v8::Isolate* isolate, const v8::FunctionC
     return PropertyBuffer();
   }
 
-  found = false;
-  int size = V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0);
-  if( !found )
-  {
-    DALI_SCRIPT_EXCEPTION( isolate, "missing buffer size from param 1" );
-    return PropertyBuffer();
-  }
-
-  return PropertyBuffer::New(bufferFormat, static_cast<std::size_t>(size));
+  return PropertyBuffer::New( bufferFormat );
 }
 
 /**
@@ -177,7 +166,7 @@ PropertyBuffer PropertyBufferApi::New( v8::Isolate* isolate, const v8::FunctionC
  *   var vertexDataArray = new Float32Array(vertexData.length);
  *   vertexDataArray.set(vertexData, 0);
  *
- *   propertyBuffer.setData( vertexDataArray );
+ *   propertyBuffer.setData( vertexDataArray, vertexData.length );
  *```
  */
 void PropertyBufferApi::SetData( const v8::FunctionCallbackInfo< v8::Value >& args )
@@ -189,13 +178,22 @@ void PropertyBufferApi::SetData( const v8::FunctionCallbackInfo< v8::Value >& ar
 
   bool found( false );
   void* data = V8Utils::GetArrayBufferViewParameter( PARAMETER_0, found, isolate, args);
-  if( !found )
+
+  if( ! found )
   {
     DALI_SCRIPT_EXCEPTION( isolate, "invalid data parameter" );
   }
   else
   {
-    buffer.SetData( data );
+    int size = V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0);
+    if( !found )
+    {
+      DALI_SCRIPT_EXCEPTION( isolate, "missing buffer size from param 1" );
+    }
+    else
+    {
+      buffer.SetData( data, size );
+    }
   }
 }