I created an sample app like you provided but don't allow user to change the orientation. So the scanRect always is Zero.  I had to use the below code changes as a workaround, but i'm not sure it is proper way. 