diff options
| author | [email protected] <[email protected]> | 2012-04-19 02:14:21 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-04-19 02:14:21 +0000 |
| commit | cdd01a252860a7c8da5997fe569afd09a52949bc (patch) | |
| tree | 221d0b55461fcad8c2628b3a4c8d8e763932bfa8 /components/rtgui/common | |
| parent | db0646020812efc16ff0beebe35f9049dcc2bfed (diff) | |
bring back commit 2079
I over written that commit accidentally, bring it back.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2093 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/common')
| -rw-r--r-- | components/rtgui/common/image.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/components/rtgui/common/image.c b/components/rtgui/common/image.c index 0160c990ea..1ae57e0ece 100644 --- a/components/rtgui/common/image.c +++ b/components/rtgui/common/image.c @@ -64,47 +64,47 @@ void rtgui_system_image_init(void) #endif } -static struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn) +static struct rtgui_image_engine* rtgui_image_get_engine(const char* type) { struct rtgui_list_node *node; struct rtgui_image_engine *engine; - const char* ext; - - ext = fn + rt_strlen(fn); - while (ext != fn) - { - if (*ext == '.') { ext ++; break; } - ext --; - } - if (ext == fn) return RT_NULL; /* no ext */ rtgui_list_foreach(node, &_rtgui_system_image_list) { engine = rtgui_list_entry(node, struct rtgui_image_engine, list); - if (strncasecmp(engine->name, ext, strlen(engine->name)) == 0) + + if (strncasecmp(engine->name, type, strlen(engine->name)) ==0) return engine; } return RT_NULL; } -static struct rtgui_image_engine* rtgui_image_get_engine(const char* type) +#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW) +static struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn) { struct rtgui_list_node *node; struct rtgui_image_engine *engine; + const char* ext; + + ext = fn + rt_strlen(fn); + while (ext != fn) + { + if (*ext == '.') { ext ++; break; } + ext --; + } + if (ext == fn) return RT_NULL; /* no ext */ rtgui_list_foreach(node, &_rtgui_system_image_list) { engine = rtgui_list_entry(node, struct rtgui_image_engine, list); - - if (strncasecmp(engine->name, type, strlen(engine->name)) ==0) + if (strncasecmp(engine->name, ext, strlen(engine->name)) == 0) return engine; } return RT_NULL; } -#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW) struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load) { struct rtgui_filerw* filerw; |
