From 3f233e2651181dc46270a55ecaf98b77e0be2580 Mon Sep 17 00:00:00 2001 From: Walzer Date: Mon, 27 Sep 2010 09:26:35 +0000 Subject: [PATCH] =?UTF-8?q?issue=20#161=EF=BC=8Csupport=20*.jpg=EF=BC=8Cad?= =?UTF-8?q?d=20texture=20to=20texture=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos2dx/textures/CCTextureCache.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cocos2dx/textures/CCTextureCache.cpp b/cocos2dx/textures/CCTextureCache.cpp index c683a2d3d0..6aa36098a3 100644 --- a/cocos2dx/textures/CCTextureCache.cpp +++ b/cocos2dx/textures/CCTextureCache.cpp @@ -214,6 +214,16 @@ CCTexture2D * CCTextureCache::addImage(const char * path) texture = new CCTexture2D(); texture->initWithImage(image); CCX_SAFE_DELETE(image);// image->release(); + + if( texture ) + { + m_pTextures->setObject(texture, fullpath); + texture->release(); + } + else + { + CCLOG("cocos2d: Couldn't add image:%s in CCTextureCache", path); + } } else { @@ -237,7 +247,7 @@ CCTexture2D * CCTextureCache::addImage(const char * path) if( texture ) { m_pTextures->setObject(texture, fullpath); - texture->autorelease(); + texture->release(); } else {