linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbcon: Console Rotation - Fix wrong shift calculation
@ 2005-11-19  1:47 Antonino A. Daplas
  0 siblings, 0 replies; only message in thread
From: Antonino A. Daplas @ 2005-11-19  1:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fbdev-devel

The shift value (amount to shift the bitmap so first pixel starts at
origin(0,0)) is incorrect. This causes corrupted characters or a kernel
crash if fontwidth is not divisible by 8 at 270 degrees, or fontheight
not divisible by 8 at 180 degrees.

Report and part of the fix contributed by Knut Petersen.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
---

 drivers/video/console/fbcon_rotate.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h
index 90c6720..e504fbf 100644
--- a/drivers/video/console/fbcon_rotate.h
+++ b/drivers/video/console/fbcon_rotate.h
@@ -49,7 +49,7 @@ static inline void pattern_set_bit(u32 x
 static inline void rotate_ud(const char *in, char *out, u32 width, u32 height)
 {
 	int i, j;
-	int shift = width % 8;
+	int shift = (8 - (width % 8)) & 7;
 
 	width = (width + 7) & ~7;
 
@@ -85,7 +85,7 @@ static inline void rotate_cw(const char 
 static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height)
 {
 	int i, j, h = height, w = width;
-	int shift = width % 8;
+	int shift = (8 - (width % 8)) & 7;
 
 	width = (width + 7) & ~7;
 	height = (height + 7) & ~7;




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-19  2:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-19  1:47 [PATCH] fbcon: Console Rotation - Fix wrong shift calculation Antonino A. Daplas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).