Skip to content

Commit b4aba4c

Browse files
author
Walzer
committed
issue cocos2d#161,support *.jpg,add texture to texture cache
1 parent dfac241 commit b4aba4c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cocos2dx/textures/CCTextureCache.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
214214
texture = new CCTexture2D();
215215
texture->initWithImage(image);
216216
CCX_SAFE_DELETE(image);// image->release();
217+
218+
if( texture )
219+
{
220+
m_pTextures->setObject(texture, fullpath);
221+
texture->release();
222+
}
223+
else
224+
{
225+
CCLOG("cocos2d: Couldn't add image:%s in CCTextureCache", path);
226+
}
217227
}
218228
else
219229
{
@@ -237,7 +247,7 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
237247
if( texture )
238248
{
239249
m_pTextures->setObject(texture, fullpath);
240-
texture->autorelease();
250+
texture->release();
241251
}
242252
else
243253
{

0 commit comments

Comments
 (0)