diff options
author | Christian König <[email protected]> | 2011-05-07 14:39:35 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-05-07 14:39:35 +0200 |
commit | a67a0bb60c9f17608fe78467263ef7dbc5b49b0a (patch) | |
tree | a4caa9c69a0a743fc376a51c72758cb14cfbd735 | |
parent | 213b9004a6ee033a16af3dcd187aa68b56c39858 (diff) |
[g3dvl] using reciprocals for size calc is sometimes not precise enough
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.c | 18 |
1 files 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 |