Merge pull request #1759 from dumganhar/gles20

fixed #1614: DrawNodeTest crashes on JSB.
This commit is contained in:
James Chen 2012-12-13 18:33:26 -08:00
commit 5b23475451
2 changed files with 16 additions and 7 deletions

@ -1 +1 @@
Subproject commit 2e932705a10756255a226e5faa18891a8ec9d0d0
Subproject commit 02729f24fb4a56fa83e9d16b20de8fb6ad7f516e

View File

@ -2196,23 +2196,32 @@ JSBool js_cocos2dx_CCDrawNode_drawPolygon(JSContext *cx, uint32_t argc, jsval *v
if ( argc == 4) {
jsval *argvp = JS_ARGV(cx,vp);
JSBool ok = JS_TRUE;
JSObject *argArray; ccColor4F argFillColor; double argWidth; ccColor4F argBorderColor;
JSObject *argArray = NULL;
ccColor4F argFillColor = ccc4f(0.0f, 0.0f, 0.0f, 0.0f);
double argWidth = 0.0;
ccColor4F argBorderColor = ccc4f(0.0f, 0.0f, 0.0f, 0.0f);
// Points
ok &= JS_ValueToObject(cx, *argvp++, &argArray);
if( ! (argArray && JS_IsArrayObject(cx, argArray) ) )
{
JS_ReportError(cx, "Vertex should be anArray object");
return JS_FALSE;
}
JSObject *tmp_arg;
ok &= JS_ValueToObject( cx, *argvp++, &tmp_arg );
argFillColor = *(ccColor4F*)JS_GetArrayBufferViewData( tmp_arg, cx );
// Color 4F
argFillColor = jsval_to_cccolor4f(cx, *argvp++);
// Width
ok &= JS_ValueToNumber( cx, *argvp++, &argWidth );
ok &= JS_ValueToObject( cx, *argvp++, &tmp_arg );
argBorderColor = *(ccColor4F*)JS_GetArrayBufferViewData( tmp_arg, cx );
// Color Border (4F)
argBorderColor = jsval_to_cccolor4f(cx, *argvp++);
if( ! ok )
{
return JS_FALSE;
}
{
uint32_t l;