Re: [Freeciv-Dev] Patch: Displaying the map as a grid
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 9 Mar 1999, Rizos Sakellariou wrote:
> for(y=tile_y; y<tile_y+height; y++)
> - for(x=tile_x; x<tile_x+width; x++)
> + for(x=tile_x; x<tile_x+width; x++) {
> pixmap_put_tile(map_canvas_store, x, y,
> (map_view_x0+x)%map.xsize, map_view_y0+y, 0);
> + if (map_draw_grid) {
> + XSetForeground(display, fill_bg_gc,
> colors_standard[COLOR_STD_BLACK]);
> + XDrawRectangle(display, map_canvas_store, fill_bg_gc,
> + x*NORMAL_TILE_WIDTH, y*NORMAL_TILE_HEIGHT,
> + NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
> + }
> + }
This is a terribly inefficient way of drawing the grid. Changing GC
attributes is an expensive X operation. You should just set the GC once
before drawing, and then not change it. It would also be more efficient to
just draw x + y lines instead of x*y rectangles (= 4*x*y lines).
|
|