summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinhard Nißl <rnissl@gmx.de>2007-07-26 21:39:14 +0200
committerReinhard Nißl <rnissl@gmx.de>2007-07-26 21:39:14 +0200
commitd8673e73b3a63bfca56748e02e5a889328c3e702 (patch)
treee3d57ec70226589d51a7cfbd2a4b1e29850b71f5 /src
parent2fe97f44ea7ebc3bcde0f2e108ba94c34a296c47 (diff)
downloadxine-lib-d8673e73b3a63bfca56748e02e5a889328c3e702.tar.gz
xine-lib-d8673e73b3a63bfca56748e02e5a889328c3e702.tar.bz2
clip overlay against sub image when calling XvMCCompositeSubpicture()
Blending functions like _x_blend_xx44() take care to clip the overlay against the destination bitmap. The same clipping must be applied to determine the relevant area in the destination bitmap for the call to XvMCCompositeSubpicture().
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_xxmc.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c
index 1c71bb534..4b926a2f1 100644
--- a/src/video_out/video_out_xxmc.c
+++ b/src/video_out/video_out_xxmc.c
@@ -1500,6 +1500,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen,
} else if (frame->format == XINE_IMGFMT_XXMC) {
if (this->ovl_changed && this->hwSubpictures) {
if (this->new_subpic) {
+ int x0, y0, x1, y1, w, h;
LOCK_AND_SURFACE_VALID( this, frame->xvmc_surf );
if (this->first_overlay) {
memset(this->subImage->data,0,this->subImage->width*
@@ -1510,13 +1511,29 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen,
this->subImage->height, this->subImage->width,
&this->alphablend_extra_data,
&this->palette, (this->subImage->id == FOURCC_IA44));
- XVMCLOCKDISPLAY( this->display );
- XvMCCompositeSubpicture( this->display, this->new_subpic,
- this->subImage,
- overlay->x, overlay->y,overlay->width,
- overlay->height,
- overlay->x, overlay->y);
- XVMCUNLOCKDISPLAY( this->display );
+
+ /* clip overlay against sub image like in _x_blend_xx44() */
+ x0 = overlay->x;
+ y0 = overlay->y;
+ x1 = x0 + overlay->width;
+ y1 = y0 + overlay->height;
+ w = this->subImage->width;
+ h = this->subImage->height;
+
+ x0 = (x0 < 0) ? 0 : ((x0 > w) ? w : x0);
+ y0 = (y0 < 0) ? 0 : ((y0 > h) ? h : y0);
+ x1 = (x1 < 0) ? 0 : ((x1 > w) ? w : x1);
+ y1 = (y1 < 0) ? 0 : ((y1 > h) ? h : y1);
+
+ /* anything left after clipping? */
+ if (x0 != x1 && y0 != y1) {
+ XVMCLOCKDISPLAY( this->display );
+ XvMCCompositeSubpicture( this->display, this->new_subpic,
+ this->subImage,
+ x0, y0, x1 - x0, y1 - y0,
+ x0, y0);
+ XVMCUNLOCKDISPLAY( this->display );
+ }
xvmc_context_reader_unlock( &this->xvmc_lock );
}
}