From 6c6cdc0f1c2e6373e4eb3bf74397abba5befe026 Mon Sep 17 00:00:00 2001
From: Paul Wisbey
Date: Mon, 21 Mar 2016 17:06:40 +0000
Subject: [PATCH] PropertyBuffer SetData clean-up
Change-Id: Ie99400f090ee5516f8fcb90e8fea307fe41bbf48
---
.../controls/bubble-effect/bubble-emitter-impl.cpp | 8 +++---
.../internal/controls/model3d-view/obj-loader.cpp | 16 ++++++------
.../controls/renderers/border/border-renderer.cpp | 8 +++---
.../controls/renderers/debug/debug-renderer.cpp | 8 +++---
.../controls/renderers/image/image-renderer.cpp | 8 +++---
.../controls/renderers/npatch/npatch-renderer.cpp | 8 +++---
.../controls/renderers/renderer-factory-cache.cpp | 4 +--
.../controls/scrollable/bouncing-effect-actor.cpp | 8 +++---
.../internal/text/decorator/text-decorator.cpp | 20 +++++----------
.../text/rendering/atlas/text-atlas-renderer.cpp | 8 +++---
.../cube-transition-effect-impl.cpp | 4 +--
node-addon/examples/line-mesh.js | 12 ++++-----
node-addon/examples/mesh-morph.js | 12 ++++-----
node-addon/examples/point-mesh.js | 4 +--
node-addon/examples/texture-mesh.js | 8 +++---
.../src/object/property-buffer-api.cpp | 30 ++++++++++------------
16 files changed, 78 insertions(+), 88 deletions(-)
diff --git a/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp b/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
index 26f6798..1f5b966 100644
--- a/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
+++ b/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
@@ -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 );
diff --git a/dali-toolkit/internal/controls/model3d-view/obj-loader.cpp b/dali-toolkit/internal/controls/model3d-view/obj-loader.cpp
index 396ac48..5e67b1e 100644
--- a/dali-toolkit/internal/controls/model3d-view/obj-loader.cpp
+++ b/dali-toolkit/internal/controls/model3d-view/obj-loader.cpp
@@ -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 );
}
diff --git a/dali-toolkit/internal/controls/renderers/border/border-renderer.cpp b/dali-toolkit/internal/controls/renderers/border/border-renderer.cpp
index 116d6c7..6432ae0 100644
--- a/dali-toolkit/internal/controls/renderers/border/border-renderer.cpp
+++ b/dali-toolkit/internal/controls/renderers/border/border-renderer.cpp
@@ -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();
diff --git a/dali-toolkit/internal/controls/renderers/debug/debug-renderer.cpp b/dali-toolkit/internal/controls/renderers/debug/debug-renderer.cpp
index d864098..7ab33c7 100644
--- a/dali-toolkit/internal/controls/renderers/debug/debug-renderer.cpp
+++ b/dali-toolkit/internal/controls/renderers/debug/debug-renderer.cpp
@@ -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();
diff --git a/dali-toolkit/internal/controls/renderers/image/image-renderer.cpp b/dali-toolkit/internal/controls/renderers/image/image-renderer.cpp
index 32f90c2..10a6bc6 100644
--- a/dali-toolkit/internal/controls/renderers/image/image-renderer.cpp
+++ b/dali-toolkit/internal/controls/renderers/image/image-renderer.cpp
@@ -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
diff --git a/dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.cpp b/dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.cpp
index e423ad2..4f7fe40 100644
--- a/dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.cpp
+++ b/dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.cpp
@@ -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
diff --git a/dali-toolkit/internal/controls/renderers/renderer-factory-cache.cpp b/dali-toolkit/internal/controls/renderers/renderer-factory-cache.cpp
index 47fd771..0c1b3e1 100644
--- a/dali-toolkit/internal/controls/renderers/renderer-factory-cache.cpp
+++ b/dali-toolkit/internal/controls/renderers/renderer-factory-cache.cpp
@@ -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();
diff --git a/dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp b/dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
index 9969f77..2218ddc 100644
--- a/dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
+++ b/dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
@@ -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 );
diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp
index 7f032d7..1791a8d 100644
--- a/dali-toolkit/internal/text/decorator/text-decorator.cpp
+++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp
@@ -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 )
{
diff --git a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
index 7b82d21..f4692dc 100644
--- a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
+++ b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
@@ -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 );
diff --git a/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp
index bcd4b07..b8ecd96 100644
--- a/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp
+++ b/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp
@@ -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();
diff --git a/node-addon/examples/line-mesh.js b/node-addon/examples/line-mesh.js
index a7c0cc1..b68df19 100644
--- a/node-addon/examples/line-mesh.js
+++ b/node-addon/examples/line-mesh.js
@@ -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();
diff --git a/node-addon/examples/mesh-morph.js b/node-addon/examples/mesh-morph.js
index 7570405..7d6bc49 100644
--- a/node-addon/examples/mesh-morph.js
+++ b/node-addon/examples/mesh-morph.js
@@ -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();
diff --git a/node-addon/examples/point-mesh.js b/node-addon/examples/point-mesh.js
index ee9cebe..eb1c830 100644
--- a/node-addon/examples/point-mesh.js
+++ b/node-addon/examples/point-mesh.js
@@ -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();
diff --git a/node-addon/examples/texture-mesh.js b/node-addon/examples/texture-mesh.js
index add7f03..bacde6b 100644
--- a/node-addon/examples/texture-mesh.js
+++ b/node-addon/examples/texture-mesh.js
@@ -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();
diff --git a/plugins/dali-script-v8/src/object/property-buffer-api.cpp b/plugins/dali-script-v8/src/object/property-buffer-api.cpp
index cde2ed1..46de3b3 100644
--- a/plugins/dali-script-v8/src/object/property-buffer-api.cpp
+++ b/plugins/dali-script-v8/src/object/property-buffer-api.cpp
@@ -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(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 );
+ }
}
}
--
2.7.4