From 37786e9027b8c8d1f9ec9928915784dd28853766 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 11 May 2012 05:25:33 +0200 Subject: radeon: avoid rounding errors in texture coords for textured xv on EG+ make sure the division is done with floats, otherwise the coordinate can be wrong up to 1 texel. Particularly visible with clipping and small source scaled up (since one texel can be a shift of several pixels) but could be seen even unscaled. Should provide more accurate coords without clipping too depending on the scale factor probably. This is a straight port of 688c8a54a00b01e73a11970ad2abe858f8c7c5c4 when I apparently forgot the eg code... --- src/evergreen_textured_videofuncs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/evergreen_textured_videofuncs.c b/src/evergreen_textured_videofuncs.c index 8ca8e627..fe86e898 100644 --- a/src/evergreen_textured_videofuncs.c +++ b/src/evergreen_textured_videofuncs.c @@ -508,7 +508,7 @@ EVERGREENDisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) } while (nBox--) { - int srcX, srcY, srcw, srch; + float srcX, srcY, srcw, srch; int dstX, dstY, dstw, dsth; float *vb; @@ -520,13 +520,13 @@ EVERGREENDisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) srcX = pPriv->src_x; srcX += ((pBox->x1 - pPriv->drw_x) * - pPriv->src_w) / pPriv->dst_w; + pPriv->src_w) / (float)pPriv->dst_w; srcY = pPriv->src_y; srcY += ((pBox->y1 - pPriv->drw_y) * - pPriv->src_h) / pPriv->dst_h; + pPriv->src_h) / (float)pPriv->dst_h; - srcw = (pPriv->src_w * dstw) / pPriv->dst_w; - srch = (pPriv->src_h * dsth) / pPriv->dst_h; + srcw = (pPriv->src_w * dstw) / (float)pPriv->dst_w; + srch = (pPriv->src_h * dsth) / (float)pPriv->dst_h; vb = radeon_vbo_space(pScrn, &accel_state->vbo, 16); -- cgit v1.2.3