Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f837e6f7 authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds
Browse files

[PATCH] fbdev: Fix logo rotation if width != height



Logo drawing crashes or produces a corrupt display if the logo width and
height are not equal.  The dimensions are transposed prior to the actual
rotation and the width is used instead of the height in the actual rotation
code.  These produce a corrupt image.

Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4efefd1d
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -334,11 +334,11 @@ static void fb_rotate_logo_ud(const u8 *in, u8 *out, u32 width, u32 height)


static void fb_rotate_logo_cw(const u8 *in, u8 *out, u32 width, u32 height)
static void fb_rotate_logo_cw(const u8 *in, u8 *out, u32 width, u32 height)
{
{
	int i, j, w = width - 1;
	int i, j, h = height - 1;


	for (i = 0; i < height; i++)
	for (i = 0; i < height; i++)
		for (j = 0; j < width; j++)
		for (j = 0; j < width; j++)
			out[height * j + w - i] = *in++;
				out[height * j + h - i] = *in++;
}
}


static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height)
static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height)
@@ -356,24 +356,24 @@ static void fb_rotate_logo(struct fb_info *info, u8 *dst,
	u32 tmp;
	u32 tmp;


	if (rotate == FB_ROTATE_UD) {
	if (rotate == FB_ROTATE_UD) {
		image->dx = info->var.xres - image->width;
		image->dy = info->var.yres - image->height;
		fb_rotate_logo_ud(image->data, dst, image->width,
		fb_rotate_logo_ud(image->data, dst, image->width,
				  image->height);
				  image->height);
		image->dx = info->var.xres - image->width;
		image->dy = info->var.yres - image->height;
	} else if (rotate == FB_ROTATE_CW) {
	} else if (rotate == FB_ROTATE_CW) {
		tmp = image->width;
		image->width = image->height;
		image->height = tmp;
		image->dx = info->var.xres - image->height;
		fb_rotate_logo_cw(image->data, dst, image->width,
		fb_rotate_logo_cw(image->data, dst, image->width,
				  image->height);
				  image->height);
	} else if (rotate == FB_ROTATE_CCW) {
		tmp = image->width;
		tmp = image->width;
		image->width = image->height;
		image->width = image->height;
		image->height = tmp;
		image->height = tmp;
		image->dy = info->var.yres - image->width;
		image->dx = info->var.xres - image->width;
	} else if (rotate == FB_ROTATE_CCW) {
		fb_rotate_logo_ccw(image->data, dst, image->width,
		fb_rotate_logo_ccw(image->data, dst, image->width,
				   image->height);
				   image->height);
		tmp = image->width;
		image->width = image->height;
		image->height = tmp;
		image->dy = info->var.yres - image->height;
	}
	}


	image->data = dst;
	image->data = dst;