render-cg: fix a bug with unaligned C_INVERT drect()

The alignment optimization would write the edges twice, which is fine
for opaque color fills, but cancels out for C_INVERT.
This commit is contained in:
Lephe 2022-11-16 18:10:22 +01:00
parent 5e35871c98
commit 45fa6c87c2
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 3 additions and 2 deletions

View File

@ -33,8 +33,9 @@ void drect(int x1, int y1, int x2, int y2, int color)
if(color == C_INVERT) for(int h = height; h; h--)
{
base[x1] ^= 0xffff;
base[x2] ^= 0xffff;
/* We can't double-draw on base[x1] and base[x2] here */
if(x1 & 1) base[x1] ^= 0xffff;
if(!(x2 & 1)) base[x2] ^= 0xffff;
for(int w = 0; w < width; w++) v[w] ^= 0xffffffff;
v += 198;
base += 396;