PATRIK27 / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

More conservative screen invalidation #211

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Looking at osmdroid performance, the majority of CPU cycles are taken up by 
doing screen drawing. This is to be expected since drawing is an expensive 
operation. We are very liberal in our invalidation calls - when something on 
the screen is updated, we call a full invalidate() on the screen which causes a 
*full* redraw of everything including all tiles which is another very expensive 
operation. This is exasperated by the MyLocationOverlay which updates the 
screen constantly.

We could improve performance by being more conservative in how we invalidate 
the screen. For example, the compass is constantly changing and that causes a 
full screen redraw instead of just invalidating the small area where the 
compass exists.

I would propose the following:

1. Provide a way to invalidate only a portion of the screen (which I think is 
just a change in the invalidate method we call).

2. Change the MyLocationOverlay to limit the area we invalidate to the compass 
area, and if intersecting with the clipping area, the "my location" icon.

3. Before drawing an icon in the ItemizedOverlay, check to make sure it 
intersects the clipping area. If not, don't bother drawing.  (does this 
actually make things faster, or is Android smart enough to ignore drawing calls 
outside the clipping area?)

Thoughts?

Original issue reported on code.google.com by kurtzm...@gmail.com on 13 May 2011 at 5:27

GoogleCodeExporter commented 8 years ago
4. When a tile arrives from one of the modular providers (for example, when a 
tile is downloaded), rather than invalidating the screen only invalidate the 
area of the screen the tile should be located.

Original comment by kurtzm...@gmail.com on 13 May 2011 at 5:28

GoogleCodeExporter commented 8 years ago
lol... and I meant "exacerbated"

Original comment by kurtzm...@gmail.com on 13 May 2011 at 5:29

GoogleCodeExporter commented 8 years ago

Original comment by kurtzm...@gmail.com on 6 Apr 2012 at 7:42