diff options
author | Matthias Dahl <matt2000@users.sourceforge.net> | 2001-11-03 13:57:34 +0000 |
---|---|---|
committer | Matthias Dahl <matt2000@users.sourceforge.net> | 2001-11-03 13:57:34 +0000 |
commit | a1e1a6edcb9b7a82bfc2c4aa6a34cf2f761698a5 (patch) | |
tree | 8f4c77230419c02a448607715e63b744ac546704 /src/video_out/alphablend.c | |
parent | fb9dd420fe74f1c6a9664ac9e3467d9a10192a98 (diff) | |
download | xine-lib-a1e1a6edcb9b7a82bfc2c4aa6a34cf2f761698a5.tar.gz xine-lib-a1e1a6edcb9b7a82bfc2c4aa6a34cf2f761698a5.tar.bz2 |
Fixed a bad bug in the new SyncFB plugin that caused it to crash easily. And
finally added overlay blending support. Also cleaned up the alphablend
header file and added new blend_yuv function that uses the vo_frame_t struct
for its blending.
CVS patchset: 934
CVS date: 2001/11/03 13:57:34
Diffstat (limited to 'src/video_out/alphablend.c')
-rw-r--r-- | src/video_out/alphablend.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/video_out/alphablend.c b/src/video_out/alphablend.c index a10c64a6d..635fd8c8a 100644 --- a/src/video_out/alphablend.c +++ b/src/video_out/alphablend.c @@ -383,3 +383,71 @@ void blend_yuv (uint8_t * dst_img, vo_overlay_t * img_overl, } } } + +void blend_yuv_vo_frame(vo_frame_t* dst_img, vo_overlay_t* img_overl) +{ + clut_t *my_clut; + uint8_t *my_trans; + + int src_width = img_overl->width; + int src_height = img_overl->height; + rle_elem_t *rle = img_overl->rle; + rle_elem_t *rle_limit = rle + img_overl->num_rle; + int x_off = img_overl->x; + int y_off = img_overl->y; + int mask; + int x, y; + + uint8_t *dst_y = dst_img->base[0] + dst_img->width * y_off + x_off; + uint8_t *dst_cr = dst_img->base[1] + (y_off / 2) * (dst_img->width / 2) + (x_off / 2) + 1; + uint8_t *dst_cb = dst_img->base[2] + (y_off / 2) * (dst_img->width / 2) + (x_off / 2) + 1; + + my_clut = (clut_t*) img_overl->color; + my_trans = img_overl->trans; + + for (y = 0; y < src_height; y++) { + mask = !(img_overl->clip_top > y || img_overl->clip_bottom < y); + + for (x = 0; x < src_width;) { + uint8_t clr; + uint16_t o; + + clr = rle->color; + o = my_trans[clr]; + + /* These three lines assume that menu buttons are "clean" separated + * and do not overlap with the button clip borders */ + if (o) if (img_overl->clip_left > x || + img_overl->clip_right < x) + o = 0; + + if (o && mask) { + if (o >= 15) { + memset(dst_y + x, my_clut[clr].y, rle->len); + if (y & 1) { + memset(dst_cr + (x >> 1), my_clut[clr].cr, rle->len >> 1); + memset(dst_cb + (x >> 1), my_clut[clr].cb, rle->len >> 1); + } + } else { + mem_blend8(dst_y + x, my_clut[clr].y, o, rle->len); + if (y & 1) { + mem_blend8(dst_cr + (x >> 1), my_clut[clr].cr, o, rle->len >> 1); + mem_blend8(dst_cb + (x >> 1), my_clut[clr].cb, o, rle->len >> 1); + } + } + } + + x += rle->len; + rle++; + if (rle >= rle_limit) break; + } + if (rle >= rle_limit) break; + + dst_y += dst_img->width; + + if (y & 1) { + dst_cr += (dst_img->width + 1) / 2; + dst_cb += (dst_img->width + 1) / 2; + } + } +} |