From 15f8b6aaa9c6fd0c93accb819023cbb7d65c555c Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 13 May 2014 15:16:19 +0300 Subject: Factorize rle uncompression code from raw, vaapi and opengl2 drivers. Fix highlight area and buffer overflows. --- src/video_out/video_out_vaapi.c | 51 ++++------------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) (limited to 'src/video_out/video_out_vaapi.c') diff --git a/src/video_out/video_out_vaapi.c b/src/video_out/video_out_vaapi.c index af759c2ff..823d0fc5a 100644 --- a/src/video_out/video_out_vaapi.c +++ b/src/video_out/video_out_vaapi.c @@ -2717,7 +2717,6 @@ static void vaapi_overlay_end (vo_driver_t *this_gen, vo_frame_t *frame_gen) { for (i = 0; i < novls; ++i) { vo_overlay_t *ovl = this->overlays[i]; uint32_t *bitmap = NULL; - uint32_t *rgba = NULL; if (ovl->rle) { if(ovl->width<=0 || ovl->height<=0) @@ -2726,52 +2725,10 @@ static void vaapi_overlay_end (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if (!ovl->rgb_clut || !ovl->hili_rgb_clut) _x_overlay_clut_yuv2rgb (ovl); - bitmap = rgba = calloc(ovl->width * ovl->height * 4, sizeof(uint32_t)); - - int num_rle = ovl->num_rle; - rle_elem_t *rle = ovl->rle; - uint32_t red, green, blue, alpha; - clut_t *low_colors = (clut_t*)ovl->color; - clut_t *hili_colors = (clut_t*)ovl->hili_color; - uint8_t *low_trans = ovl->trans; - uint8_t *hili_trans = ovl->hili_trans; - clut_t *colors; - uint8_t *trans; - int rlelen = 0; - uint8_t clr = 0; - int i, pos=0, x, y; - - while (num_rle > 0) { - x = pos % ovl->width; - y = pos / ovl->width; - - if ( (x>=ovl->hili_left && x<=ovl->hili_right) && (y>=ovl->hili_top && y<=ovl->hili_bottom) ) { - colors = hili_colors; - trans = hili_trans; - } - else { - colors = low_colors; - trans = low_trans; - } - rlelen = rle->len; - clr = rle->color; - for ( i=0; iwidth * ovl->height * sizeof(uint32_t)); + + _x_overlay_to_argb32(ovl, bitmap, ovl->width, "BGRA"); + lprintf("width %d height %d pos %d %d\n", ovl->width, ovl->height, pos, ovl->width * ovl->height); } else { pthread_mutex_lock(&ovl->argb_layer->mutex); -- cgit v1.2.3