Fixed potential overflow bug

Closes https://github.com/PistonDevelopers/rust-graphics/issues/510
Merge pull request #514 from bvssvni/master

Fixed potential overflow bug