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

From: Alan Third <[email-masked]>
Date: Wed, 17 Feb 2021 21:08:14 +0000

On Wed, Feb 17, 2021 at 10:26:36PM +0200, Eli Zaretskii wrote:
> > 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.

I've found a couple of references to PlgBlt being buggy when rotating
by 180 degrees. Since the values are correct I'm afraid I can't think
of any other explanation.

I can't find any information on this alleged bug. The solution
suggested by one person [1] is to rotate by some slightly different
value, but that is clearly not acceptable here.

I'm sorry I'm not being much help here.

[1] https://www.vbforums.com/showthread.php?863459-PlgBlt-weirdness-or-a-bug&p=5295829&viewfull=1#post5295829

-- 
Alan Third