summaryrefslogtreecommitdiffstats
path: root/video/out/vo_xv.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-17 23:01:33 +0100
committerwm4 <wm4@nowhere>2013-03-17 23:01:33 +0100
commitea03cc67122ad8b47e640c868d108d7531536a21 (patch)
tree8da662b25a7f98273237e3c2edefefafade7284f /video/out/vo_xv.c
parent79d35b8f012a589207e2478394bd6f91928d1349 (diff)
downloadmpv-ea03cc67122ad8b47e640c868d108d7531536a21.tar.bz2
mpv-ea03cc67122ad8b47e640c868d108d7531536a21.tar.xz
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).
Diffstat (limited to 'video/out/vo_xv.c')
-rw-r--r--video/out/vo_xv.c12
1 files changed, 5 insertions, 7 deletions
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);
}