mirror of https://github.com/axmolengine/axmol.git
add image format check for Image::saveToFile in CCImage-ios.mm (#18986)
IOS保存灰度图崩溃
This commit is contained in:
parent
3c8c5139c1
commit
482c9eb8ca
|
@ -40,6 +40,12 @@ NS_CC_BEGIN
|
|||
|
||||
bool cocos2d::Image::saveToFile(const std::string& filename, bool isToRGB)
|
||||
{
|
||||
//only support for Texture2D::PixelFormat::RGB888 or Texture2D::PixelFormat::RGBA8888 uncompressed data
|
||||
if (isCompressed() || (_renderFormat != Texture2D::PixelFormat::RGB888 && _renderFormat != Texture2D::PixelFormat::RGBA8888))
|
||||
{
|
||||
CCLOG("cocos2d: Image: saveToFile is only support for Texture2D::PixelFormat::RGB888 or Texture2D::PixelFormat::RGBA8888 uncompressed data for now");
|
||||
return false;
|
||||
}
|
||||
bool saveToPNG = false;
|
||||
bool needToCopyPixels = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue