DALi Version 1.4.26
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / src / rendering / geometry-api.cpp
index e9c35a9..7011c20 100644 (file)
@@ -214,14 +214,21 @@ void GeometryApi::SetIndexBuffer( const v8::FunctionCallbackInfo<v8::Value>& arg
   }
   else
   {
-    int size = V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0);
+    unsigned int size = V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0);
     if( !found )
     {
       DALI_SCRIPT_EXCEPTION( isolate, "missing buffer size from param 1" );
     }
     else
     {
-      geometry.SetIndexBuffer( static_cast<const unsigned short*>(data), size );
+      Dali::Vector<unsigned short> indices;
+      indices.Resize( size );
+      unsigned int* indexData = static_cast<unsigned int*>(data);
+      for( size_t i(0); i<size; ++i )
+      {
+        indices[i] = indexData[i];
+      }
+      geometry.SetIndexBuffer( &indices[0], size );
     }
   }
 }
@@ -229,7 +236,7 @@ void GeometryApi::SetIndexBuffer( const v8::FunctionCallbackInfo<v8::Value>& arg
 /**
  * Set the type of primitives this geometry contains
  *
- * @method setGeometryType
+ * @method setType
  * @for Geometry
  * @param {integer} geometryType Type of primitives this geometry contains
  * @example
@@ -242,9 +249,9 @@ void GeometryApi::SetIndexBuffer( const v8::FunctionCallbackInfo<v8::Value>& arg
  *      dali.GEOMETRY_TRIANGLE_FAN
  *      dali.GEOMETRY_TRIANGLE_STRIP
  *
- *      geometry.SetGeometryType( dali.GEOMETRY_LINES );
+ *      geometry.SetType( dali.GEOMETRY_LINES );
  */
-void GeometryApi::SetGeometryType( const v8::FunctionCallbackInfo< v8::Value >& args )
+void GeometryApi::SetType( const v8::FunctionCallbackInfo< v8::Value >& args )
 {
   v8::Isolate* isolate = args.GetIsolate();
   v8::HandleScope handleScope( isolate );
@@ -259,14 +266,14 @@ void GeometryApi::SetGeometryType( const v8::FunctionCallbackInfo< v8::Value >&
   }
   else
   {
-    geometry.SetGeometryType(static_cast<Geometry::GeometryType>(geometryType));
+    geometry.SetType(static_cast<Geometry::Type>(geometryType));
   }
 }
 
 /**
  * Get the type of primitives this geometry contains
  *
- * @method getGeometryType
+ * @method getType
  * @for Geometry
  * @return {integer} Type of primitives this geometry contains
  * @example
@@ -279,14 +286,14 @@ void GeometryApi::SetGeometryType( const v8::FunctionCallbackInfo< v8::Value >&
  *      dali.GEOMETRY_TRIANGLE_FAN
  *      dali.GEOMETRY_TRIANGLE_STRIP
  */
-void GeometryApi::GetGeometryType( const v8::FunctionCallbackInfo< v8::Value >& args )
+void GeometryApi::GetType( const v8::FunctionCallbackInfo< v8::Value >& args )
 {
   v8::Isolate* isolate = args.GetIsolate();
   v8::HandleScope handleScope( isolate );
 
   Geometry geometry = GetGeometry( isolate, args );
 
-  args.GetReturnValue().Set( v8::Integer::New( isolate, geometry.GetGeometryType() ) );
+  args.GetReturnValue().Set( v8::Integer::New( isolate, geometry.GetType() ) );
 }
 
 } // namespace V8Plugin