Esempio n. 1
0
/**************************************************************************
  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;
}
Esempio n. 2
0
/**************************************************************************
  Copies the current centred image + viewrect unchanged to the client's
  overview window (for expose events etc).
**************************************************************************/
void refresh_overview_from_canvas(void)
{
  struct canvas *dest = get_overview_window();
  if (!dest) {
    return;
  }
  canvas_copy(dest, overview.window,
              0, 0, 0, 0, overview.width, overview.height);
}
Esempio n. 3
0
// Updates displayCanvas, which is backed by bufferData, after a data operation
JNIEXPORT void JNICALL Java_net_hackcasual_freeciv_NativeHarness_reloadMap
  (JNIEnv *je, jobject o) {
	LOGI("reloadMap displayCanvas %p data %p", displayCanvas, displayCanvas->data);
	canvas_copy(displayCanvas, mapview.store, 0, 0, 0, 0, displayCanvas->width, displayCanvas->height);

}