Subject: Re: bug#46556: 27.1; transparent images are displayed incorrectly if rotated

From: Eli Zaretskii <[email-masked]>
Date: Wed, 17 Feb 2021 22:26:36 +0200

> Date: Wed, 17 Feb 2021 20:07:27 +0000
> From: Alan Third <[email-masked]>
> 
> In fact, I'm just looking over w32term.c and in the function transform
> there are two equations:
> 
>   pt.x =
>     x0 + (x - x0) * xform->eM11 + (y - y0) * xform->eM21 + xform->eDx + 0.5f;
>   pt.y =
>     y0 + (x - x0) * xform->eM12 + (y - y0) * xform->eM22 + xform->eDy + 0.5f;
> 
> What happens if you remove the +0.5f from them? I'm guessing they're
> there to influence the rounding during conversion from a floating
> point calculation into an integer?

Yes.  Removing them produces worse results.

Anyway, as I said earlier, I stepped through the code, and all the
vertices are computed without any roundoff, exactly as expected.
Moreover, the "good" squares, which have no 1-pixel problem, come out
of that code with exactly the same values as the "bad" one, modulo the
shift in X direction.  The members of xform matrix are also exact,
either zero or +/-1.