From 330676491faa397ef2b3935027ce53867d341bc8 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 23 Jan 2011 16:24:52 +0000 Subject: Simplify x0/x1 calculation for iPod Color some more, and fix display on type 0 LCD (iPod Photo). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29120 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/ipod/lcd-color_nano.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/target/arm/ipod/lcd-color_nano.c b/firmware/target/arm/ipod/lcd-color_nano.c index a331b98c88..d7e3beb197 100644 --- a/firmware/target/arm/ipod/lcd-color_nano.c +++ b/firmware/target/arm/ipod/lcd-color_nano.c @@ -155,22 +155,24 @@ static void lcd_setup_drawing_region(int x, int y, int width, int height) /* calculate the drawing region */ #if CONFIG_LCD == LCD_IPODNANO y0 = x; /* start horiz */ - x0 = y; /* start vert */ y1 = (x + width) - 1; /* max horiz */ + x0 = y; /* start vert */ x1 = (y + height) - 1; /* max vert */ #elif CONFIG_LCD == LCD_IPODCOLOR y0 = y; /* start vert */ - x0 = LCD_WIDTH - (x + width); /* start horiz */ y1 = (y + height) - 1; /* end vert */ - x1 = (x0 + width) - 1; /* end horiz */ + x1 = (LCD_WIDTH - 1) - x; /* end horiz */ + x0 = (x1 - width) + 1; /* start horiz */ #endif /* setup the drawing region */ if ((lcd_type&1) == 0) { + /* x0 and x1 need to be swapped until + * proper direction setup is added */ lcd_cmd_data(0x12, y0); /* start vert */ - lcd_cmd_data(0x13, x0); /* start horiz */ + lcd_cmd_data(0x13, x1); /* start horiz */ lcd_cmd_data(0x15, y1); /* end vert */ - lcd_cmd_data(0x16, x1); /* end horiz */ + lcd_cmd_data(0x16, x0); /* end horiz */ } else { /* max horiz << 8 | start horiz */ lcd_cmd_data(LCD_CNTL_HORIZ_RAM_ADDR_POS, (y1 << 8) | y0); -- cgit v1.2.3