From b0c4adcbd07de4eba299afec30ccc638a50e4443 Mon Sep 17 00:00:00 2001 From: mogemimi Date: Wed, 23 Dec 2015 19:07:03 +0900 Subject: [PATCH] Fix method name spelling in AutoPolygon --- cocos/2d/CCAutoPolygon.cpp | 7 ++++++- cocos/2d/CCAutoPolygon.h | 5 ++++- cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp | 2 +- .../Classes/SpritePolygonTest/SpritePolygonTest.cpp | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cocos/2d/CCAutoPolygon.cpp b/cocos/2d/CCAutoPolygon.cpp index eec77cec05..98f3ea8c8f 100644 --- a/cocos/2d/CCAutoPolygon.cpp +++ b/cocos/2d/CCAutoPolygon.cpp @@ -119,11 +119,16 @@ const unsigned int PolygonInfo::getVertCount() const return (unsigned int)triangles.vertCount; } -const unsigned int PolygonInfo::getTriaglesCount() const +const unsigned int PolygonInfo::getTrianglesCount() const { return (unsigned int)triangles.indexCount/3; } +const unsigned int PolygonInfo::getTriaglesCount() const +{ + return getTrianglesCount(); +} + const float PolygonInfo::getArea() const { float area = 0; diff --git a/cocos/2d/CCAutoPolygon.h b/cocos/2d/CCAutoPolygon.h index 7dc7a17749..f48d1bbd33 100644 --- a/cocos/2d/CCAutoPolygon.h +++ b/cocos/2d/CCAutoPolygon.h @@ -107,7 +107,10 @@ public: * get triangles count * @return number of triangles */ - const unsigned int getTriaglesCount() const; + const unsigned int getTrianglesCount() const; + + /** @deprecated Use method getTrianglesCount() instead */ + CC_DEPRECATED_ATTRIBUTE const unsigned int getTriaglesCount() const; /** * get sum of all triangle area size diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 626e7a5a82..66fdd989c3 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -5418,7 +5418,7 @@ bool js_cocos2dx_PolygonInfo_getTriaglesCount(JSContext *cx, uint32_t argc, jsva JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PolygonInfo_getTriaglesCount : Invalid Native Object"); if (argc == 0) { - const unsigned int ret = cobj->getTriaglesCount(); + const unsigned int ret = cobj->getTrianglesCount(); jsval jsret = JSVAL_NULL; jsret = uint32_to_jsval(cx, ret); args.rval().set(jsret); diff --git a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp index af749d442a..ab341cf42c 100644 --- a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp +++ b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp @@ -593,7 +593,7 @@ void SpritePolygonPerformanceTestDynamic::initIncrementStats() { _pinfo = AutoPolygon::generatePolygon(s_pathGrossini); _incVert = _pinfo.getVertCount(); - _incTri = _pinfo.getTriaglesCount(); + _incTri = _pinfo.getTrianglesCount(); _incPix = _pinfo.getArea(); }