Fixed drawing issues when zoomed.

Fixes #652.

I finally found a fix to most of the issues. This will require some testing as I am not sure if i picked up every issue and I am away for a little while. The main issue was due to chris using a slightly different calculations for RLE sprites and bitmap sprites. I've also fixed a small memory leak that was happening due to the clip dpi function. I've noticed that viewports are leaking memory might be worthwhile investigating it (At least i think its a memory leak I'm noticing the amount of RAM being used is increasing rapidly when more viewports are open and it does not reduce when they close.