ratio should be flipped in this case
@fix
/* set height using aspect+width */
if (fw) *ow = ww;
if ((maxw >= 0) && (maxw < *ow)) *ow = maxw;
- *oh = ratio / *ow;
+ *oh = (1 / ratio) * *ow;
/* apply min/max */
if ((maxh >= 0) && (maxh < *oh)) *oh = maxh;
else if ((minh >= 0) && (minh > *oh)) *oh = minh;
/* set height using aspect+width */
if (fw) *ow = ww;
if ((maxw >= 0) && (maxw < *ow)) *ow = maxw;
- *oh = ratio / *ow;
+ *oh = (1 / ratio) * *ow;
/* apply min/max */
if ((maxh >= 0) && (maxh < *oh)) *oh = maxh;
else if ((minh >= 0) && (minh > *oh)) *oh = minh;