diff options
author | Roland Scheidegger <rscheidegger_lists@hispeed.ch> | 2012-05-11 05:25:33 +0200 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2012-05-11 01:08:54 -0400 |
commit | 37786e9027b8c8d1f9ec9928915784dd28853766 (patch) | |
tree | a2df45cfee890a0335deccbfc097c3756b61b5f0 | |
parent | faea3aafa8c9a7c1bc866ffcd847972c5569c8bc (diff) |
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...
-rw-r--r-- | src/evergreen_textured_videofuncs.c | 10 |
1 files 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); |