summaryrefslogtreecommitdiff
path: root/apps/plugins/pacbox/pacbox_lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pacbox/pacbox_lcd.c')
-rw-r--r--apps/plugins/pacbox/pacbox_lcd.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/apps/plugins/pacbox/pacbox_lcd.c b/apps/plugins/pacbox/pacbox_lcd.c
new file mode 100644
index 0000000000..83931b1b68
--- /dev/null
+++ b/apps/plugins/pacbox/pacbox_lcd.c
@@ -0,0 +1,105 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Pacbox - a Pacman Emulator for Rockbox
11 *
12 * Based on PIE - Pacman Instructional Emulator
13 *
14 * Copyright (c) 1997-2003,2004 Alessandro Scotti
15 *
16 * All files in this archive are subject to the GNU General Public License.
17 * See the file COPYING in the source tree root for full license agreement.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23
24#include "pacbox.h"
25#include "pacbox_lcd.h"
26#include "arcade.h"
27#include "hardware.h"
28
29void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
30{
31 fb_data* dst;
32 fb_data* next_dst;
33 int x,y;
34
35#ifdef HAVE_LCD_COLOR
36#if (LCD_WIDTH >= 224) && (LCD_HEIGHT >= 288)
37 /* Native resolution = 224x288 */
38 (void)next_dst;
39 dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS];
40 for (y=0;y<ScreenHeight;y++) {
41 for (x=0;x<ScreenWidth;x++) {
42 *(dst++) = palette[*(vbuf++)];
43 }
44 dst += XOFS*2;
45 }
46#elif (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224)
47 /* Native resolution - rotated 90 degrees = 288x224 */
48 next_dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS+ScreenHeight-1];
49 for( y=ScreenHeight-1; y>=0; y-- ) {
50 dst = (next_dst--);
51 for( x=0; x<ScreenWidth; x++ ) {
52 *dst = palette[*(vbuf++)];
53 dst+=LCD_WIDTH;
54 }
55 }
56#elif (LCD_WIDTH >= 216) && (LCD_HEIGHT >= 168)
57 /* 0.75 scaling - display 3 out of 4 pixels = 216x168
58 Skipping pixel #2 out of 4 seems to give the most legible display
59 */
60 next_dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS+((ScreenHeight*3)/4)-1];
61 for (y=ScreenHeight-1;y >= 0; y--) {
62 if ((y & 3) != 1) {
63 dst = (next_dst--);
64 for (x=0;x<ScreenWidth;x++) {
65 if ((x & 3) == 1) { vbuf++; }
66 else {
67 *dst = palette[*(vbuf++)];
68 dst+=LCD_WIDTH;
69 }
70 }
71 } else {
72 vbuf+=ScreenWidth;
73 }
74 }
75#elif (LCD_WIDTH >= 144) && (LCD_HEIGHT >= 112)
76 /* 0.5 scaling - display every other pixel = 144x112 */
77 next_dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS+ScreenHeight/2-1];
78 for (y=(ScreenHeight/2)-1;y >= 0; y--) {
79 dst = (next_dst--);
80 for (x=0;x<ScreenWidth/2;x++) {
81 *dst = palette[*(vbuf)];
82 vbuf+=2;
83 dst+=LCD_WIDTH;
84 }
85 vbuf+=ScreenWidth;
86 }
87#endif
88#else /* Greyscale LCDs */
89#if (LCD_WIDTH >= 144) && (LCD_HEIGHT >= 112)
90#if LCD_PIXELFORMAT == VERTICAL_PACKING
91 /* 0.5 scaling - display every other pixel = 144x112 */
92 next_dst=&lcd_framebuffer[YOFS/4*LCD_WIDTH+XOFS+ScreenHeight/2-1];
93 for (y=(ScreenHeight/2)-1;y >= 0; y--) {
94 dst = (next_dst--);
95 for (x=0;x<ScreenWidth/8;x++) {
96 *dst = (palette[*(vbuf+6)]<<6) | (palette[*(vbuf+4)] << 4) | (palette[*(vbuf+2)] << 2) | palette[*(vbuf)];
97 vbuf+=8;
98 dst+=LCD_WIDTH;
99 }
100 vbuf+=ScreenWidth;
101 }
102#endif /* Vertical Packing */
103#endif /* Size >= 144x112 */
104#endif /* Not Colour */
105}