Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] (PR#3572) unification of put_one_tile_iso
Home

[Freeciv-Dev] (PR#3572) unification of put_one_tile_iso

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#3572) unification of put_one_tile_iso
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Jul 2003 19:02:50 -0700
Reply-to: rt@xxxxxxxxxxxxxx

[jdorje - Sat Mar  1 21:53:11 2003]:

> Just like put_one_tile (the non-iso counterpart), the implementation of 
> put_one_tile_iso is almost identical between all GUIs.  Moreover, the 
> places where it is different are problems for anyone trying to improve 
> on the drawing algorithm.
> 
> This function is by far the most complex single part of the drawing 
> code.  Since it can't easily be split up into smaller parts, unifying it 
> needs to be done all at once and takes a rather large patch. 
> Fortunately, this patch is rather repetitive.
> 
> The attached patch aims to do this.  It moves put_one_tile_iso into 
> mapview_common.  It also removes the gui function gui_map_put_tile_iso 
> as well as the functions put_city_pixmap_draw, put_unit_pixmap_draw, 
> pixmap_put_black_tile_iso, and pixmap_put_tile_iso that are used by most 
> guis.  It introduces new GUI functions gui_start_fog, gui_end_fog, 
> gui_put_sprite_fogged, gui_put_diamond, gui_put_fog, and renames 
> dither_tile as gui_blend_tile_fogged.
> 
> Some additional caveats:
> 
> - Fog has to be handled in a special way, using 
> gui_start_fog/gui_end_fog/gui_put_sprite_fogged.  See the comments in 
> the code.
> 
> - gui-sdl does not use the sprites for city size; it puts this 
> information in the city description.  In future other clients may do 
> this as well.  This behavior is thus configurable via a client option.
> 
> - dither_tiles has been renamed as gui_blend_tile_fogged.  "dither" is 
> renamed as "blend" because it's more accurate (just ask Vasco).  _fogged 
> indicates it uses the fogging from gui_start_fog/gui_end_fog.  Later 
> some more work may be done on this function.
> 
> - Some SDL optimizations have been lost.  In particular, SDL 
> pre-generated the graphics for a full ocean tile and a fogged full ocean 
> tile.  In the future I think this caching should be done at the common 
> drawing level.  Also gui_put_sprite_fogged always specifies the size of 
> the drawing to do, which according to Rafal makes things slower. 
> Previously gui-sdl set a universal clip_rect to limit the area being 
> drawn to; perhaps if all GUIs support such a feature we can use this 
> instead.
> 
> Let me stress again that this is a large patch.  However, the benefits 
> it provides are very high.

The problem with the original patch was that it slowed down gui-sdl
drawing by up to 25%.  This variant of the patch is the exact same
design and code, but gui_map_put_tile_iso has been left in the GUI.  It
is then up to the GUI to call put_one_tile_iso or, in gui-sdl's case, to
do drawing all on its own.

The drawback is that to integrate gui-sdl drawing with that of the other
GUIs will take some design changes.  This patch is just an intermediate
step that makes future changes simpler by cutting out hundreds of lines
of duplicated code (although it does introduce hundreds of lines of
duplicated comments in its place).  It will also have side advantages;
for instance the borders patch will become simpler (and less
error-prone) because drawing algorithm changes will only need to be made
in mapview_common, not in 4 different places.

Unfortunately it has been tested only under GTK and XAW guis.

jason

Attachment: put_one_tile_iso-2.diff
Description: put_one_tile_iso-2.diff


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#3572) unification of put_one_tile_iso, Jason Short <=