From ca8154741fd01e4b11461ce522da7d5e30a12d6e Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Sat, 11 May 2013 12:30:04 +0200 Subject: rk27xx: Slightly refactor lcd_set_gram_area() Change-Id: I1040164220dd87b19b58be560eb5b628857bc284 --- firmware/target/arm/rk27xx/lcd-hifiman.c | 43 ++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'firmware/target/arm/rk27xx/lcd-hifiman.c') diff --git a/firmware/target/arm/rk27xx/lcd-hifiman.c b/firmware/target/arm/rk27xx/lcd-hifiman.c index 03b488548e..1adc6e36ed 100644 --- a/firmware/target/arm/rk27xx/lcd-hifiman.c +++ b/firmware/target/arm/rk27xx/lcd-hifiman.c @@ -159,15 +159,17 @@ static void lcd_v1_enable (bool on) LCDC_CTRL &= ~RGB24B; } -static void lcd_v1_set_gram_area(int x, int y, int width, int height) + +static void lcd_v1_set_gram_area(int x_start, int y_start, + int x_end, int y_end) { lcdctrl_bypass(1); LCDC_CTRL |= RGB24B; - lcd_write_reg(0x03, x); - lcd_write_reg(0x05, width-1); - lcd_write_reg(0x07, y); - lcd_write_reg(0x09, height-1); + lcd_write_reg(0x03, x_start); + lcd_write_reg(0x05, x_end); + lcd_write_reg(0x07, y_start); + lcd_write_reg(0x09, y_end); lcd_cmd(0x22); LCDC_CTRL &= ~RGB24B; @@ -178,7 +180,7 @@ static void lcd_v1_update_rect(int x, int y, int width, int height) int px = x, py = y; int pxmax = x + width, pymax = y + height; - lcd_v1_set_gram_area(x, y, pxmax, pymax); + lcd_v1_set_gram_area(x, y, pxmax-1, pymax-1); for (py=y; py