提交 a385dc39 编写于 作者: B bernard.xiong@gmail.com

cleanup code.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@843 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 702f5e81
#include <rtgui/rtgui.h> #include <rtgui/rtgui.h>
#include <rtgui/driver.h>
#include <rtgui/rtgui_server.h> #include <rtgui/rtgui_server.h>
/* /*
* a single panel for 240x320 * a single panel
*/ */
void panel_init(void) void panel_init(void)
{ {
...@@ -11,8 +12,8 @@ void panel_init(void) ...@@ -11,8 +12,8 @@ void panel_init(void)
/* register main panel */ /* register main panel */
rect.x1 = 0; rect.x1 = 0;
rect.y1 = 0; rect.y1 = 0;
rect.x2 = 240; rect.x2 = rtgui_graphic_driver_get_default()->width;
rect.y2 = 320; rect.y2 = rtgui_graphic_driver_get_default()->height;
rtgui_panel_register("main", &rect); rtgui_panel_register("main", &rect);
rtgui_panel_set_default_focused("main"); rtgui_panel_set_default_focused("main");
} }
...@@ -36,11 +36,18 @@ static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event) ...@@ -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)); 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)); 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 || if (rt_strstr(path, ".png") != RT_NULL ||
rt_strstr(path, ".PNG") != RT_NULL) rt_strstr(path, ".PNG") != RT_NULL)
strcat(image_type, "png"); strcat(image_type, "png");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册