cleanup code.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@843 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2010-08-10 23:57:23 +00:00
parent 702f5e81b6
commit a385dc3940
2 changed files with 12 additions and 4 deletions

View File

@ -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");
}

View File

@ -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");