From a67a0bb60c9f17608fe78467263ef7dbc5b49b0a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Sat, 7 May 2011 14:39:35 +0200 Subject: [PATCH] [g3dvl] using reciprocals for size calc is sometimes not precise enough --- src/gallium/auxiliary/vl/vl_compositor.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index cc257e5614f..74512c1d40a 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -378,16 +378,16 @@ default_rect(struct vl_compositor_layer *layer) } static inline struct vertex2f -calc_topleft(struct vertex2f inv_size, struct pipe_video_rect rect) +calc_topleft(struct vertex2f size, struct pipe_video_rect rect) { - struct vertex2f res = { rect.x * inv_size.x, rect.y * inv_size.y }; + struct vertex2f res = { rect.x / size.x, rect.y / size.y }; return res; } static inline struct vertex2f -calc_bottomright(struct vertex2f inv_size, struct pipe_video_rect rect) +calc_bottomright(struct vertex2f size, struct pipe_video_rect rect) { - struct vertex2f res = { (rect.x + rect.w) * inv_size.x, (rect.y + rect.h) * inv_size.y }; + struct vertex2f res = { (rect.x + rect.w) / size.x, (rect.y + rect.h) / size.y }; return res; } @@ -395,12 +395,12 @@ static inline void calc_src_and_dst(struct vl_compositor_layer *layer, unsigned width, unsigned height, struct pipe_video_rect src, struct pipe_video_rect dst) { - struct vertex2f inv_size = { 1.0f / width, 1.0f / height }; + struct vertex2f size = { width, height }; - layer->src.tl = calc_topleft(inv_size, src); - layer->src.br = calc_bottomright(inv_size, src); - layer->dst.tl = calc_topleft(inv_size, dst); - layer->dst.br = calc_bottomright(inv_size, dst); + layer->src.tl = calc_topleft(size, src); + layer->src.br = calc_bottomright(size, src); + layer->dst.tl = calc_topleft(size, dst); + layer->dst.br = calc_bottomright(size, dst); } static void -- 2.30.2