Commit 3434af1e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

wl_shm: remove position offsets

The correct offsets depend on the direction in which the window was
resized. This cannot be guessed from the change of display size.
(For instance, a reduction in width does not indicate whether it was
 from the left or the right of the window.)

So those offset computations are futile - remove them.
If the offsets are really needed, the window will have to provide the
values (in some form).
parent 5c16d654
......@@ -57,8 +57,6 @@ struct vout_display_sys_t
int x;
int y;
bool use_buffer_transform;
video_format_t curr_aspect;
};
static void PictureDestroy(picture_t *pic)
......@@ -222,7 +220,7 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic,
struct wl_buffer *buf = (struct wl_buffer *)pic->p_sys;
wl_buffer_set_user_data(buf, pic);
wl_surface_attach(surface, buf, sys->x, sys->y);
wl_surface_attach(surface, buf, 0, 0);
wl_surface_damage(surface, 0, 0,
vd->cfg->display.width, vd->cfg->display.height);
wl_display_flush(display);
......@@ -283,8 +281,8 @@ static int Control(vout_display_t *vd, int query, va_list ap)
/ src.i_visible_width;
vd->fmt.i_y_offset = src.i_y_offset * place.height
/ src.i_visible_height;
ResetPictures(vd);
sys->curr_aspect = vd->source;
break;
}
......@@ -306,32 +304,24 @@ static int Control(vout_display_t *vd, int query, va_list ap)
cfg = va_arg(ap, const vout_display_cfg_t *);
}
vout_display_place_t place;
vout_display_PlacePicture(&place, &sys->curr_aspect, vd->cfg, false);
sys->x += place.width / 2;
sys->y += place.height / 2;
vout_display_PlacePicture(&place, &vd->source, cfg, false);
sys->x -= place.width / 2;
sys->y -= place.height / 2;
if (sys->viewport != NULL)
{
video_format_t fmt;
vout_display_place_t place;
video_format_ApplyRotation(&fmt, &vd->source);
vout_display_PlacePicture(&place, &vd->source, cfg, false);
wp_viewport_set_source(sys->viewport,
wl_fixed_from_int(fmt.i_x_offset),
wl_fixed_from_int(fmt.i_y_offset),
wl_fixed_from_int(fmt.i_visible_width),
wl_fixed_from_int(fmt.i_visible_height));
wp_viewport_set_destination(sys->viewport,
place.width, place.height);
place.width, place.height);
}
else
vout_display_SendEventPicturesInvalid(vd);
sys->curr_aspect = vd->source;
break;
}
default:
......@@ -466,8 +456,6 @@ static int Open(vlc_object_t *obj)
video_format_ApplyRotation(&vd->fmt, &fmt);
}
sys->curr_aspect = vd->source;
vd->fmt.i_chroma = VLC_CODEC_RGB32;
vd->info.has_pictures_invalid = sys->viewport == NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment