diff options
| author | [email protected] <[email protected]> | 2010-08-10 23:57:23 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2010-08-10 23:57:23 +0000 |
| commit | a385dc39403d0b3357b77a5039abc928666207b8 (patch) | |
| tree | 9039c1171a3fbc20e36527b62258f3c0601f6337 /examples | |
| parent | 702f5e81b6e410acf9a3173abee7776b205e1bd0 (diff) | |
cleanup code.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@843 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/gui/demo_panel_single.c | 7 | ||||
| -rw-r--r-- | examples/gui/demo_view_image.c | 9 |
2 files changed, 12 insertions, 4 deletions
diff --git a/examples/gui/demo_panel_single.c b/examples/gui/demo_panel_single.c index 5b3b217a01..2e56de4fd4 100644 --- a/examples/gui/demo_panel_single.c +++ b/examples/gui/demo_panel_single.c @@ -1,8 +1,9 @@ #include <rtgui/rtgui.h>
+#include <rtgui/driver.h>
#include <rtgui/rtgui_server.h>
/*
- * a single panel for 240x320
+ * a single panel
*/
void panel_init(void)
{
@@ -11,8 +12,8 @@ void panel_init(void) /* register main panel */
rect.x1 = 0;
rect.y1 = 0;
- rect.x2 = 240;
- rect.y2 = 320;
+ rect.x2 = rtgui_graphic_driver_get_default()->width;
+ rect.y2 = rtgui_graphic_driver_get_default()->height;
rtgui_panel_register("main", &rect);
rtgui_panel_set_default_focused("main");
}
diff --git a/examples/gui/demo_view_image.c b/examples/gui/demo_view_image.c index dd4f895211..bb65837746 100644 --- a/examples/gui/demo_view_image.c +++ b/examples/gui/demo_view_image.c @@ -36,11 +36,18 @@ static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event) /* �����ļ�·���ı�ǩ */
rtgui_filelist_view_get_fullpath(view, path, sizeof(path));
- if (image != RT_NULL) rtgui_image_destroy(image);
+ if (image != RT_NULL)
+ {
+ rtgui_image_destroy(image);
+ image = RT_NULL;
+ }
rt_memset(image_type, 0, sizeof(image_type));
/* ���ͼ������� */
+ if (rt_strstr(path, ".bmp") != RT_NULL ||
+ rt_strstr(path, ".BMP") != RT_NULL)
+ strcat(image_type, "bmp");
if (rt_strstr(path, ".png") != RT_NULL ||
rt_strstr(path, ".PNG") != RT_NULL)
strcat(image_type, "png");
|
