[vlc-commits] wl_shm: remove position offsets

Rémi Denis-Courmont git at videolan.org
Sun May 20 21:52:08 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 20 22:36:36 2018 +0300| [3434af1e9788c8974ef8e7c920ef1c545099f610] | committer: 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).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3434af1e9788c8974ef8e7c920ef1c545099f610
---

 modules/video_output/wayland/shm.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index e3919f2d3c..3e80a5d194 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -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;



More information about the vlc-commits mailing list