浏览代码

add embedded hdc image support

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@184 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 15 年之前
父节点
当前提交
4edb72147b
共有 5 个文件被更改,包括 9 次插入9 次删除
  1. 2 2
      rtgui/common/image.c
  2. 1 1
      rtgui/common/image_hdc.c
  3. 1 1
      rtgui/common/rtgui_system.c
  4. 4 4
      rtgui/common/rtgui_theme.c
  5. 1 1
      rtgui/include/rtgui/image.h

+ 2 - 2
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);

+ 1 - 1
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;
 		}
     }

+ 1 - 1
rtgui/common/rtgui_system.c

@@ -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

+ 4 - 4
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));

+ 1 - 1
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 */