From ea03cc67122ad8b47e640c868d108d7531536a21 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 17 Mar 2013 23:01:33 +0100 Subject: x11_common: remove assumption that video is always centered The vo_x11_clearwindow_part() function assumed that the video is always centered. Replace it with a new vo_x11_clear_background() function instead, which essentially does the same as the old function. It takes the video rectangle instead of just the video size, and doesn't have to make the assumption that the video rectangle is centered. Also make vo_x11 use it (seems advantageous). --- video/out/vo_xv.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'video/out/vo_xv.c') diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index 8e2ab5bb68..8ae5a31a9a 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -384,8 +384,7 @@ static int xv_init_colorkey(struct vo *vo) * * Also draws the black bars ( when the video doesn't fit the display in * fullscreen ) separately, so they don't overlap with the video area. */ -static void xv_draw_colorkey(struct vo *vo, int32_t x, int32_t y, - int32_t w, int32_t h) +static void xv_draw_colorkey(struct vo *vo, const struct mp_rect *rc) { struct xvctx *ctx = vo->priv; struct vo_x11_state *x11 = vo->x11; @@ -394,7 +393,8 @@ static void xv_draw_colorkey(struct vo *vo, int32_t x, int32_t y, { //less tearing than XClearWindow() XSetForeground(x11->display, x11->vo_gc, ctx->xv_colorkey); - XFillRectangle(x11->display, x11->window, x11->vo_gc, x, y, w, h); + XFillRectangle(x11->display, x11->window, x11->vo_gc, rc->x0, rc->y0, + rc->x1 - rc->x0, rc->y1 - rc->y0); } } @@ -474,10 +474,8 @@ static void resize(struct vo *vo) vo_get_src_dst_rects(vo, &ctx->src_rect, &ctx->dst_rect, &unused); - struct mp_rect *dst = &ctx->dst_rect; - int dw = dst->x1 - dst->x0, dh = dst->y1 - dst->y0; - vo_x11_clearwindow_part(vo, vo->x11->window, dw, dh); - xv_draw_colorkey(vo, dst->x0, dst->y0, dw, dh); + vo_x11_clear_background(vo, &ctx->dst_rect); + xv_draw_colorkey(vo, &ctx->dst_rect); read_xv_csp(vo); } -- cgit v1.2.3