fix: Round to nearest in the fixed-point `png_muldiv`
In builds without floating point arithmetic, `png_muldiv` rounded the
magnitude of the quotient up whenever the remainder reached half the
divisor rounded down. With an odd divisor, that also rounded up
fractions just below one half, and with a divisor of 1 it moved every
nonzero result one step away from zero.
For example, `png_get_pixel_aspect_ratio_fixed` returned 100001 for
1 by 1 pixels per unit, and 33334 for 3 by 1.
Round the magnitude up only when twice the remainder reaches the
divisor.
This is a cherry-pick of commit 0fdef309cc33a24081943c2ae4096950426e0216
from branch 'libpng18'.
1 file changed