[Freeciv-Dev] Re: GTK client draws more slowly than it needs to (PR#899)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Apologies butting in without having looked at the code, but please hear me
through..
I think it is clear that the GTK client strolls alot slower than it should
do, but I would be surprised if creating a tile-cache as has been described
would actually solve the problem or actually make much difference.
I would suggest solving it something like this:
Create an offscreen image whose size is the size of the map window rounded
up to the nearest tile.
Use this image as a circular buffer. I.e. when the map scrolls the only
tiles that are redrawn are the newly exposed tiles. Suppose that the buffer
is 4 tiles wide and 3 tiles high, and is currently at the origin, the
coordinates of the tiles on the buffer would be:
0A,1A,2A,3A
0B,1B,2B,3B
0C,1C,2C,3C
now suppose that it scrolls to the east by 2 tiles north by 1 tile, buffer
is updated to:
4D,5D,2D,3D
4B,5B,2B,3B
4C,5C,2C,3C
the buffer then drawn onto the mapwindow in 4 blits:
4D,5D;
2D,3D;
4B,5B
4C,5C;
2B,3B
2C,3C
If you us this technique and there are no problems elsewhere in the code, I
see no good reason at all for any sluggishness. Afterall, todays computers
can run quake, so should be able to scroll a 2D map!
I am sorry I am not able to submit a patch myself. It would be fairly
straight forward to do. I am half way through doing exactly the same thing
for the project I work on: the java client for freerails. If anyone's
interested in trying on the GTK client, I can point out my java
implementation and answer any questions if it would be help.
regards,
Luke Lindsay
- [Freeciv-Dev] Re: GTK client draws more slowly than it needs to (PR#899),
Luke Lindsay <=
|
|