Change the size calculation, improving upscaling.

The IPU documentation has an algorithm that makes 4:1 upscaling (for example, 80x60 to 320x240) miss 3 pixels at the right and bottom, so the target size is 317x237. This algorithm makes the resizing be exact according to the fraction.