From: Thomas Hellstrom Date: Sat, 13 Mar 2010 19:25:29 +0000 (+0100) Subject: st/xorg: Fix Xv cliprect scaling. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7356d1c140f2989df9e8645cf4b85962f27d0fca;p=mesa.git st/xorg: Fix Xv cliprect scaling. Due to a quantization error, different cliprects of scaled video windows may not have identical x / y scale. Signed-off-by: Thomas Hellstrom --- diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index d4a3faf8aed..92f1cc50653 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -601,7 +601,7 @@ void renderer_copy_pixmap(struct xorg_renderer *r, void renderer_draw_yuv(struct xorg_renderer *r, - int src_x, int src_y, int src_w, int src_h, + float src_x, float src_y, float src_w, float src_h, int dst_x, int dst_y, int dst_w, int dst_h, struct pipe_resource **textures) { diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 0454a6513d4..fb09fabe156 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -54,7 +54,7 @@ void renderer_set_constants(struct xorg_renderer *r, void renderer_draw_yuv(struct xorg_renderer *r, - int src_x, int src_y, int src_w, int src_h, + float src_x, float src_y, float src_w, float src_h, int dst_x, int dst_y, int dst_w, int dst_h, struct pipe_resource **textures); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index a221594454e..f98bd939010 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -413,7 +413,7 @@ setup_fs_video_constants(struct xorg_renderer *r, boolean hdtv) static void draw_yuv(struct xorg_xv_port_priv *port, - int src_x, int src_y, int src_w, int src_h, + float src_x, float src_y, float src_w, float src_h, int dst_x, int dst_y, int dst_w, int dst_h) { struct pipe_resource **textures = port->yuv[port->current_set]; @@ -562,10 +562,10 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, int box_y2 = pbox->y2; float diff_x = (float)src_w / (float)dst_w; float diff_y = (float)src_h / (float)dst_h; - int offset_x = box_x1 - dstX + pPixmap->screen_x; - int offset_y = box_y1 - dstY + pPixmap->screen_y; - int offset_w; - int offset_h; + float offset_x = box_x1 - dstX + pPixmap->screen_x; + float offset_y = box_y1 - dstY + pPixmap->screen_y; + float offset_w; + float offset_h; x = box_x1; y = box_y1; @@ -576,8 +576,8 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, offset_h = dst_h - h; draw_yuv(pPriv, - src_x + offset_x*diff_x, src_y + offset_y*diff_y, - src_w - offset_w*diff_x, src_h - offset_h*diff_y, + (float) src_x + offset_x*diff_x, (float) src_y + offset_y*diff_y, + (float) src_w - offset_w*diff_x, (float) src_h - offset_h*diff_y, x, y, w, h); pbox++;