[josm-dev] Painting (was: how does the transition to tested work ?)

Jiri Klement jiri.klement at gmail.com
Tue Mar 9 18:34:06 GMT 2010


> Maybe a rework of the painting code could make it faster, as well.
> Currently for each "rubber-band" line a full repaint of the entire map
> is done. There is no caching, it just draws each object of each layer
> for every mouse move event.
...
> I think we should cache all static data (osm objects, gpx layers, photo
> layer, ...) in a static cache that has to be marked as "dirty" if a
> repaint is needed. (E.g. when an object was deleted or layer visibility
> was toggled)

I think mappaint consume most of the painting time so it should be
enough to cache OsmDataLayer. It would be also nice to have code for
painting normal and selected/highligted primitives separated so there
can be buffer of static data which will be repainted only when dataset
is changed.

> Repainting is especially annoying when zooming and panning in a large
> dataset. For zooming there is not much we can do about it, but for
> panning it might be possible to reuse parts of the buffer by translating
> it accordingly.

One of the reason why painting appears slow is the fact that it's done
in EDT thread. I think there should be special thread for painting.
EDT will only send request to repaint and copy offscreen buffer to
screen when it's ready. Painting thread will wait for repaint
requests. When request arrives it will start painting immediately. If
another request arrives during painting, it will wait. If there are
multiple repaint request after painting is finished, only the last one
will be processed.

> __
>
> Sebastian
>
> _______________________________________________
> josm-dev mailing list
> josm-dev at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/josm-dev
>




More information about the josm-dev mailing list