I use image.saveToFile(“C:/aab.jpg”) to save it in local disk, and it shows correct.
Any possible reason will make this happen? a correct image but a wrong sprite.
below is my code:
do
{
CCImage image;
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, imageType));
image.saveToFile(“C:/aab.jpg”);
texture = new CCTexture2D();
texture~~>initWithImage;
if
{
if
{
#if CC_ENABLE_CACHE_TEXTTURE_DATA
// cache the texture file name
VolatileTexture::addImageTexture;
#endif
m_pTextures~~>setObject(texture, key);
}
// autorelease prevents possible crash in multithreaded environments
texture->autorelease();
}
else
{
CCLOG (“cocos2d: Couldn’t add image data in CCTextureCache.”);
}
}
while(0);