From a1b4cd845f2fecec2736591cea71289e19286701 Mon Sep 17 00:00:00 2001 From: zilongshanren Date: Thu, 17 Mar 2016 16:38:17 +0800 Subject: [PATCH] Revert "Fix incorrect function name of getTrianglesCount" --- .../js-bindings/manual/cocos2d_specifics.cpp | 25 +------------------ .../SpritePolygonTest/SpritePolygonTest.js | 2 +- .../SpritePolygonTest/SpritePolygonTest.lua | 2 +- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 474c058623..1f8bc98cae 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -5453,27 +5453,6 @@ bool js_cocos2dx_PolygonInfo_getArea(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getArea : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_PolygonInfo_getTrianglesCount(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PolygonInfo_getTrianglesCount : Invalid Native Object"); - if (argc == 0) - { - const unsigned int ret = cobj->getTrianglesCount(); - jsval jsret = JSVAL_NULL; - jsret = uint32_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getTrianglesCount : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} - -// TODO: The "getTriaglesCount" function is deprecated in favor of "getTrianglesCount". bool js_cocos2dx_PolygonInfo_getTriaglesCount(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5489,11 +5468,10 @@ bool js_cocos2dx_PolygonInfo_getTriaglesCount(JSContext *cx, uint32_t argc, jsva args.rval().set(jsret); return true; } - + JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getTriaglesCount : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } - bool js_cocos2dx_PolygonInfo_getVertCount(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5652,7 +5630,6 @@ void js_register_cocos2dx_PolygonInfo(JSContext *cx, JS::HandleObject global) static JSFunctionSpec funcs[] = { JS_FN("getArea", js_cocos2dx_PolygonInfo_getArea, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getTrianglesCount", js_cocos2dx_PolygonInfo_getTrianglesCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTriaglesCount", js_cocos2dx_PolygonInfo_getTriaglesCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getVertCount", js_cocos2dx_PolygonInfo_getVertCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END diff --git a/tests/js-tests/src/SpritePolygonTest/SpritePolygonTest.js b/tests/js-tests/src/SpritePolygonTest/SpritePolygonTest.js index e20d9293f9..da11edf7fc 100644 --- a/tests/js-tests/src/SpritePolygonTest/SpritePolygonTest.js +++ b/tests/js-tests/src/SpritePolygonTest/SpritePolygonTest.js @@ -429,7 +429,7 @@ var SpritePolygonPerformanceTestDynamic = SpritePolygonPerformance.extend({ }, initIncrementStats: function () { this._incVert = this._polygons.getVertCount(); - this._incTri = this._polygons.getTrianglesCount(); + this._incTri = this._polygons.getTriaglesCount(); this._incPix = this._polygons.getArea(); }, makeSprite: function () { diff --git a/tests/lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua b/tests/lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua index dc43b5cf72..c5d3362e17 100644 --- a/tests/lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua +++ b/tests/lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua @@ -690,7 +690,7 @@ end function SpritePolygonPerformanceTestDynamic:initIncrementStats() self._incVert = self._info:getVertCount() - self._incTri = self._info:getTrianglesCount() + self._incTri = self._info:getTriaglesCount() self._incPix = self._info:getArea() end