This patch allows barebox to properly load and display BMP files of any arbitrary size that are generated by most common image editing packages (e.g. Microsoft Paint, GIMP, etc). The standard Microsoft BMP format always packs each line of data to a 32-bit boundary (which means from 0-3 bytes may be unused at the end of each line). Without this patch, any BMP image with a width that does not result in a fully packed 32-bit data field at the end of each line will be displayed incorrectly. Signed-off-by: Michael Burkey <mdburkey at gmail.com> --- diff -rupN a/lib/gui/bmp.c b/lib/gui/bmp.c --- a/lib/gui/bmp.c 2014-05-05 04:33:13.000000000 -0400 +++ b/lib/gui/bmp.c 2014-05-08 13:48:17.448986921 -0400 @@ -77,7 +77,7 @@ static int bmp_renderer(struct screen *s for (y = 0; y < height; y++) { image = (char *)bmp + le32_to_cpu(bmp->header.data_offset); - image += (img->height - y - 1) * img->width * (bits_per_pixel >> 3); + image += (img->height - y - 1) * (((img->width * bits_per_pixel + 31) >> 5) << 2); adr = buf + (y + starty) * sc->info.line_length + startx * (sc->info.bits_per_pixel >> 3); for (x = 0; x < width; x++) { @@ -99,7 +99,7 @@ static int bmp_renderer(struct screen *s for (y = 0; y < height; y++) { image = (char *)bmp + le32_to_cpu(bmp->header.data_offset); - image += (img->height - y - 1) * img->width * (bits_per_pixel >> 3); + image += (img->height - y - 1) * (((img->width * bits_per_pixel + 31) >> 5) << 2); adr = buf + (y + starty) * sc->info.line_length + startx * (sc->info.bits_per_pixel >> 3); for (x = 0; x < width; x++) { _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox