From: cedric Date: Tue, 7 Jul 2009 11:07:43 +0000 (+0000) Subject: * evas: Try all known modules when testing an unknown file. X-Git-Tag: submit/trunk/20120815.174732~3249 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b52956660bbe7b09153bdcbe30cff58d466ad38;p=profile%2Fivi%2Fevas.git * evas: Try all known modules when testing an unknown file. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@41262 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/engines/common/evas_image_load.c b/src/lib/engines/common/evas_image_load.c index e65884f..9ab8a6d 100644 --- a/src/lib/engines/common/evas_image_load.c +++ b/src/lib/engines/common/evas_image_load.c @@ -11,7 +11,7 @@ struct ext_loader_s { const char* loader; }; -static struct ext_loader_s loaders[] = { +static struct ext_loader_s const loaders[] = { { "png", "png" }, { "jpg", "jpeg" }, { "jpeg", "jpeg" }, @@ -32,6 +32,10 @@ static struct ext_loader_s loaders[] = { { "pnm", "pmaps" } }; +static const char *loaders_name[] = { + "png", "jpeg", "eet", "xpm", "tiff", "gif", "svg", "pmaps", "edb" +}; + static Eina_Bool _evas_image_foreach_loader(const Eina_Hash *hash, const char *key, Evas_Module *em, Image_Entry *ie) { @@ -94,14 +98,32 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie) evas_image_load_func = em->functions; if (evas_image_load_func->file_head(ie, ie->file, ie->key)) goto ok; + evas_module_unload(em); } } } - /* FIXME: We don't try not loaded module yet, changed behaviour with previous one. */ evas_module_foreach_image_loader(_evas_image_foreach_loader, ie); if (ie->info.module) return 0; + /* This is our last chance, try all known image loader. */ + /* FIXME: We could use eina recursive module search ability. */ + for (i = 0; i < sizeof (loaders_name) / sizeof (char *); ++i) + { + em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loaders_name[i]); + if (em) + { + if (evas_module_load(em)) + { + evas_module_use(em); + evas_image_load_func = em->functions; + if (evas_image_load_func->file_head(ie, ie->file, ie->key)) + goto ok; + evas_module_unload(em); + } + } + } + return -1; ok: