Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8790) remove mapview_canvas.single_tile
Home

[Freeciv-Dev] (PR#8790) remove mapview_canvas.single_tile

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8790) remove mapview_canvas.single_tile
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 May 2004 18:40:59 -0700
Reply-to: rt@xxxxxxxxxxx

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

Since there is a tmp buffer store for the mapview canvas, there is no 
need for the single_tile buffer.

The main advantage of removing it is that it had to be allocated 
separately from the main buffer store since its size depended on the 
tileset.

jason

? eff
? flags
? data/flags
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.118
diff -u -r1.118 mapview_common.c
--- client/mapview_common.c     21 May 2004 00:22:43 -0000      1.118
+++ client/mapview_common.c     21 May 2004 01:32:49 -0000
@@ -1672,8 +1672,8 @@
       && map_to_canvas_pos(&canvas_x, &canvas_y,
                           losing_unit->x, losing_unit->y)) {
     refresh_tile_mapcanvas(losing_unit->x, losing_unit->y, FALSE);
-    canvas_copy(mapview_canvas.single_tile, mapview_canvas.store,
-               canvas_x, canvas_y, 0, 0,
+    canvas_copy(mapview_canvas.tmp_store, mapview_canvas.store,
+               canvas_x, canvas_y, canvas_x, canvas_y,
                NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
 
     for (i = 0; i < num_tiles_explode_unit; i++) {
@@ -1685,8 +1685,8 @@
       /* We first draw the explosion onto the unit and draw draw the
        * complete thing onto the map canvas window. This avoids
        * flickering. */
-      canvas_copy(mapview_canvas.store, mapview_canvas.single_tile,
-                 0, 0, canvas_x, canvas_y,
+      canvas_copy(mapview_canvas.store, mapview_canvas.tmp_store,
+                 canvas_x, canvas_y, canvas_x, canvas_y,
                  NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
       canvas_put_sprite_full(mapview_canvas.store,
                             canvas_x + NORMAL_TILE_WIDTH / 2 - w / 2,
@@ -1769,9 +1769,10 @@
       new_x = start_x + canvas_dx * (mytime / timing_sec);
       new_y = start_y + canvas_dy * (mytime / timing_sec);
 
-      /* Backup the canvas store to the single_tile canvas. */
-      canvas_copy(mapview_canvas.single_tile, mapview_canvas.store,
-                 new_x, new_y, 0, 0, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+      /* Backup the canvas store to the temp store. */
+      canvas_copy(mapview_canvas.tmp_store, mapview_canvas.store,
+                 new_x, new_y, new_x, new_y,
+                 UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
 
       /* Draw */
       put_unit_full(punit, mapview_canvas.store, new_x, new_y);
@@ -1782,8 +1783,9 @@
       gui_flush();
 
       /* Restore the backup.  It won't take effect until the next flush. */
-      canvas_copy(mapview_canvas.store, mapview_canvas.single_tile,
-                 0, 0, new_x, new_y, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+      canvas_copy(mapview_canvas.store, mapview_canvas.tmp_store,
+                 new_x, new_y, new_x, new_y,
+                 UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
       dirty_rect(new_x, new_y, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
     } while (mytime < timing_sec);
   }
@@ -2275,10 +2277,4 @@
 **************************************************************************/
 void init_mapcanvas_and_overview(void)
 {
-  /* This function used to allocate dummy values for the mapview and
-   * overview canvas.  This shouldn't be needed by any clients, and caused
-   * a bug in some clients (gtk2) because this init function may actually
-   * be called _after_ the first call to map_canvas_resized. */
-  mapview_canvas.single_tile
-    = canvas_create(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
 }
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.63
diff -u -r1.63 mapview_common.h
--- client/mapview_common.h     21 May 2004 00:22:43 -0000      1.63
+++ client/mapview_common.h     21 May 2004 01:32:49 -0000
@@ -28,7 +28,7 @@
   int width, height;           /* Size in pixels. */
   int tile_width, tile_height; /* Size in tiles. Rounded up. */
   int store_width, store_height;
-  struct canvas *store, *tmp_store, *single_tile;
+  struct canvas *store, *tmp_store;
 };
 
 /* Holds all information about the overview aka minimap. */
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.167
diff -u -r1.167 tilespec.c
--- client/tilespec.c   5 May 2004 20:39:15 -0000       1.167
+++ client/tilespec.c   21 May 2004 01:32:50 -0000
@@ -409,9 +409,6 @@
    *
    * Do any necessary redraws.
    */
-  canvas_free(mapview_canvas.single_tile);
-  mapview_canvas.single_tile
-    = canvas_create(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
   if (state < CLIENT_GAME_RUNNING_STATE) {
     /* Unless the client state is playing a game or in gameover,
        we don't want/need to redraw. */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8790) remove mapview_canvas.single_tile, Jason Short <=