From b440fc981e5d8297e5af83b7cebf70d757dc04fb Mon Sep 17 00:00:00 2001 From: "iamyhw@gmail.com" Date: Wed, 27 Jun 2012 03:03:44 +0000 Subject: [PATCH] beautify the focused rectangle. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2191 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/rtgui/common/dc.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/components/rtgui/common/dc.c b/components/rtgui/common/dc.c index 9979668c66..fa8b85225a 100644 --- a/components/rtgui/common/dc.c +++ b/components/rtgui/common/dc.c @@ -248,18 +248,22 @@ void rtgui_dc_draw_shaded_rect(struct rtgui_dc* dc, rtgui_rect_t* rect, void rtgui_dc_draw_focus_rect(struct rtgui_dc* dc, rtgui_rect_t* rect) { - int i; + int x,y; - for (i = rect->x1; i < rect->x2; i += 2) + for (x=rect->x1; xx2-1; x++) { - rtgui_dc_draw_point(dc, i, rect->y1); - rtgui_dc_draw_point(dc, i, rect->y2 - 1); + if ((x+rect->y1)&0x01) + rtgui_dc_draw_point(dc, x, rect->y1); + if ((x+rect->y2-1)&0x01) + rtgui_dc_draw_point(dc, x, rect->y2-1); } - for (i = rect->y1; i < rect->y2; i += 2) + for (y=rect->y1; yy2; y++) { - rtgui_dc_draw_point(dc, rect->x1, i); - rtgui_dc_draw_point(dc, rect->x2 - 1, i); + if ((rect->x1+y)&0x01) + rtgui_dc_draw_point(dc, rect->x1, y); + if ((rect->x2-1+y)&0x01) + rtgui_dc_draw_point(dc, rect->x2-1, y); } }