android: fix issue loading some image files

This commit is contained in:
rdb 2018-02-06 22:33:34 +01:00
parent c1fccd311b
commit 10789f6936
3 changed files with 6 additions and 2 deletions

View File

@ -21,7 +21,10 @@
#include "bamReader.h"
static const char * const extensions_android[] = {
"jpg", "jpeg", "gif", "png",//"webp" (android 4.0+)
"jpg", "jpeg", "gif", "png",
#if __ANDROID_API__ >= 14
"webp"
#endif
};
static const int num_extensions_android = sizeof(extensions_android) / sizeof(const char *);

View File

@ -87,6 +87,7 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) :
jobject opts = _env->CallStaticObjectMethod(jni_PandaActivity,
jni_PandaActivity_readBitmapSize,
(jlong) _file);
_file->clear();
_file->seekg(pos);
if (_file->tellg() != pos) {
android_cat.error()

View File

@ -62,7 +62,7 @@
static const char *const stb_extensions[] = {
// Expose the extensions that we don't already expose through other loaders.
#ifndef HAVE_JPEG
#if !defined(HAVE_JPEG) && !defined(ANDROID)
"jpg", "jpeg",
#endif
#ifndef HAVE_PNG