fixed #928: save pixelformat for each texture, restore the pixelformat after entering foreground

This commit is contained in:
dumganhar 2011-12-29 15:05:38 +08:00
parent 0f2d99b27e
commit 025258d21d
1 changed files with 4 additions and 0 deletions

View File

@ -646,6 +646,7 @@ void VolatileTexture::addImageTexture(CCTexture2D *tt, const char* imageFileName
vt->m_eCashedImageType = kImageFile;
vt->m_strFileName = imageFileName;
vt->m_FmtImage = format;
vt->m_PixelFormat = CCTexture2D::defaultAlphaPixelFormat();
}
void VolatileTexture::addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, const CCSize& contentSize)
@ -735,7 +736,10 @@ void VolatileTexture::reloadAllTextures()
if (image.initWithImageData((void*)pBuffer, nSize, vt->m_FmtImage))
{
CCTexture2DPixelFormat oldPixelFormat = CCTexture2D::defaultAlphaPixelFormat();
CCTexture2D::setDefaultAlphaPixelFormat(vt->m_PixelFormat);
vt->texture->initWithImage(&image);
CCTexture2D::setDefaultAlphaPixelFormat(oldPixelFormat);
}
}
break;