Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] (PR#4670) mapview_common: base_refresh_overview_canvas
Home

[Freeciv-Dev] (PR#4670) mapview_common: base_refresh_overview_canvas

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#4670) mapview_common: base_refresh_overview_canvas
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jul 2003 10:38:26 -0700
Reply-to: rt@xxxxxxxxxxxxxx

The attached patch adds a new function, base_refresh_overview_canvas, to 
mapview_common.  It is called from GTK, GTK2, XAW, and Win32 clients. 
Tested under GTK only.

jason

Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.53
diff -u -r1.53 mapview_common.c
--- client/mapview_common.c     2003/07/23 13:46:01     1.53
+++ client/mapview_common.c     2003/07/24 17:37:09
@@ -1374,3 +1374,19 @@
   *base_overview_x = map_x * OVERVIEW_TILE_WIDTH;
   *base_overview_y = map_y * OVERVIEW_TILE_HEIGHT;
 }
+
+/**************************************************************************
+  Redraw the entire backing store for the overview minimap.
+**************************************************************************/
+void base_refresh_overview_canvas(struct canvas_store *pbacking_store)
+{
+  whole_map_iterate(x, y) {
+    int gui_x, gui_y;
+
+    map_to_base_overview_pos(&gui_x, &gui_y, x, y);
+
+    gui_put_rectangle(pbacking_store, overview_tile_color(x, y),
+                     gui_x, gui_y,
+                     OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
+  } whole_map_iterate_end;
+}
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.36
diff -u -r1.36 mapview_common.h
--- client/mapview_common.h     2003/07/23 13:46:01     1.36
+++ client/mapview_common.h     2003/07/24 17:37:09
@@ -190,6 +190,8 @@
 void map_to_base_overview_pos(int *base_overview_x, int *base_overview_y,
                              int map_x, int map_y);
 
+void base_refresh_overview_canvas(struct canvas_store *pbacking_store);
+
 void get_mapview_corners(int overview_x_array[4], int overview_y_array[4]);
 
 extern int map_overview_x0;
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.177
diff -u -r1.177 mapview.c
--- client/gui-gtk/mapview.c    2003/07/23 13:46:01     1.177
+++ client/gui-gtk/mapview.c    2003/07/24 17:37:09
@@ -428,18 +428,9 @@
 **************************************************************************/
 void refresh_overview_canvas(void)
 {
-  whole_map_iterate(x, y) {
-    int gui_x, gui_y;
+  struct canvas_store store = {overview_canvas_store};
 
-    map_to_base_overview_pos(&gui_x, &gui_y, x, y);
-
-    set_overview_tile_foreground_color(x, y);
-    gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE,
-                      gui_x, gui_y,
-                      OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
-  } whole_map_iterate_end;
-
-  gdk_gc_set_foreground( fill_bg_gc, colors_standard[COLOR_STD_BLACK] );
+  base_refresh_overview_canvas(&store);
 }
 
 
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.71
diff -u -r1.71 mapview.c
--- client/gui-gtk-2.0/mapview.c        2003/07/23 13:46:02     1.71
+++ client/gui-gtk-2.0/mapview.c        2003/07/24 17:37:10
@@ -476,18 +476,9 @@
 **************************************************************************/
 void refresh_overview_canvas(void)
 {
-  whole_map_iterate(x, y) {
-    int gui_x, gui_y;
+  struct canvas_store store = {overview_canvas_store};
 
-    map_to_base_overview_pos(&gui_x, &gui_y, x, y);
-
-    set_overview_tile_foreground_color(x, y);
-    gdk_draw_rectangle(overview_canvas_store, fill_bg_gc, TRUE,
-                      gui_x, gui_y,
-                      OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
-  } whole_map_iterate_end;
-
-  gdk_gc_set_foreground(fill_bg_gc, colors_standard[COLOR_STD_BLACK]);
+  base_refresh_overview_canvas(&store);
 }
 
 
Index: client/gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.76
diff -u -r1.76 mapview.c
--- client/gui-win32/mapview.c  2003/07/23 13:46:02     1.76
+++ client/gui-win32/mapview.c  2003/07/24 17:37:10
@@ -883,31 +883,9 @@
 void
 refresh_overview_canvas(void)
 {
-  HDC hdc=GetDC(root_window);
-  int overview_x, overview_y;
-  RECT rc;
+  struct canvas_store store = {overviewstoredc};
 
-  whole_map_iterate(x, y) {
-    int gui_x, gui_y;
-
-    map_to_base_overview_pos(&gui_x, &gui_y, x, y);
-
-    rc.left = gui_x;
-    rc.right = rc.left + OVERVIEW_TILE_WIDTH;
-    rc.top = gui_y;
-    rc.bottom = rc.top + OVERVIEW_TILE_HEIGHT;
-    FillRect(overviewstoredc, &rc, brush_std[overview_tile_color(x, y)]);
-
-    map_to_overview_pos(&overview_x, &overview_y, x, y);
-
-    rc.left = overview_win_x + overview_x;
-    rc.right = rc.left + OVERVIEW_TILE_WIDTH;
-    rc.top = overview_win_y + overview_y;
-    rc.bottom = rc.top + OVERVIEW_TILE_HEIGHT;
-    FillRect(hdc, &rc, brush_std[overview_tile_color(x, y)]);
-  } whole_map_iterate_end;
-
-  ReleaseDC(root_window,hdc);
+  base_refresh_overview_canvas(&store);
 }
 
 /**************************************************************************
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.144
diff -u -r1.144 mapview.c
--- client/gui-xaw/mapview.c    2003/07/23 13:46:03     1.144
+++ client/gui-xaw/mapview.c    2003/07/24 17:37:10
@@ -400,18 +400,9 @@
 **************************************************************************/
 void refresh_overview_canvas(void)
 {
-  whole_map_iterate(x, y) {
-    int gui_x, gui_y;
+  struct canvas_store store = {overview_canvas_store};
 
-    map_to_base_overview_pos(&gui_x, &gui_y, x, y);
-
-    set_overview_tile_foreground_color(x, y);
-    XFillRectangle(display, overview_canvas_store, fill_bg_gc,
-                  gui_x, gui_y,
-                  OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
-  } whole_map_iterate_end;
-
-  XSetForeground(display, fill_bg_gc, 0);
+  base_refresh_overview_canvas(&store);
 }
 
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#4670) mapview_common: base_refresh_overview_canvas, Jason Short <=