How do I scale one rectangle to the maximum size possible within another rectangle?
scale = min(dst.width/src.width, dst.height/src.height) This is your approach but written more cleanly. To use this, the scaled rectangle would have the shape: width = src.width * scale height = src.height * scale