From 5e9b62cd8ad4d38c7ca43c916b5bc831454bc267 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 7 Jan 2012 23:30:53 +0100 Subject: ypr0: Use generic lcd memframe driver. --- firmware/target/hosted/ypr0/lcd-target.h | 26 ++++++++++++++++ firmware/target/hosted/ypr0/lcd-ypr0.c | 53 +------------------------------- 2 files changed, 27 insertions(+), 52 deletions(-) create mode 100644 firmware/target/hosted/ypr0/lcd-target.h (limited to 'firmware/target/hosted') diff --git a/firmware/target/hosted/ypr0/lcd-target.h b/firmware/target/hosted/ypr0/lcd-target.h new file mode 100644 index 0000000000..c8a6de74f9 --- /dev/null +++ b/firmware/target/hosted/ypr0/lcd-target.h @@ -0,0 +1,26 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __LCD_TARGET_H__ +#define __LCD_TARGET_H__ + +extern fb_data *dev_fb; +#define LCD_FRAMEBUF_ADDR(col, row) (dev_fb + row*LCD_WIDTH + col) + +#endif diff --git a/firmware/target/hosted/ypr0/lcd-ypr0.c b/firmware/target/hosted/ypr0/lcd-ypr0.c index f0565ae2d4..083a9fbe28 100644 --- a/firmware/target/hosted/ypr0/lcd-ypr0.c +++ b/firmware/target/hosted/ypr0/lcd-ypr0.c @@ -33,59 +33,8 @@ #include "screendump.h" #include "lcd.h" -/* eqivalent to fb + y*width + x */ -#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) - static int dev_fd = 0; -static fb_data *dev_fb = 0; - -void lcd_update(void) -{ - /* update the entire display */ - memcpy(dev_fb, lcd_framebuffer, sizeof(lcd_framebuffer)); -} - -/* Copy Rockbox frame buffer to the mmapped lcd device */ -void lcd_update_rect(int x, int y, int width, int height) -{ - /* nothing to draw? */ - if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || - (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) - return; - - /* do the necessary clipping */ - if (x < 0) - { /* clip left */ - width += x; - x = 0; - } - if (y < 0) - { /* clip top */ - height += y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; /* clip right */ - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; /* clip bottom */ - - fb_data* src = LCDADDR(x, y); - fb_data* dst = dev_fb + y*LCD_WIDTH + x; - - if (LCD_WIDTH == width) - { /* optimized full-width update */ - memcpy(dst, src, width * height * sizeof(fb_data)); - } - else - { /* row by row */ - do - { - memcpy(dst, src, width * sizeof(fb_data)); - src += LCD_WIDTH; - dst += LCD_WIDTH; - } while(--height > 0); - } -} +fb_data *dev_fb = 0; void lcd_shutdown(void) { -- cgit v1.2.3