[Freeciv-Dev] (PR#8703) design for an error-free mapview
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8703 >
With the recent changes to update_map_canvas I think we are not too far
from having a mapview that is both error-free and reasonably fast.
It's pretty obvious what error-free means. The current mapview is not
error-free. Aside from some miscellaneous bugs (occasional flickering
city names or sprites) there is the problem that city descriptions may
be drawn on top of each other. This isn't correct if the text is
anti-aliased.
Reasonably fast means faster than the current mapview. The current
mapview can easily be made faster; see PR#8603.
A while ago I made a diagram showing the difference between "partial
tile" and "tricky buffered" drawing. Up until now we've done partial
tile drawing only. But this won't work for city descriptions. So to
have things be fully correct we need tricky buffered drawing. This may
or may not invalidate the current need for partial tile drawing.
So my design is this:
- We need two backing stores. One will be the main backing store, the
other a temp store. This allows us to manually enforce a "clip rect"
(which is not portable between GUIs afaik).
- When drawing an area via update_map_canvas, you draw the area onto the
temp buffer. First draw terrain, the way it's done now. Then call
show_city_descriptions(...) to put the city descriptions on top of this
terrain. Finally copy the selected area of the buffer over to the main
backing store.
- show_city_descriptions should therefore take a rectangle over which
you are going to update the descriptions. This is quite easy.
- When update_city_descriptions_visible() is called, you must redraw
everything. This is slow.
- There should be a new function update_city_description(...) which
takes a pointer to a city. Again everything in this area must be
redrawn, but now it's a much smaller area. This function should almost
entirely replace update_city_descriptions_visible().
- When the map origin is changed, we often don't have to call a full
update_map_canvas_visible. Instead we can copy the area that remains in
the mapview (having a second buffer helps here as well) then make one or
two update_map_canvas() calls to redraw the rest of the area. But for
this to work properly update_map_canvas must obey the clip rect it's given.
I'd like to work toward this goal in steps. PR#8603 may be the first
such step.
jason
- [Freeciv-Dev] (PR#8703) design for an error-free mapview,
Jason Short <=
|
|