Forráskód Böngészése

beautify the focused rectangle.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2191 bbd45198-f89e-11dd-88c7-29a3b14d5316
iamyhw@gmail.com 13 éve
szülő
commit
b440fc981e
1 módosított fájl, 11 hozzáadás és 7 törlés
  1. 11 7
      components/rtgui/common/dc.c

+ 11 - 7
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; x<rect->x2-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; y<rect->y2; 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);
 	}
 }