Merge "Optimise the hit test algorithm" into pi-dev