浏览代码

sync with RTGUI d24a1ff

fix rtgui/driver and bmp engine bugs.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2223 bbd45198-f89e-11dd-88c7-29a3b14d5316
chaos.proton@gmail.com 13 年之前
父节点
当前提交
8c03104507

+ 1 - 6
components/rtgui/common/framebuffer_driver.c

@@ -1,8 +1,3 @@
-/*
- * Change Logs:
- * Date           Author       Notes
- * 2012-01-24     onelife      fix a bug in framebuffer_draw_raw_hline
- */
 #include <rtgui/rtgui_system.h>
 #include <rtgui/rtgui_system.h>
 #include <rtgui/driver.h>
 #include <rtgui/driver.h>
 
 
@@ -113,7 +108,7 @@ static void framebuffer_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y
 	rt_uint8_t *dst;
 	rt_uint8_t *dst;
 
 
 	dst = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint8_t);
 	dst = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint8_t);
-	rt_memcpy(dst, pixels, (x2 - x1 + 1) * (rtgui_graphic_get_device()->bits_per_pixel/8));
+	rt_memcpy(dst, pixels, (x2 - x1) * (rtgui_graphic_get_device()->bits_per_pixel/8));
 }
 }
 
 
 const struct rtgui_graphic_driver_ops _framebuffer_rgb565_ops = 
 const struct rtgui_graphic_driver_ops _framebuffer_rgb565_ops = 

+ 5 - 3
components/rtgui/common/image_bmp.c

@@ -706,11 +706,13 @@ static void rtgui_image_bmp_blit(struct rtgui_image* image, struct rtgui_dc* dc,
                             blit_line = rtgui_blit_line_get(hw_bytePerPixel, bytePerPixel);
                             blit_line = rtgui_blit_line_get(hw_bytePerPixel, bytePerPixel);
                         }
                         }
 
 
-                        for (loadIndex = skipLength; loadIndex < readLength; loadIndex += bytePerPixel << bmp->scale)
+                        for (loadIndex = skipLength;
+							 loadIndex < readLength;
+							 loadIndex += bytePerPixel << bmp->scale)
                         {
                         {
                             blit_line(temp, &wrkBuffer[loadIndex], bytePerPixel);
                             blit_line(temp, &wrkBuffer[loadIndex], bytePerPixel);
                             dc->engine->blit_line(dc,
                             dc->engine->blit_line(dc,
-                                dst_rect->x1 + x, dst_rect->x1 + x,
+                                dst_rect->x1 + x, dst_rect->x1 + x + 1,
                                 dst_rect->y1 + image->h - y,
                                 dst_rect->y1 + image->h - y,
                                 temp);
                                 temp);
                             x++;
                             x++;
@@ -803,7 +805,7 @@ static void rtgui_image_bmp_blit(struct rtgui_image* image, struct rtgui_dc* dc,
                         blit_line(temp, ptr, bytePerPixel);
                         blit_line(temp, ptr, bytePerPixel);
                         ptr += bytePerPixel;
                         ptr += bytePerPixel;
                         dc->engine->blit_line(dc,
                         dc->engine->blit_line(dc,
-                            dst_rect->x1 + x, dst_rect->x1 + x,
+                            dst_rect->x1 + x, dst_rect->x1 + x + 1,
                             dst_rect->y1 + y,
                             dst_rect->y1 + y,
                             temp);
                             temp);
                     }
                     }

+ 4 - 2
components/rtgui/common/pixel_driver.c

@@ -2,7 +2,6 @@
  * Change Logs:
  * Change Logs:
  * Date           Author       Notes
  * Date           Author       Notes
  * 2012-01-24     onelife      add mono color support
  * 2012-01-24     onelife      add mono color support
- * 2012-01-24     onelife      fix a bug in _pixel_draw_raw_hline
  */
  */
 #include <rtgui/rtgui_system.h>
 #include <rtgui/rtgui_system.h>
 #include <rtgui/driver.h>
 #include <rtgui/driver.h>
@@ -140,7 +139,10 @@ static void _pixel_rgb888_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
 
 
 static void _pixel_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
 static void _pixel_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
 {
 {
-	gfx_device_ops->blit_line((char*)pixels, x1, x2, y);
+	if (x2 > x1)
+		gfx_device_ops->blit_line((char*)pixels, x1, y, (x2 - x1));
+	else
+		gfx_device_ops->blit_line((char*)pixels, x2, y, (x1 - x2));	
 }
 }
 
 
 /* pixel device */
 /* pixel device */

+ 1 - 1
components/rtgui/include/rtgui/blit.h

@@ -5,6 +5,6 @@
 
 
 typedef void (*rtgui_blit_line_func)(rt_uint8_t* dst, rt_uint8_t* src, int line);
 typedef void (*rtgui_blit_line_func)(rt_uint8_t* dst, rt_uint8_t* src, int line);
 rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp);
 rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp);
-rtgui_blit_line_func rtgui_blit_line_get_inv(int dst_bpp, int src_bpp);
+rtgui_blit_line_func rtgui_blit_line_get_inv(int dst_bpp, int src_bpp);
 
 
 #endif
 #endif