OsmSharp / ui

The UI components.
http://osmsharp.com/
GNU General Public License v2.0
139 stars 91 forks source link

Single rendering thread #273

Closed JoeCooper closed 8 years ago

JoeCooper commented 8 years ago

I was having problems with MapViewSurface and iOS MapView failing to render when appropriate and it was difficult for me to reason about what it was doing so I reorganized the rendering into a rendering loop thread instead of launching multiple render threads which lock and block.

The UI element creates a single rendering thread which performs rendering based on whether or not the rendering is "dirty". TriggerRender now flags the render as "dirty", and the render thread flags it as non-dirty before performing the render. If TriggerRender is called during a render, than the flag will be set to true and another render will occur after the current has finished.

This solved bugs where the map would frequently fail to update, like in the attached screenshots.

Furthermore, LayerMBTile has been modified to make sure the LRUCache is informed about which tiles are going to be used for current view even if the tiles are already present in the cache and do not have to be loaded. This solves a condition where tiles which are needed are dropped during the load to make room for other tiles which are needed, even if the tile cache is large enough to accommodate the load.

device-2015-11-23-134511 device-2015-11-24-103147