WINTERMUTE: Speed up scale()

This is a tweaked version of a patch from eriktorbjorn.