[vlc-devel] commit: XCB/X11: fix crop ( Rémi Denis-Courmont )

git version control git at videolan.org
Fri May 8 18:17:27 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri May  8 18:31:52 2009 +0300| [75ff8a59bd60e9065288166ead6b07c353482cca] | committer: Rémi Denis-Courmont 

XCB/X11: fix crop

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

 modules/video_output/xcb/x11.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 8e09880..0c5a123 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -378,17 +378,24 @@ static void Display (vout_thread_t *vout, picture_t *pic)
     if (segment != 0)
         xcb_shm_put_image (p_sys->conn, p_sys->window, p_sys->gc,
           /* real width */ pic->p->i_pitch / pic->p->i_pixel_pitch,
-         /* real height */ pic->p->i_lines, /* x */ 0, /* y */ 0,
-               /* width */ pic->p->i_visible_pitch / pic->p->i_pixel_pitch,
-              /* height */ pic->p->i_visible_lines, /* x */ 0, /* y */ 0,
-                           p_sys->depth, XCB_IMAGE_FORMAT_Z_PIXMAP,
+         /* real height */ pic->p->i_lines,
+                   /* x */ vout->fmt_out.i_x_offset,
+                   /* y */ vout->fmt_out.i_y_offset,
+               /* width */ vout->fmt_out.i_visible_width,
+              /* height */ vout->fmt_out.i_visible_height,
+                           0, 0, p_sys->depth, XCB_IMAGE_FORMAT_Z_PIXMAP,
                            0, segment, 0);
     else
+    {
+        const size_t offset = vout->fmt_out.i_y_offset * pic->p->i_pitch;
+        const unsigned lines = pic->p->i_lines - vout->fmt_out.i_y_offset;
+
         xcb_put_image (p_sys->conn, XCB_IMAGE_FORMAT_Z_PIXMAP,
                        p_sys->window, p_sys->gc,
                        pic->p->i_pitch / pic->p->i_pixel_pitch,
-                       pic->p->i_lines, 0, 0, 0, p_sys->depth,
-                       pic->p->i_pitch * pic->p->i_lines, pic->p->p_pixels);
+                       lines, -vout->fmt_out.i_x_offset, 0, 0, p_sys->depth,
+                       pic->p->i_pitch * lines, pic->p->p_pixels + offset);
+    }
     xcb_flush (p_sys->conn);
 }
 




More information about the vlc-devel mailing list