[MPlayer-dev-eng] [PATCH] fbdev OSD

Alan Curry pacman at TheWorld.com
Thu Mar 16 10:22:49 CET 2006


On fbdev, OSD is drawn lower than it should be because of a miscalculation of
the y coordinate in draw_alpha. In many cases, it's drawn so low that it's
off the screen. (It might even overwrite memory that doesn't belong to the
framebuffer, if you don't have a lot of extra video memory beyond the end of
the displayed area.)

fb_line_len is a byte count, not a pixel count, so it's not necessary to
multiple the y coordinate by both fb_line_len and fb_pixel_size.

The same bug also appears in draw_slice, but has no visible symptoms since
draw_slice never receives any y value other than 0 (nothing produces sliced
BGR output).

This patch fixes both of them.

Index: libvo/vo_fbdev.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev.c,v
retrieving revision 1.94
diff -u -r1.94 vo_fbdev.c
--- libvo/vo_fbdev.c	4 Mar 2006 20:00:06 -0000	1.94
+++ libvo/vo_fbdev.c	15 Mar 2006 20:35:33 -0000
@@ -1054,7 +1054,7 @@
 {
 	unsigned char *dst;
 
-	dst = center + (fb_line_len * y0 + x0) * fb_pixel_size;
+	dst = center + fb_line_len * y0 + fb_pixel_size * x0;
 
 	(*draw_alpha_p)(w, h, src, srca, stride, dst, fb_line_len);
 }
@@ -1067,7 +1067,7 @@
 	uint8_t *d;
 	uint8_t *s;
 
-	d = center + (fb_line_len * y + x) * fb_pixel_size;
+	d = center + fb_line_len * y + fb_pixel_size * x;
 
 	s = src[0];
 	while (h) {




More information about the MPlayer-dev-eng mailing list