[vlc-devel] [PATCH v2 14/19] xcb: use the placed picture dimensions from the core

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 25 16:20:27 CEST 2020


---
 modules/video_output/xcb/render.c | 11 +++++------
 modules/video_output/xcb/x11.c    | 22 ++++++++++------------
 2 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/modules/video_output/xcb/render.c b/modules/video_output/xcb/render.c
index cb80d3e8f92..07ab5285d8d 100644
--- a/modules/video_output/xcb/render.c
+++ b/modules/video_output/xcb/render.c
@@ -72,7 +72,6 @@ struct vout_display_sys_t {
     xcb_window_t root;
     char *filter;
 
-    vout_display_place_t place;
     int32_t src_x;
     int32_t src_y;
     vlc_fourcc_t spu_chromas[2];
@@ -115,7 +114,7 @@ static void RenderRegion(vout_display_t *vd, const subpicture_t *subpic,
 {
     vout_display_sys_t *sys = vd->sys;
     xcb_connection_t *conn = sys->conn;
-    const vout_display_place_t *place = &sys->place;
+    const vout_display_place_t *place = vd->place;
     picture_t *pic = reg->p_picture;
     unsigned sw = reg->fmt.i_width;
     unsigned sh = reg->fmt.i_height;
@@ -186,6 +185,7 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic,
     const video_format_t *fmt = &vd->source;
     vout_display_sys_t *sys = vd->sys;
     xcb_connection_t *conn = sys->conn;
+    const vout_display_place_t *place = vd->place;
 
     size_t offset = PictureAttach(vd, pic);
     if (offset != (size_t)-1) {
@@ -223,8 +223,8 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic,
     xcb_render_composite(conn, XCB_RENDER_PICT_OP_SRC,
                          sys->picture.crop, XCB_RENDER_PICTURE_NONE,
                          sys->picture.scale, sys->src_x, sys->src_y, 0, 0,
-                         sys->place.x, sys->place.y,
-                         sys->place.width, sys->place.height);
+                         place->x, place->y,
+                         place->width, place->height);
     if (offset != (size_t)-1)
         PictureDetach(vd);
 
@@ -280,8 +280,7 @@ static void CreateBuffers(vout_display_t *vd)
     xcb_render_create_picture(conn, sys->picture.scale, sys->drawable.scale,
                               sys->format.argb, 0, NULL);
 
-    vout_display_place_t *place = &sys->place;
-    vout_display_PlacePicture(place, fmt, vd->cfg, VOUT_ORIGIN_TOP_LEFT);
+    const vout_display_place_t *place = vd->place;
 
     /* Homogeneous coordinates transform from destination(place)
      * to source(fmt) */
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 068622d091a..d36fa149b63 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -146,18 +146,16 @@ static int Control(vout_display_t *vd, int query, va_list ap)
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     {
         video_format_t src, *fmt = &sys->fmt;
-        vout_display_place_t place;
+        const vout_display_place_t *place = vd->place;
         int ret = VLC_SUCCESS;
 
-        vout_display_PlacePicture(&place, &vd->source, vd->cfg, VOUT_ORIGIN_TOP_LEFT);
-
         uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y;
         const uint32_t values[] = {
-            place.x, place.y, place.width, place.height
+            place->x, place->y, place->width, place->height
         };
 
-        if (place.width  != sys->fmt.i_visible_width
-         || place.height != sys->fmt.i_visible_height)
+        if (place->width  != sys->fmt.i_visible_width
+         || place->height != sys->fmt.i_visible_height)
         {
             mask |= XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
             ret = VLC_EGENERIC;
@@ -167,13 +165,13 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         xcb_configure_window(sys->conn, sys->window, mask, values);
 
         video_format_ApplyRotation(&src, &vd->source);
-        fmt->i_width  = src.i_width  * place.width / src.i_visible_width;
-        fmt->i_height = src.i_height * place.height / src.i_visible_height;
+        fmt->i_width  = src.i_width  * place->width / src.i_visible_width;
+        fmt->i_height = src.i_height * place->height / src.i_visible_height;
 
-        fmt->i_visible_width  = place.width;
-        fmt->i_visible_height = place.height;
-        fmt->i_x_offset = src.i_x_offset * place.width / src.i_visible_width;
-        fmt->i_y_offset = src.i_y_offset * place.height / src.i_visible_height;
+        fmt->i_visible_width  = place->width;
+        fmt->i_visible_height = place->height;
+        fmt->i_x_offset = src.i_x_offset * place->width / src.i_visible_width;
+        fmt->i_y_offset = src.i_y_offset * place->height / src.i_visible_height;
 
         return ret;
     }
-- 
2.26.2



More information about the vlc-devel mailing list