zeta243 / osmdroid

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

Limit invalidate calls for drawing compass in MyLocationOverlay #334

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Every time the compass gets a new bearing, the MyLocationOverlay throws a full 
invalidate() call. This happens often enough that it causes the maps to 
*constantly* redraw. This causes a constant high CPU usage.

I discuss this as a larger problem in Ticket 211, but the compass drawing is 
the worst offender and we really should fix that if nothing else.

Attached is a patch that does this. The patch works, but I'm a little shady on 
the calculations I used to get the invalidation area. I had to use 
trial-and-error and the mechanics seem reasonable, but I'm not particularly 
familiar with the combination of matrix operations used in the drawing for the 
compass so having someone validate it would be nice.

After a short period of review, I expect to commit this early next week.

Original issue reported on code.google.com by kurtzm...@gmail.com on 6 Apr 2012 at 7:42

GoogleCodeExporter commented 8 years ago

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

GoogleCodeExporter commented 8 years ago
Patch attached.

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

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry - to be clear, this patch will limit the compass's invalidate() call to 
just the dirty Rect, not the entire screen.

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

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r1121.

Original comment by kurtzm...@gmail.com on 13 Sep 2012 at 9:15