summaryrefslogtreecommitdiff
path: root/components/rtgui/common/image.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-04-18 15:06:12 +0000
committer[email protected] <[email protected]>2012-04-18 15:06:12 +0000
commitdb0646020812efc16ff0beebe35f9049dcc2bfed (patch)
tree5e949e9ba679a07b0198745853e900a016a3834e /components/rtgui/common/image.c
parent06d45f0c42f2aa3678d509403fcf9cd82be106e6 (diff)
merge new RTGUI in to trunk
The full log is at https://github.com/RTGUI/RTGUI/commits/merge_1 and it's difficult to merge the new tree commit by commit. I also converted all the file into unix eol so there are many fake diff. Big changes are noted in rtgui/doc/road_map.txt and rtgui/doc/attention.txt. Keep an eye on them if you want to migrate your old code. Note that the work is still in progress and the bsp is not prepared in trunk so far. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2092 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/common/image.c')
-rw-r--r--components/rtgui/common/image.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/components/rtgui/common/image.c b/components/rtgui/common/image.c
index 45a1013a69..0160c990ea 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(const char* type)
+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)
-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;
}
+#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;