Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8733) clear backing store in update_map_canvas
Home

[Freeciv-Dev] (PR#8733) clear backing store in update_map_canvas

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8733) clear backing store in update_map_canvas
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 May 2004 19:33:08 -0700
Reply-to: rt@xxxxxxxxxxx

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

In update_map_canvas_visible, we clear the whole backing store before 
drawing to it.  This avoids some potential bugs with parts of the 
mapview not being updated, as explained in the comment.

This patch moves the clearing into update_map_canvas.  This will fix 
some more of the bugs (when only some tiles are updated).  This wasn't 
possible before because update_map_canvas didn't necessarily draw a 
rectangular area.

jason

? eff
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.114
diff -u -r1.114 mapview_common.c
--- client/mapview_common.c     14 May 2004 02:23:42 -0000      1.114
+++ client/mapview_common.c     14 May 2004 02:29:39 -0000
@@ -1311,6 +1311,18 @@
          "update_map_canvas(pos=(%d,%d), size=(%d,%d))",
          canvas_x, canvas_y, width, height);
 
+  /* Clear the area.  This is necessary since some parts of the rectangle
+   * may not actually have any tiles drawn on them.  This will happen when
+   * the mapview is large enough so that the tile is visible in multiple
+   * locations.  In this case it will only be drawn in one place.
+   *
+   * Of course it's necessary to draw to the whole area to cover up any old
+   * drawing that was done there. */
+  canvas_put_rectangle(mapview_canvas.store, COLOR_STD_BLACK,
+                      canvas_x, canvas_y, width, height);
+
+  /* FIXME: we don't have to draw black (unknown) tiles since they're already
+   * cleared. */
   if (is_isometric) {
     gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
       put_tile_iso(map_x, map_y, draw);
@@ -1349,15 +1361,6 @@
 void update_map_canvas_visible(void)
 {
   dirty_all();
-
-  /* Clear the entire mapview.  This is necessary since if the mapview is
-   * large enough duplicated tiles will not be drawn twice.  Those areas of
-   * the mapview aren't updated at all and can be cluttered with city names
-   * and other junk. */
-  /* FIXME: we don't have to draw black (unknown) tiles since they're already
-   * cleared. */
-  canvas_put_rectangle(mapview_canvas.store, COLOR_STD_BLACK,
-                      0, 0, mapview_canvas.width, mapview_canvas.height);
   update_map_canvas(0, 0, mapview_canvas.width, mapview_canvas.height);
 }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8733) clear backing store in update_map_canvas, Jason Short <=