From: Christian König Date: Sat, 7 May 2011 12:39:35 +0000 (+0200) Subject: [g3dvl] using reciprocals for size calc is sometimes not precise enough X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a67a0bb60c9f17608fe78467263ef7dbc5b49b0a;p=mesa.git [g3dvl] using reciprocals for size calc is sometimes not precise enough --- 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