[Freeciv-Dev] (PR#12858) flickering overview
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12858 >
This patch fixes the bug of the flickering overview viewrect. A second
buffer is added in the common code.
-jason
? client/gui-gtk-2.0/diff
Index: client/overview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/overview_common.c,v
retrieving revision 1.2
diff -u -r1.2 overview_common.c
--- client/overview_common.c 21 Apr 2005 02:43:23 -0000 1.2
+++ client/overview_common.c 21 Apr 2005 02:48:05 -0000
@@ -79,21 +79,21 @@
{
struct canvas *dest = get_overview_window();
- if (!dest || !overview.store) {
+ if (!dest || !overview.map) {
return;
}
{
- struct canvas *src = overview.store;
+ struct canvas *src = overview.map, *dst = overview.window;
int x = overview.map_x0 * OVERVIEW_TILE_SIZE;
int y = overview.map_y0 * OVERVIEW_TILE_SIZE;
int ix = overview.width - x;
int iy = overview.height - y;
- canvas_copy(dest, src, 0, 0, ix, iy, x, y);
- canvas_copy(dest, src, 0, y, ix, 0, x, iy);
- canvas_copy(dest, src, x, 0, 0, iy, ix, y);
- canvas_copy(dest, src, x, y, 0, 0, ix, iy);
+ canvas_copy(dst, src, 0, 0, ix, iy, x, y);
+ canvas_copy(dst, src, 0, y, ix, 0, x, iy);
+ canvas_copy(dst, src, x, 0, 0, iy, ix, y);
+ canvas_copy(dst, src, x, y, 0, 0, ix, iy);
}
{
@@ -105,14 +105,17 @@
for (i = 0; i < 4; i++) {
int src_x = x[i];
int src_y = y[i];
- int dest_x = x[(i + 1) % 4];
- int dest_y = y[(i + 1) % 4];
+ int dst_x = x[(i + 1) % 4];
+ int dst_y = y[(i + 1) % 4];
- canvas_put_line(dest, COLOR_STD_WHITE, LINE_NORMAL, src_x, src_y,
- dest_x - src_x, dest_y - src_y);
+ canvas_put_line(overview.window, COLOR_STD_WHITE, LINE_NORMAL,
+ src_x, src_y, dst_x - src_x, dst_y - src_y);
}
}
+ canvas_copy(dest, overview.window,
+ 0, 0, 0, 0, overview.width, overview.height);
+
overview_dirty = FALSE;
}
@@ -242,7 +245,7 @@
if (overview_x > overview.width - OVERVIEW_TILE_WIDTH) {
/* This tile is shown half on the left and half on the right
* side of the overview. So we have to draw it in two parts. */
- canvas_put_rectangle(overview.store,
+ canvas_put_rectangle(overview.map,
overview_tile_color(ptile),
overview_x - overview.width, overview_y,
OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
@@ -253,8 +256,8 @@
overview_x -= OVERVIEW_TILE_SIZE;
}
}
-
- canvas_put_rectangle(overview.store,
+
+ canvas_put_rectangle(overview.map,
overview_tile_color(ptile),
overview_x, overview_y,
OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
@@ -299,11 +302,13 @@
= OVERVIEW_TILE_WIDTH * map.xsize + shift * OVERVIEW_TILE_SIZE;
overview.height = OVERVIEW_TILE_HEIGHT * map.ysize;
- if (overview.store) {
- canvas_free(overview.store);
- }
- overview.store = canvas_create(overview.width, overview.height);
- canvas_put_rectangle(overview.store, COLOR_STD_BLACK,
+ if (overview.map) {
+ canvas_free(overview.map);
+ canvas_free(overview.window);
+ }
+ overview.map = canvas_create(overview.width, overview.height);
+ overview.window = canvas_create(overview.width, overview.height);
+ canvas_put_rectangle(overview.map, COLOR_STD_BLACK,
0, 0, overview.width, overview.height);
update_map_canvas_scrollbars_size();
Index: client/overview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/overview_common.h,v
retrieving revision 1.2
diff -u -r1.2 overview_common.h
--- client/overview_common.h 21 Apr 2005 02:43:23 -0000 1.2
+++ client/overview_common.h 21 Apr 2005 02:48:05 -0000
@@ -23,7 +23,12 @@
/* The following fields are controlled by mapview_common.c. */
int map_x0, map_y0;
int width, height; /* Size in pixels. */
- struct canvas *store;
+
+ /* Holds the map, unwrapped. */
+ struct canvas *map;
+
+ /* A backing store for the window itself, wrapped. */
+ struct canvas *window;
};
extern struct overview overview;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12858) flickering overview,
Jason Short <=
|
|