Fix JNI JPEG and PNG file loading
This commit is contained in:
@@ -15,6 +15,7 @@ namespace lime {
|
||||
|
||||
FILE* getFile ();
|
||||
int getLength ();
|
||||
bool isFile ();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -38,6 +38,13 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
bool FILE_HANDLE::isFile () {
|
||||
|
||||
return ((SDL_RWops*)handle)->type == SDL_RWOPS_STDFILE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int fclose (FILE_HANDLE *stream) {
|
||||
|
||||
if (stream) {
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace lime {
|
||||
|
||||
file = lime::fopen (resource->path, "rb");
|
||||
|
||||
if (file->getFile ()) {
|
||||
if (file->isFile ()) {
|
||||
|
||||
jpeg_stdio_src (&cinfo, file->getFile ());
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace lime {
|
||||
|
||||
if (file) {
|
||||
|
||||
if (file->getFile ()) {
|
||||
if (file->isFile ()) {
|
||||
|
||||
png_init_io (png_ptr, file->getFile ());
|
||||
png_set_sig_bytes (png_ptr, PNG_SIG_SIZE);
|
||||
|
||||
@@ -22,6 +22,13 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
bool FILE_HANDLE::isFile () {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int fclose (FILE_HANDLE *stream) {
|
||||
|
||||
if (stream) {
|
||||
|
||||
Reference in New Issue
Block a user