Merge branch 'gles20' of https://github.com/cocos2d/cocos2d-x into iss1399_adjust_structure

This commit is contained in:
minggo 2012-07-19 17:26:39 +08:00
commit 7467d254d4
4 changed files with 16 additions and 16 deletions

View File

@ -96,7 +96,7 @@ CCObject* CCObject::autorelease(void)
return this; return this;
} }
bool CCObject::isSingleRefrence(void) bool CCObject::isSingleReference(void)
{ {
return m_uReference == 1; return m_uReference == 1;
} }

View File

@ -65,7 +65,7 @@ public:
void retain(void); void retain(void);
CCObject* autorelease(void); CCObject* autorelease(void);
CCObject* copy(void); CCObject* copy(void);
bool isSingleRefrence(void); bool isSingleReference(void);
unsigned int retainCount(void); unsigned int retainCount(void);
virtual bool isEqual(const CCObject* pObject); virtual bool isEqual(const CCObject* pObject);

View File

@ -444,9 +444,9 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
CC_SAFE_DELETE_ARRAY(pBuffer); CC_SAFE_DELETE_ARRAY(pBuffer);
texture = new CCTexture2D(); texture = new CCTexture2D();
texture->initWithImage(&image, resolution);
if( texture &&
if( texture ) texture->initWithImage(&image, resolution) )
{ {
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
// cache the texture file name // cache the texture file name
@ -512,35 +512,35 @@ CCTexture2D * CCTextureCache::addPVRImage(const char* path)
{ {
CCAssert(path != NULL, "TextureCache: fileimage MUST not be nill"); CCAssert(path != NULL, "TextureCache: fileimage MUST not be nill");
CCTexture2D* tex = NULL; CCTexture2D* texture = NULL;
std::string key(path); std::string key(path);
// remove possible -HD suffix to prevent caching the same image twice (issue #1040) // remove possible -HD suffix to prevent caching the same image twice (issue #1040)
CCFileUtils::sharedFileUtils()->removeSuffixFromFile(key); CCFileUtils::sharedFileUtils()->removeSuffixFromFile(key);
if( (tex = (CCTexture2D*)m_pTextures->objectForKey(key.c_str())) ) if( (texture = (CCTexture2D*)m_pTextures->objectForKey(key.c_str())) )
{ {
return tex; return texture;
} }
// Split up directory and filename // Split up directory and filename
std::string fullpath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(key.c_str()); std::string fullpath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(key.c_str());
tex = new CCTexture2D(); texture = new CCTexture2D();
if(tex != NULL && tex->initWithPVRFile(fullpath.c_str()) ) if(texture != NULL && texture->initWithPVRFile(fullpath.c_str()) )
{ {
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
// cache the texture file name // cache the texture file name
VolatileTexture::addImageTexture(tex, fullpath.c_str(), CCImage::kFmtRawData); VolatileTexture::addImageTexture(texture, fullpath.c_str(), CCImage::kFmtRawData);
#endif #endif
m_pTextures->setObject(tex, key.c_str()); m_pTextures->setObject(texture, key.c_str());
tex->autorelease(); texture->autorelease();
} }
else else
{ {
CCLOG("cocos2d: Couldn't add PVRImage:%s in CCTextureCache",key.c_str()); CCLOG("cocos2d: Couldn't add PVRImage:%s in CCTextureCache",key.c_str());
CC_SAFE_DELETE(tex); CC_SAFE_DELETE(texture);
} }
return tex; return texture;
} }
CCTexture2D* CCTextureCache::addUIImage(CCImage *image, const char *key) CCTexture2D* CCTextureCache::addUIImage(CCImage *image, const char *key)

View File

@ -1 +1 @@
045538ed12cb89c21bbddd81ce3dcb49bb1715b2 01b67dcf0ffcd7522d8b9c2b1137de9f50bc657b