[MPlayer-cvslog] r28891 - trunk/libass/ass_render.c

greg subversion at mplayerhq.hu
Sun Mar 8 16:30:27 CET 2009


Author: greg
Date: Sun Mar  8 16:30:27 2009
New Revision: 28891

Log:
Don't assume width == stride for bitmap composition.

Fixes http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1421

Modified:
   trunk/libass/ass_render.c

Modified: trunk/libass/ass_render.c
==============================================================================
--- trunk/libass/ass_render.c	Sun Mar  8 16:20:14 2009	(r28890)
+++ trunk/libass/ass_render.c	Sun Mar  8 16:30:27 2009	(r28891)
@@ -423,10 +423,12 @@ static void render_overlap(ass_image_t**
 	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**
 	// 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<h; y++)
 		for (x=0; x<w; x++) {
-			opos = (old_top+y)*(aw) + (old_left+x);
-			cpos = (cur_top+y)*(bw) + (cur_left+x);
+			opos = (old_top+y)*(as) + (old_left+x);
+			cpos = (cur_top+y)*(bs) + (cur_left+x);
 			m = (a[opos] > b[cpos]) ? a[opos] : b[cpos];
 			(*last_tail)->bitmap[opos] = 0;
 			(*tail)->bitmap[cpos] = m;



More information about the MPlayer-cvslog mailing list