From 4edb72147bd84b78b435d15cdcf304442f71ec13 Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Tue, 1 Dec 2009 15:27:22 +0000 Subject: [PATCH] add embedded hdc image support git-svn-id: https://rt-thread.googlecode.com/svn/trunk@184 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- rtgui/common/image.c | 4 ++-- rtgui/common/image_hdc.c | 2 +- rtgui/common/rtgui_system.c | 2 +- rtgui/common/rtgui_theme.c | 8 ++++---- rtgui/include/rtgui/image.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rtgui/common/image.c b/rtgui/common/image.c index 40c1363029..85fc6485f9 100644 --- a/rtgui/common/image.c +++ b/rtgui/common/image.c @@ -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); diff --git a/rtgui/common/image_hdc.c b/rtgui/common/image_hdc.c index db5ad6b2df..a272e93fbe 100644 --- a/rtgui/common/image_hdc.c +++ b/rtgui/common/image_hdc.c @@ -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; } } diff --git a/rtgui/common/rtgui_system.c b/rtgui/common/rtgui_system.c index 3ee1e8ff1d..824d298abc 100644 --- a/rtgui/common/rtgui_system.c +++ b/rtgui/common/rtgui_system.c @@ -20,7 +20,7 @@ #include #include -#define RTGUI_EVENT_DEBUG +// #define RTGUI_EVENT_DEBUG #ifdef __WIN32__ #define RTGUI_EVENT_DEBUG diff --git a/rtgui/common/rtgui_theme.c b/rtgui/common/rtgui_theme.c index b7d34966c4..ef0046953f 100644 --- a/rtgui/common/rtgui_theme.c +++ b/rtgui/common/rtgui_theme.c @@ -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)); diff --git a/rtgui/include/rtgui/image.h b/rtgui/include/rtgui/image.h index 68f6144ebe..d6245d4881 100644 --- a/rtgui/include/rtgui/image.h +++ b/rtgui/include/rtgui/image.h @@ -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 */