[Freeciv-Dev] (PR#3509) undraw_segment shouldn't use 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#3509) undraw_segment shouldn't use update_map_canvas |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Sun, 23 Feb 2003 02:57:29 -0800 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
In undraw_segment(), in iso-view update_map_canvas() is called on
several tiles; this redraws either a 1x2, 2x1, or 2x2 area. In the most
common case (a diagonal move - most goto routes follow diagonals) it
draws a 2x2 area.
In non-iso mode, two individual refresh_tile_mapcanvas calls are made
(with the possibility for additional calls).
The advantage of using refresh_tile_mapcanvas is that the city
descriptions can easily be redrawn afterwards. In other words, if we
did two refresh_tile_mapcanvas calls for iso-view, we could avoid having
the city descriptions overwritten by goto lines.
The 2x2 redraw means (parts of) 14 different tiles (4 + 10 partials)
must be redrawn; a 2x1 or 1x2 means 10 tiles must be redrawn (2 + 8
partials). A single call to refresh_tile_mapcanvas means parts of 7
tiles must be redrawn. Thus I conclude two tiles to
refresh_tile_mapcanvas are not substantially slower than a single
update_map_canvas (and my tests are consistent with this).
jason
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.32
diff -u -r1.32 mapview_common.c
--- client/mapview_common.c 2003/02/22 02:48:30 1.32
+++ client/mapview_common.c 2003/02/23 10:24:03
@@ -761,16 +761,10 @@
assert(0);
}
- if (is_isometric) {
- /* somewhat inefficient */
- update_map_canvas(MIN(src_x, dest_x), MIN(src_y, dest_y),
- src_x == dest_x ? 1 : 2,
- src_y == dest_y ? 1 : 2,
- TRUE);
- } else {
- refresh_tile_mapcanvas(src_x, src_y, TRUE);
- refresh_tile_mapcanvas(dest_x, dest_y, TRUE);
+ refresh_tile_mapcanvas(src_x, src_y, TRUE);
+ refresh_tile_mapcanvas(dest_x, dest_y, TRUE);
+ if (!is_isometric) {
if (NORMAL_TILE_WIDTH % 2 == 0 || NORMAL_TILE_HEIGHT % 2 == 0) {
if (dir == DIR8_NORTHEAST) {
/* Since the tile doesn't have a middle we draw an extra pixel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#3509) undraw_segment shouldn't use update_map_canvas,
Jason Short <=
|
|