diff options
author | Roland Scheidegger <rscheidegger_lists@hispeed.ch> | 2012-02-18 21:12:34 +0100 |
---|---|---|
committer | Roland Scheidegger <rscheidegger_lists@hispeed.ch> | 2012-02-20 15:24:04 +0100 |
commit | 688c8a54a00b01e73a11970ad2abe858f8c7c5c4 (patch) | |
tree | fcc2cc6d56df1818f01302527534bd7c2908dfd1 /src/r600_textured_videofuncs.c | |
parent | 2778b56252124ef6f636a493d2e1457b43911c37 (diff) |
radeon: avoid rounding errors in texture coords for textured xv
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.
Changed for r100-r600, though only tested on r300.
Diffstat (limited to 'src/r600_textured_videofuncs.c')
-rw-r--r-- | src/r600_textured_videofuncs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c index 986650a4..62da992c 100644 --- a/src/r600_textured_videofuncs.c +++ b/src/r600_textured_videofuncs.c @@ -503,7 +503,7 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) } while (nBox--) { - int srcX, srcY, srcw, srch; + float srcX, srcY, srcw, srch; int dstX, dstY, dstw, dsth; float *vb; @@ -515,13 +515,13 @@ R600DisplayTexturedVideo(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); |