Fixed mouse scaling in canvasrenderer. Fixed a bug where the image data for the cursor not was saved properly. Also cleaned up code a bit
and added comments.