Letterboxing / scaling helper.
If both new W and H are set, ratio fit is not computed—clear one field.