remove unused code
Revert "remove unused code"

This reverts commit 2d283c17e17940c356af0cc1366b714e0d7b76be.
change rounding used for convert Rect from canvas to window coordinates
remove unused code
tweak rectangle bounding box computation