diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c index 4bd5b1dfbf0..6935d371412 100644 --- a/src/gallium/auxiliary/vl/vl_compositor_cs.c +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c @@ -669,7 +669,7 @@ calc_proj(struct vl_compositor_layer *layer, struct pipe_resource *texture, float m[2][4]) { - enum vl_compositor_mirror mirror = layer->mirror; + unsigned mirror = layer->mirror; float ratio_x = (float)texture->width0 / layer->sampler_views[0]->texture->width0; float ratio_y = (float)texture->height0 / layer->sampler_views[0]->texture->height0; float width = layer->sampler_views[0]->texture->width0; @@ -689,14 +689,16 @@ calc_proj(struct vl_compositor_layer *layer, m[1][2] = texture->height0; width = layer->sampler_views[0]->texture->height0; height = layer->sampler_views[0]->texture->width0; + if (mirror != VL_COMPOSITOR_MIRROR_NONE) + mirror = ~mirror; break; case VL_COMPOSITOR_ROTATE_180: m[0][0] = 1.0; m[1][1] = 1.0; - if (mirror != VL_COMPOSITOR_MIRROR_VERTICAL) - mirror = VL_COMPOSITOR_MIRROR_VERTICAL; + if (mirror == VL_COMPOSITOR_MIRROR_NONE) + mirror = VL_COMPOSITOR_MIRROR_HORIZONTAL | VL_COMPOSITOR_MIRROR_VERTICAL; else - mirror = VL_COMPOSITOR_MIRROR_HORIZONTAL; + mirror = ~mirror; break; case VL_COMPOSITOR_ROTATE_270: m[0][1] = -1.0; @@ -704,23 +706,21 @@ calc_proj(struct vl_compositor_layer *layer, m[0][2] = texture->width0; width = layer->sampler_views[0]->texture->height0; height = layer->sampler_views[0]->texture->width0; + if (mirror != VL_COMPOSITOR_MIRROR_NONE) + mirror = ~mirror; break; } - switch (mirror) { - default: - case VL_COMPOSITOR_MIRROR_NONE: - break; - case VL_COMPOSITOR_MIRROR_HORIZONTAL: + if (mirror & VL_COMPOSITOR_MIRROR_HORIZONTAL) { m[0][0] *= -1; m[0][1] *= -1; m[0][2] = texture->width0 - m[0][2]; - break; - case VL_COMPOSITOR_MIRROR_VERTICAL: + } + + if (mirror & VL_COMPOSITOR_MIRROR_VERTICAL) { m[1][0] *= -1; m[1][1] *= -1; m[1][2] = texture->height0 - m[1][2]; - break; } float scale_x = (width * (layer->src.br.x - layer->src.tl.x)) / layer->viewport.scale[0];