diff options
author | George Matsumura <gmmatsumura01@bvsd.org> | 2019-12-24 06:12:01 +0000 |
---|---|---|
committer | George Matsumura <gmmatsumura01@bvsd.org> | 2021-04-22 09:54:06 -0600 |
commit | fbe3995a27bdd81701dbb3b5e26556a00cfdf1d3 (patch) | |
tree | 5e30616ab9e80cc0ff6a38d64584cb946063623f | |
parent | 37498721a520cd1cff367bc36b1ac74b343826ca (diff) |
Fix compositing rotation
This corrects the composite operation's interpretation of a
source picture transformation matrix indicating rotation,
correcting a previous behavior where the source image was simply
flipped and not rotated. This is done by using a transformed vector
for each vertex of the source rectangle, instead of just two at
each of the diagonally opposed corner vertices.
-rw-r--r-- | src/atimach64render.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/atimach64render.c b/src/atimach64render.c index 8d259fa..39d0c5b 100644 --- a/src/atimach64render.c +++ b/src/atimach64render.c @@ -814,8 +814,12 @@ Mach64Composite float ooa; CARD32 col; PictVector v; - int srcXend, srcYend; + struct vertcoords { + int x; + int y; + } srcvert[4]; float dxy = 0.0, dwh = 0.0; + int i; ATIDRISync(pScreenInfo); @@ -830,22 +834,23 @@ Mach64Composite } /* Handle transform */ - srcXend = srcX + w; - srcYend = srcY + h; + srcvert[0].x = srcX; + srcvert[0].y = srcY; + srcvert[1].x = srcX + w; + srcvert[1].y = srcY; + srcvert[2].x = srcX + w; + srcvert[2].y = srcY + h; + srcvert[3].x = srcX; + srcvert[3].y = srcY + h; if (m3d->transform) { - v.vector[0] = IntToxFixed(srcX); - v.vector[1] = IntToxFixed(srcY); - v.vector[2] = xFixed1; - PictureTransformPoint(m3d->transform, &v); - srcX = xFixedToInt(v.vector[0]); - srcY = xFixedToInt(v.vector[1]); - - v.vector[0] = IntToxFixed(srcXend); - v.vector[1] = IntToxFixed(srcYend); - v.vector[2] = xFixed1; - PictureTransformPoint(m3d->transform, &v); - srcXend = xFixedToInt(v.vector[0]); - srcYend = xFixedToInt(v.vector[1]); + for (i = 0; i < 4; i++) { + v.vector[0] = IntToxFixed(srcvert[i].x); + v.vector[1] = IntToxFixed(srcvert[i].y); + v.vector[2] = xFixed1; + PictureTransformPoint(m3d->transform, &v); + srcvert[i].x = xFixedToInt(v.vector[0]); + srcvert[i].y = xFixedToInt(v.vector[1]); + } #if 0 /* Bilinear needs manipulation of texture coordinates */ @@ -857,10 +862,10 @@ Mach64Composite } /* Create vertices in clock-wise order */ - VTX_SET(v0, col, dstX, dstY, srcX, dxy, srcY, dxy); - VTX_SET(v1, col, dstX + w, dstY, srcXend, dwh, srcY, dxy); - VTX_SET(v2, col, dstX + w, dstY + h, srcXend, dwh, srcYend, dwh); - VTX_SET(v3, col, dstX, dstY + h, srcX, dxy, srcYend, dwh); + VTX_SET(v0, col, dstX, dstY, srcvert[0].x, dxy, srcvert[0].y, dxy); + VTX_SET(v1, col, dstX + w, dstY, srcvert[1].x, dwh, srcvert[1].y, dxy); + VTX_SET(v2, col, dstX + w, dstY + h, srcvert[2].x, dwh, srcvert[2].y, dwh); + VTX_SET(v3, col, dstX, dstY + h, srcvert[3].x, dxy, srcvert[3].y, dwh); /* Setup upper triangle (v0, v1, v3) */ VTX_OUT(v0, 1); |