From 8c0310450783ed9028221168e60551554fbee8d2 Mon Sep 17 00:00:00 2001 From: "chaos.proton@gmail.com" Date: Fri, 20 Jul 2012 18:48:34 +0000 Subject: [PATCH] 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 --- components/rtgui/common/framebuffer_driver.c | 7 +------ components/rtgui/common/image_bmp.c | 8 +++++--- components/rtgui/common/pixel_driver.c | 6 ++++-- components/rtgui/include/rtgui/blit.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/components/rtgui/common/framebuffer_driver.c b/components/rtgui/common/framebuffer_driver.c index 3d46732ebb..04c21c42a5 100644 --- a/components/rtgui/common/framebuffer_driver.c +++ b/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 #include @@ -113,7 +108,7 @@ static void framebuffer_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y rt_uint8_t *dst; 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 = diff --git a/components/rtgui/common/image_bmp.c b/components/rtgui/common/image_bmp.c index 2374c7537b..b8519f3930 100644 --- a/components/rtgui/common/image_bmp.c +++ b/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); } - for (loadIndex = skipLength; loadIndex < readLength; loadIndex += bytePerPixel << bmp->scale) + for (loadIndex = skipLength; + loadIndex < readLength; + loadIndex += bytePerPixel << bmp->scale) { blit_line(temp, &wrkBuffer[loadIndex], bytePerPixel); 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, temp); x++; @@ -803,7 +805,7 @@ static void rtgui_image_bmp_blit(struct rtgui_image* image, struct rtgui_dc* dc, blit_line(temp, ptr, bytePerPixel); ptr += bytePerPixel; 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, temp); } diff --git a/components/rtgui/common/pixel_driver.c b/components/rtgui/common/pixel_driver.c index 503efb76cd..e32bef25ff 100644 --- a/components/rtgui/common/pixel_driver.c +++ b/components/rtgui/common/pixel_driver.c @@ -2,7 +2,6 @@ * Change Logs: * Date Author Notes * 2012-01-24 onelife add mono color support - * 2012-01-24 onelife fix a bug in _pixel_draw_raw_hline */ #include #include @@ -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) { - 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 */ diff --git a/components/rtgui/include/rtgui/blit.h b/components/rtgui/include/rtgui/blit.h index fb4564e6bc..0203af72f5 100644 --- a/components/rtgui/include/rtgui/blit.h +++ b/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); 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 -- GitLab