Update config.json for 3rd-party-libs and SpritePolygonCache

This commit is contained in:
samuele3hu 2015-04-27 11:01:47 +08:00
parent c2cefadb6f
commit 6f17dcecf2
4 changed files with 30 additions and 9 deletions

View File

@ -268,8 +268,7 @@ bool SpritePolygon::initWithMarching(const std::string &file, const cocos2d::Rec
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(file, *info); _polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(file, *info);
calculateUVandContentSize(); calculateUVandContentSize();
delete _triangles.verts; delete info;
delete _triangles.indices;
#if CC_SPRITE_DEBUG_DRAW #if CC_SPRITE_DEBUG_DRAW
debugDraw(); debugDraw();
#endif #endif

View File

@ -145,14 +145,23 @@ void SpritePolygonCache::removeSpritePolygonCache(const std::string& filePath,
return; return;
if (nullptr == rect) if (nullptr == rect)
{ return;
}
auto infoIter = it->second.begin(); auto infoIter = it->second.begin();
bool exist = false;
for (; infoIter != it->second.end(); infoIter++) for (; infoIter != it->second.end(); infoIter++)
{ {
//TODO: write clean up code... if((*infoIter)->_rect.equals(*rect))
{
exist = true;
break;
}
}
if (exist)
{
CC_SAFE_DELETE(*infoIter);
it->second.erase(infoIter);
} }
return; return;
@ -162,7 +171,11 @@ void SpritePolygonCache::removeAllSpritePolygonCache()
{ {
for (std::unordered_map<std::string, VecSpritePolygonInfo>::iterator it = _SpritePolygonCacheMap.begin(); it != _SpritePolygonCacheMap.end(); ++it) for (std::unordered_map<std::string, VecSpritePolygonInfo>::iterator it = _SpritePolygonCacheMap.begin(); it != _SpritePolygonCacheMap.end(); ++it)
{ {
//TODO: write clean up code... auto infoIter = it->second.begin();
for (; infoIter != it->second.end(); infoIter++)
{
CC_SAFE_DELETE(*infoIter);
}
it->second.clear(); it->second.clear();
} }
_SpritePolygonCacheMap.clear(); _SpritePolygonCacheMap.clear();

View File

@ -40,8 +40,17 @@ typedef struct CC_DLL _SpritePolygonInfo
{ {
cocos2d::Rect _rect; cocos2d::Rect _rect;
cocos2d::TrianglesCommand::Triangles _triangles; cocos2d::TrianglesCommand::Triangles _triangles;
~_SpritePolygonInfo(){ ~_SpritePolygonInfo()
{
if(nullptr != _triangles.verts)
{
CC_SAFE_DELETE_ARRAY(_triangles.verts);
}
if(nullptr != _triangles.indices)
{
CC_SAFE_DELETE_ARRAY(_triangles.indices);
}
} }
} SpritePolygonInfo; } SpritePolygonInfo;

View File

@ -1,5 +1,5 @@
{ {
"version":"v3-deps-46", "version":"v3-deps-47",
"zip_file_size":"74127526", "zip_file_size":"74127526",
"repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_name":"cocos2d-x-3rd-party-libs-bin",
"repo_parent":"https://github.com/cocos2d/", "repo_parent":"https://github.com/cocos2d/",