Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10815) Draw selection rectangle using faster gdk_draw_
Home

[Freeciv-Dev] (PR#10815) Draw selection rectangle using faster gdk_draw_

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10815) Draw selection rectangle using faster gdk_draw_lines function
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Sun, 31 Oct 2004 19:38:47 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10815 >

What the title says.


Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.146
diff -u -u -r1.146 mapview.c
--- client/gui-gtk-2.0/mapview.c        23 Oct 2004 20:15:19 -0000      1.146
+++ client/gui-gtk-2.0/mapview.c        1 Nov 2004 03:37:11 -0000
@@ -1009,17 +1009,26 @@
 **************************************************************************/
 void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
 {
+  GdkPoint points[5];
+
   gdk_gc_set_foreground(civ_gc, colors_standard[COLOR_STD_YELLOW]);
 
   /* gdk_draw_rectangle() must start top-left.. */
-  gdk_draw_line(map_canvas->window, civ_gc,
-            canvas_x, canvas_y, canvas_x + w, canvas_y);
-  gdk_draw_line(map_canvas->window, civ_gc,
-            canvas_x, canvas_y, canvas_x, canvas_y + h);
-  gdk_draw_line(map_canvas->window, civ_gc,
-            canvas_x, canvas_y + h, canvas_x + w, canvas_y + h);
-  gdk_draw_line(map_canvas->window, civ_gc,
-            canvas_x + w, canvas_y, canvas_x + w, canvas_y + h);
+  points[0].x = canvas_x;
+  points[0].y = canvas_y;
+
+  points[1].x = canvas_x + w;
+  points[1].y = canvas_y;
+
+  points[2].x = canvas_x + w;
+  points[2].y = canvas_y + h;
+
+  points[3].x = canvas_x;
+  points[3].y = canvas_y + h;
+
+  points[4].x = canvas_x;
+  points[4].y = canvas_y;
+  gdk_draw_lines(map_canvas->window, civ_gc, points, ARRAY_SIZE(points));
 
   rectangle_active = TRUE;
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10815) Draw selection rectangle using faster gdk_draw_lines function, Vasco Alexandre da Silva Costa <=