gallium/auxiliary/vl: fix scale and translate parameters

Fixes the scale and translate portion of the code to allow for
scale and crop to work properly.

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Tested-by: Marcus Seyfarth <m.seyfarth@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19915>
This commit is contained in:
Thong Thai 2022-11-21 19:21:30 -05:00 committed by Marge Bot
parent d4f759fefb
commit 4c46e4a5da

View file

@ -670,8 +670,8 @@ set_viewport(struct vl_compositor_state *s,
*ptr_int++ = drawn->area.y0;
*ptr_int++ = drawn->area.x1;
*ptr_int++ = drawn->area.y1;
*ptr_int++ = drawn->translate_x;
*ptr_int++ = drawn->translate_y;
*ptr_int++ = -drawn->translate_x;
*ptr_int++ = -drawn->translate_y;
ptr_float = (float *)ptr_int;
*ptr_float++ = drawn->sampler0_w;
@ -711,15 +711,14 @@ draw_layers(struct vl_compositor *c,
drawn.area = calc_drawn_area(s, layer);
drawn.scale_x = layer->viewport.scale[0] /
(float)layer->sampler_views[0]->texture->width0 *
(layer->src.br.x - layer->src.tl.x);
((float)layer->sampler_views[0]->texture->width0 *
(layer->src.br.x - layer->src.tl.x));
drawn.scale_y = layer->viewport.scale[1] /
((float)layer->sampler_views[0]->texture->height0 *
(s->interlaced ? 2.0 : 1.0) *
(layer->src.br.y - layer->src.tl.y));
drawn.translate_x = (int)layer->viewport.translate[0];
drawn.translate_y = (int)layer->viewport.translate[1];
drawn.translate_x = (int)(layer->src.tl.x * layer->sampler_views[0]->texture->width0);
drawn.translate_y = (int)(layer->src.tl.y * layer->sampler_views[0]->texture->height0);
drawn.sampler0_w = (float)layer->sampler_views[0]->texture->width0;
drawn.sampler0_h = (float)layer->sampler_views[0]->texture->height0;
set_viewport(s, &drawn, samplers);