moagrius / TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
MIT License
1.46k stars 337 forks source link

Fix #301 #450

Closed p-lr closed 6 years ago

p-lr commented 6 years ago

This fixes the missing tiles issue i could reproduce.

There is only one change : modifying the fast-fail test in TileCanvasViewGroup.requestRender() and removing all boilerplate code related to mLastRenderedDetailLevel.

The explanation of this change is, from the tests i run, when we have missing tiles after a quick zooming out, we can observe the following :

A high amount of request render are kicked in TileCanvasViewGroup.requestRender() which is based on a throttle logic. Those requests which usually pass through this enable the launch of new tile decoding with the TileRenderPoolExecutor, in the beginRenderTask. So since no new task are sent to the executor, the rendering mechanism is broken. The addition of the mTilesInCurrentViewport.size() > 0 in the fast-fail test enables the last request render to not fast-fail and trigger the missing render.

As for the removing of the mLastRenderedDetailLevel, there are two reasons :

moagrius commented 6 years ago

@peterLaurence this is in 2.2.8, which is now live on bintray - maybe it's just me, but does this seem to affect performance for you at all? seems a bit more sticky/jumpy, but then again i'm not often on this machine and haven't run the test app for a while...

bb-juliogarcia commented 6 years ago

Thanks @peterLaurence & @moagrius for taking the time to look into this. I pulled this version into our app, and the blank tiles issue seems to be gone. However, I ran it on a Nexus 5X and also noticed the stickiness and jumpiness that @moagrius observed. @peterLaurence is this happening for you?

p-lr commented 6 years ago

@moagrius @bb-juliogarcia This is strange because i dont have this issue on my side (even on emulator). Although i just made a fresh install on my old Nexus 5, and the first time i started the sample activity it was sticky/bumpy. Then i stopped the activity and restarted, and it was running smoothly.. strange. I will try to see if its due to my change, or if it only happens after a fresh install of the app (which could be the case since the java runtime can "learn" from previous executions).

EDIT : after some more tests, could not reproduce even on my old device. I haven't used my nexus 5 for a while, so maybe the cpu was not fully ready when i first tested the app.

Can you confirm on your side?

bb-juliogarcia commented 6 years ago

Same thing happened for me actually, the performance is fine now. Thanks for your work! @peterLaurence

p-lr commented 6 years ago

Maybe it's worth noticing that the new android profiler in Android Studio 3.0.1 affects the performance of the app, which is not a big surprise since it goes much deeper into execution analysis.

moagrius commented 6 years ago

interesting, and gtk