Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7300) mapview backing store isn't resized correctly
Home

[Freeciv-Dev] (PR#7300) mapview backing store isn't resized correctly

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7300) mapview backing store isn't resized correctly
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Jan 2004 17:28:14 -0800
Reply-to: rt@xxxxxxxxxxx

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

Here's a patch for it.  I didn't touch gui-sdl because I believe resizes
are handled differently there.  All other clients are "fixed".

jason

? data/isotrident/.xvpics
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.187
diff -u -r1.187 mapview.c
--- client/gui-gtk/mapview.c    2004/01/11 17:45:03     1.187
+++ client/gui-gtk/mapview.c    2004/01/28 01:27:32
@@ -507,11 +507,14 @@
 
   gdk_window_get_size(w->window, &width, &height);
 
-  mapview_canvas.width = width;
-  mapview_canvas.height = height;
-
   tile_width=(width+NORMAL_TILE_WIDTH-1)/NORMAL_TILE_WIDTH;
   tile_height=(height+NORMAL_TILE_HEIGHT-1)/NORMAL_TILE_HEIGHT;
+
+  /* Since a resize is only triggered when the tile_*** changes, the canvas
+   * width and height must include the entire backing store - otherwise
+   * small resizings may lead to undrawn tiles. */
+  mapview_canvas.width = tile_width * NORMAL_TILE_WIDTH;
+  mapview_canvas.height = tile_height * NORMAL_TILE_HEIGHT;
 
   map_resized=FALSE;
   if(map_canvas_store_twidth !=tile_width ||
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.85
diff -u -r1.85 mapview.c
--- client/gui-gtk-2.0/mapview.c        2004/01/11 17:45:03     1.85
+++ client/gui-gtk-2.0/mapview.c        2004/01/28 01:27:32
@@ -557,8 +557,11 @@
   tile_width = (ev->width + NORMAL_TILE_WIDTH - 1) / NORMAL_TILE_WIDTH;
   tile_height = (ev->height + NORMAL_TILE_HEIGHT - 1) / NORMAL_TILE_HEIGHT;
 
-  mapview_canvas.width = ev->width;
-  mapview_canvas.height = ev->height;
+  /* Since a resize is only triggered when the tile_*** changes, the canvas
+   * width and height must include the entire backing store - otherwise
+   * small resizings may lead to undrawn tiles. */
+  mapview_canvas.width = tile_width * NORMAL_TILE_WIDTH;
+  mapview_canvas.height = tile_height * NORMAL_TILE_HEIGHT;
 
   if (map_canvas_store_twidth !=tile_width ||
       map_canvas_store_theight!=tile_height) { /* resized? */
Index: client/gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.85
diff -u -r1.85 mapview.c
--- client/gui-win32/mapview.c  2003/12/19 10:39:58     1.85
+++ client/gui-win32/mapview.c  2004/01/28 01:27:33
@@ -105,6 +105,15 @@
   
   map_view_width=(map_win_width+NORMAL_TILE_WIDTH-1)/NORMAL_TILE_WIDTH;
   map_view_height=(map_win_height+NORMAL_TILE_HEIGHT-1)/NORMAL_TILE_HEIGHT; 
+
+  /* Since a resize is only triggered when the tile_*** changes, the canvas
+   * width and height must include the entire backing store - otherwise
+   * small resizings may lead to undrawn tiles.
+   *
+   * HACK: The caller sets map_win_width and it gets changed here. */
+  map_win_width = map_view_width * NORMAL_TILE_WIDTH;
+  map_win_height = map_view_height * NORMAL_TILE_HEIGHT;
+
   update_map_canvas_scrollbars_size();
   if (can_client_change_view() && map_exists()) {
     update_map_canvas_visible();
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.151
diff -u -r1.151 mapview.c
--- client/gui-xaw/mapview.c    2003/11/19 17:30:51     1.151
+++ client/gui-xaw/mapview.c    2004/01/28 01:27:33
@@ -546,11 +546,14 @@
 
   XtVaGetValues(map_canvas, XtNwidth, &width, XtNheight, &height, NULL);
 
-  mapview_canvas.width = width;
-  mapview_canvas.height = height;
+  map_canvas_store_twidth = ((width - 1) / NORMAL_TILE_WIDTH) + 1;
+  map_canvas_store_theight = ((height - 1) / NORMAL_TILE_HEIGHT) +1;
 
-  map_canvas_store_twidth=((width-1)/NORMAL_TILE_WIDTH)+1;
-  map_canvas_store_theight=((height-1)/NORMAL_TILE_HEIGHT)+1;
+  /* Since a resize is only triggered when the tile_*** changes, the canvas
+   * width and height must include the entire backing store - otherwise
+   * small resizings may lead to undrawn tiles. */
+  mapview_canvas.width = tile_width * NORMAL_TILE_WIDTH;
+  mapview_canvas.height = tile_height * NORMAL_TILE_HEIGHT;
 
   map_canvas_store=XCreatePixmap(display, XtWindow(map_canvas),
                                 map_canvas_store_twidth*NORMAL_TILE_WIDTH,

[Prev in Thread] Current Thread [Next in Thread]