提交 4edb7214 编写于 作者: B bernard.xiong

add embedded hdc image support

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@184 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 de98f5db
......@@ -115,7 +115,7 @@ struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* f
return image;
}
struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8_t* data, rt_size_t length)
struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8_t* data, rt_size_t length, rt_bool_t load)
{
struct rtgui_filerw* filerw;
struct rtgui_image_engine* engine;
......@@ -144,7 +144,7 @@ struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8
return RT_NULL;
}
if (engine->image_load(image, filerw, RT_TRUE) != RT_TRUE)
if (engine->image_load(image, filerw, load) != RT_TRUE)
{
/* close filerw context */
rtgui_filerw_close(filerw);
......
......@@ -207,7 +207,7 @@ static void rtgui_image_hdc_blit(struct rtgui_image* image, struct rtgui_dc* dc,
for (y = 0; y < h; y ++)
{
rtgui_image_hdc_raw_hline((struct rtgui_dc_hw*)dc, ptr, dst_rect->x1, dst_rect->x2, dst_rect->y1 + y);
rtgui_image_hdc_raw_hline((struct rtgui_dc_hw*)dc, ptr, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y);
ptr += hdc->pitch;
}
}
......
......@@ -20,7 +20,7 @@
#include <rtgui/rtgui_server.h>
#include <rtgui/widgets/window.h>
#define RTGUI_EVENT_DEBUG
// #define RTGUI_EVENT_DEBUG
#ifdef __WIN32__
#define RTGUI_EVENT_DEBUG
......
......@@ -189,9 +189,9 @@ static rtgui_image_t* close_unpressed = RT_NULL;
void rtgui_system_theme_init()
{
close_pressed = rtgui_image_create_from_mem("xpm",
(const rt_uint8_t*)close_pressed_xpm, sizeof(close_pressed_xpm));
(const rt_uint8_t*)close_pressed_xpm, sizeof(close_pressed_xpm), RT_TRUE);
close_unpressed = rtgui_image_create_from_mem("xpm",
(const rt_uint8_t*)close_unpressed_xpm, sizeof(close_unpressed_xpm));
(const rt_uint8_t*)close_unpressed_xpm, sizeof(close_unpressed_xpm), RT_TRUE);
}
/* window drawing */
......@@ -203,10 +203,10 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
/* init close box image */
if (close_pressed == RT_NULL)
close_pressed = rtgui_image_create_from_mem("xpm",
(const rt_uint8_t*)close_pressed_xpm, sizeof(close_pressed_xpm));
(const rt_uint8_t*)close_pressed_xpm, sizeof(close_pressed_xpm), RT_TRUE);
if (close_unpressed == RT_NULL)
close_unpressed = rtgui_image_create_from_mem("xpm",
(const rt_uint8_t*)close_unpressed_xpm, sizeof(close_unpressed_xpm));
(const rt_uint8_t*)close_unpressed_xpm, sizeof(close_unpressed_xpm), RT_TRUE);
/* begin drawing */
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(win->title));
......
......@@ -50,7 +50,7 @@ typedef struct rtgui_image rtgui_image_t;
void rtgui_system_image_init(void);
struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load);
struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8_t* data, rt_size_t length);
struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8_t* data, rt_size_t length, rt_bool_t load);
void rtgui_image_destroy(struct rtgui_image* image);
/* register an image engine */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册