From 4db2ded56f1ebf5a617e82458ab5526541b92943 Mon Sep 17 00:00:00 2001 From: Robert Hak Date: Tue, 13 Aug 2002 09:19:21 +0000 Subject: similarities in the two branches joined git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1707 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/lcd-common.c | 162 ++++++++++++++++++++++++++++++++++++++++ uisimulator/common/lcd-common.h | 71 ++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 uisimulator/common/lcd-common.c create mode 100644 uisimulator/common/lcd-common.h diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c new file mode 100644 index 0000000000..d55cd0baa8 --- /dev/null +++ b/uisimulator/common/lcd-common.c @@ -0,0 +1,162 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Robert E. Hak + * + * Windows Copyright (C) 2002 by Felix Arends + * X11 Copyright (C) 2002 by Daniel Stenberg + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "lcd-common.h" + +/*** Define our #includes ***/ +#ifdef WIN32 + #include + #include + #include "uisw32.h" +#else + /* X11 */ + #include + #include + #include + #include + #include + #include + #include + #include + + #include + #include + #include + + #include "screenhack.h" +#endif +/**** End #includes ****/ + + +/*** Start global variables ***/ +#ifdef WIN32 + +/* Simulate the target ui display */ +char bitmap[LCD_HEIGHT][LCD_WIDTH]; + +BITMAPINFO2 bmi = +{ + { sizeof (BITMAPINFOHEADER), + LCD_WIDTH, -LCD_HEIGHT, 1, 8, + BI_RGB, 0, 0, 0, 2, 2, }, + { + /* green background color */ + {UI_LCD_BGCOLOR, 0}, + /* black color */ + {UI_LCD_BLACK, 0} + } + +}; + +#else +extern Display *dpy; +unsigned char lcd_framebuffer_copy[LCD_WIDTH][LCD_HEIGHT/8]; +#endif + +/* Both X11 and WIN32 use this */ +extern unsigned char lcd_framebuffer[LCD_WIDTH][LCD_HEIGHT/8]; + +/*** End Global variables ***/ + + +/*** Externed functions ***/ +#ifndef WIN32 +extern void screen_resized(int width, int height); + +/* From uibasic.c */ +extern void drawdots(int color, XPoint *points, int count); +#endif + +/*** End Externed functions ***/ + + + +/*** Begin Functions ***/ +void lcd_update() +{ +#ifdef WIN32 + int x, y; + if(hGUIWnd == NULL) + _endthread (); + + for(x = 0; x < LCD_WIDTH; x++) + for(y = 0; y < LCD_HEIGHT; y++) + bitmap[y][x] = ((lcd_framebuffer[x][y/8] >> (y & 7)) & 1); + + InvalidateRect (hGUIWnd, NULL, FALSE); + + Sleep (50); +#else + int x, y, bit; + int p=0, cp=0; + + XPoint points[LCD_WIDTH * LCD_HEIGHT]; + XPoint clearpoints[LCD_WIDTH * LCD_HEIGHT]; + + for(y=0; y ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Robert E. Hak + * + * Windows Version Copyright (C) 2002 by Felix Arends + * X11 Version Copyright (C) 2002 by Daniel Stenberg + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "lcd.h" + +#ifdef WIN32 + #ifndef __LCDWIN32_H__ + #define __LCDWIN32_H__ + + #include "uisw32.h" + #include "lcd.h" + + typedef struct + { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[2]; + } BITMAPINFO2; + + #ifdef HAVE_LCD_BITMAP + /* the display */ + extern unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; + #else + #define DISP_X 112 + #define DISP_Y 64 + #endif /* HAVE_LCD_BITMAP */ + + /* the ui display */ + extern char bitmap[LCD_HEIGHT][LCD_WIDTH]; + /* bitmap information */ + extern BITMAPINFO2 bmi; + #endif /* __LCDWIN32_H__ */ + +#else + /* X11 */ + #define MARGIN_X 3 + #define MARGIN_Y 3 + +#endif /* WIN32 */ + + + + + + + + + + + + + + -- cgit v1.2.3