Fixed bug in SetIndexBuffer for v8 plugin 58/67858/3
authorFerran Sole <ferran.sole@samsung.com>
Thu, 28 Apr 2016 16:58:42 +0000 (17:58 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Thu, 28 Apr 2016 17:18:17 +0000 (18:18 +0100)
Change-Id: I09c8c148f4f2308a2e2b4b19d007db5d51d9ebbe

plugins/dali-script-v8/src/rendering/geometry-api.cpp

index e9c35a92df1d1b5df4a36c57f69df2896da7d947..af216bd4a45107cfef4beb86a7721c5cc0084474 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 );
     }
   }
 }