mirror of https://github.com/axmolengine/axmol.git
Fix to allow the correct saving of images on iOS when using a virtual file system (#369)
* Fix to allow the correct saving of images on iOS when using a virtual file system * Add missing import for FileUtils
This commit is contained in:
parent
29015e1cd7
commit
f72cd54eac
|
@ -25,6 +25,7 @@ THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#import "platform/CCImage.h"
|
#import "platform/CCImage.h"
|
||||||
#import "platform/CCCommon.h"
|
#import "platform/CCCommon.h"
|
||||||
|
#import "platform/CCFileUtils.h"
|
||||||
#import <string>
|
#import <string>
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
@ -111,7 +112,9 @@ bool cocos2d::Image::saveToFile(const std::string& filename, bool isToRGB)
|
||||||
} else {
|
} else {
|
||||||
data = UIImageJPEGRepresentation(image, 1.0f);
|
data = UIImageJPEGRepresentation(image, 1.0f);
|
||||||
}
|
}
|
||||||
[data writeToFile:[NSString stringWithUTF8String:filename.c_str()] atomically:YES];
|
|
||||||
|
auto outStream = FileUtils::getInstance()->openFileStream(filename, FileStream::Mode::WRITE);
|
||||||
|
outStream->write(data.bytes, data.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
[image release];
|
[image release];
|
||||||
|
|
Loading…
Reference in New Issue