diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-06-02 19:12:01 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-06-02 19:12:01 +0300 |
commit | 80be936a56199f7affddef546514604dcefcb763 (patch) | |
tree | ead37c819dad115446817aea7b78c53cee584735 /libvo/vo_xv.c | |
parent | ed1a1e28d89e9ab63e886adda18f0b8ccfec9356 (diff) | |
parent | 1cbf1ec46835300d1226068487b90476aff73ce8 (diff) | |
download | mpv-80be936a56199f7affddef546514604dcefcb763.tar.bz2 mpv-80be936a56199f7affddef546514604dcefcb763.tar.xz |
Merge svn changes up to r31303
Diffstat (limited to 'libvo/vo_xv.c')
-rw-r--r-- | libvo/vo_xv.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 49ff146ba0..0dbc600847 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -119,14 +119,24 @@ struct xvctx { static void allocate_xvimage(struct vo *, int); +static void fixup_osd_position(struct vo *vo, int *x0, int *y0, int *w, int *h) +{ + struct xvctx *ctx = vo->priv; + *x0 += ctx->image_width * (vo->panscan_x >> 1) + / (vo->dwidth + vo->panscan_x); + *w = av_clip(*w, 0, ctx->image_width); + *h = av_clip(*h, 0, ctx->image_height); + *x0 = FFMIN(*x0, ctx->image_width - *w); + *y0 = FFMIN(*y0, ctx->image_height - *h); +} + static void draw_alpha_yv12(void *p, int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) { struct vo *vo = p; struct xvctx *ctx = vo->priv; - x0 += ctx->image_width * (vo->panscan_x >> 1) - / (vo->dwidth + vo->panscan_x); + fixup_osd_position(vo, &x0, &y0, &w, &h); vo_draw_alpha_yv12(w, h, src, srca, stride, ctx->xvimage[ctx->current_buf]->data + ctx->xvimage[ctx->current_buf]->offsets[0] + @@ -141,8 +151,7 @@ static void draw_alpha_yuy2(void *p, int x0, int y0, int w, int h, { struct vo *vo = p; struct xvctx *ctx = vo->priv; - x0 += ctx->image_width * (vo->panscan_x >> 1) - / (vo->dwidth + vo->panscan_x); + fixup_osd_position(vo, &x0, &y0, &w, &h); vo_draw_alpha_yuy2(w, h, src, srca, stride, ctx->xvimage[ctx->current_buf]->data + ctx->xvimage[ctx->current_buf]->offsets[0] + @@ -157,8 +166,7 @@ static void draw_alpha_uyvy(void *p, int x0, int y0, int w, int h, { struct vo *vo = p; struct xvctx *ctx = vo->priv; - x0 += ctx->image_width * (vo->panscan_x >> 1) - / (vo->dwidth + vo->panscan_x); + fixup_osd_position(vo, &x0, &y0, &w, &h); vo_draw_alpha_yuy2(w, h, src, srca, stride, ctx->xvimage[ctx->current_buf]->data + ctx->xvimage[ctx->current_buf]->offsets[0] + |