issue #4904: fix iOS Image::safeToFile crashes when save jpg file.

This commit is contained in:
boyu0 2014-04-21 10:25:34 +08:00
parent 57d1f00788
commit a1024353f1
1 changed files with 1 additions and 2 deletions

View File

@ -61,8 +61,7 @@ bool cocos2d::Image::saveToFile(const std::string& filename, bool isToRGB)
// The data has alpha channel, and want to save it with an RGB png file,
// or want to save as jpg, remove the alpha channel.
if ((saveToPNG && hasAlpha() && isToRGB)
|| (! saveToPNG))
if (hasAlpha() && bitsPerPixel == 24)
{
pixels = new unsigned char[myDataLength];