From af0797010e654110fe61ed1787ba4ef72759d9eb Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 8 Mar 2009 15:30:27 +0000 Subject: [PATCH] Don't assume width == stride for bitmap composition. Fixes http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1421 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28891 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass_render.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index c5824322a3..b46bc9e0f5 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -423,10 +423,12 @@ static void render_overlap(ass_image_t** last_tail, ass_image_t** tail, bitmap_h int ax = (*last_tail)->dst_x; int ay = (*last_tail)->dst_y; int aw = (*last_tail)->w; + int as = (*last_tail)->stride; int ah = (*last_tail)->h; int bx = (*tail)->dst_x; int by = (*tail)->dst_y; int bw = (*tail)->w; + int bs = (*tail)->stride; int bh = (*tail)->h; unsigned char* a; unsigned char* b; @@ -472,16 +474,16 @@ static void render_overlap(ass_image_t** last_tail, ass_image_t** tail, bitmap_h // Allocate new bitmaps and copy over data a = (*last_tail)->bitmap; b = (*tail)->bitmap; - (*last_tail)->bitmap = malloc(aw*ah); - (*tail)->bitmap = malloc(bw*bh); - memcpy((*last_tail)->bitmap, a, aw*ah); - memcpy((*tail)->bitmap, b, bw*bh); + (*last_tail)->bitmap = malloc(as*ah); + (*tail)->bitmap = malloc(bs*bh); + memcpy((*last_tail)->bitmap, a, as*ah); + memcpy((*tail)->bitmap, b, bs*bh); // Composite overlapping area for (y=0; y b[cpos]) ? a[opos] : b[cpos]; (*last_tail)->bitmap[opos] = 0; (*tail)->bitmap[cpos] = m;