/************************************************************************** Overview canvas exposed **************************************************************************/ gboolean overview_canvas_expose(GtkWidget *w, GdkEventExpose *ev, gpointer data) { if (!can_client_change_view()) { if (radar_gfx_sprite) { gdk_draw_drawable(overview_canvas->window, civ_gc, radar_gfx_sprite->pixmap, ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.width, ev->area.height); } return TRUE; } refresh_overview_from_canvas(); return TRUE; }
/************************************************************************** Copies the overview image from the backing store to the window and draws the viewrect on top of it. **************************************************************************/ static void redraw_overview(void) { int i, x[4], y[4]; if (!overview.map) { return; } { 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(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); } gui_to_overview_pos(tileset, &x[0], &y[0], mapview.gui_x0, mapview.gui_y0); gui_to_overview_pos(tileset, &x[1], &y[1], mapview.gui_x0 + mapview.width, mapview.gui_y0); gui_to_overview_pos(tileset, &x[2], &y[2], mapview.gui_x0 + mapview.width, mapview.gui_y0 + mapview.height); gui_to_overview_pos(tileset, &x[3], &y[3], mapview.gui_x0, mapview.gui_y0 + mapview.height); for (i = 0; i < 4; i++) { int src_x = x[i]; int src_y = y[i]; int dst_x = x[(i + 1) % 4]; int dst_y = y[(i + 1) % 4]; canvas_put_line(overview.window, get_color(tileset, COLOR_OVERVIEW_VIEWRECT), LINE_NORMAL, src_x, src_y, dst_x - src_x, dst_y - src_y); } refresh_overview_from_canvas(); overview_dirty = FALSE; }
/************************************************************************** ... **************************************************************************/ void overview_canvas_expose(Widget w, XEvent *event, Region exposed, void *client_data) { Dimension height, width; if (!can_client_change_view()) { if (radar_gfx_sprite) { XCopyArea(display, radar_gfx_sprite->pixmap, XtWindow(overview_canvas), civ_gc, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height, event->xexpose.x, event->xexpose.y); } return; } XtVaGetValues(w, XtNheight, &height, XtNwidth, &width, NULL); refresh_overview_from_canvas(); }