From f6db5d1c744ee7d490d817d4a039577d110c5572 Mon Sep 17 00:00:00 2001 From: "iamyhw@gmail.com" Date: Thu, 21 Jul 2011 01:40:56 +0000 Subject: [PATCH] Fixd dc_buffer_fill_rect color,The foreground and background exchanged. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1646 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/rtgui/common/dc_buffer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/rtgui/common/dc_buffer.c b/components/rtgui/common/dc_buffer.c index 7677fa9dd5..40da901bd0 100644 --- a/components/rtgui/common/dc_buffer.c +++ b/components/rtgui/common/dc_buffer.c @@ -195,6 +195,7 @@ static void rtgui_dc_buffer_draw_hline(struct rtgui_dc* self, int x1, int x2, in static void rtgui_dc_buffer_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rect) { + rtgui_color_t foreground; rtgui_rect_t r; struct rtgui_dc_buffer* dc; @@ -204,6 +205,12 @@ static void rtgui_dc_buffer_fill_rect (struct rtgui_dc* self, struct rtgui_rect* if (r.x2 > dc->width) r.x2 = dc->width; if (r.y1 > dc->height) r.y1 = dc->height; if (r.y2 > dc->height) r.y2 = dc->height; + + /* save foreground color */ + foreground = RTGUI_DC_FC(self); + + /* set background color as foreground color */ + RTGUI_DC_FC(self) = RTGUI_DC_BC(self); /* fill first line */ rtgui_dc_buffer_draw_hline(&(dc->parent), r.x1, r.x2, r.y1); @@ -219,6 +226,9 @@ static void rtgui_dc_buffer_fill_rect (struct rtgui_dc* self, struct rtgui_rect* (r.x2 - r.x1) * sizeof(rtgui_color_t)); } } + + /* restore foreground color */ + RTGUI_DC_FC(self) = foreground; } /* blit a dc to a hardware dc */