1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Pacbox - a Pacman Emulator for Rockbox
12 * Based on PIE - Pacman Instructional Emulator
14 * Copyright (c) 1997-2003,2004 Alessandro Scotti
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 * KIND, either express or implied.
24 ****************************************************************************/
27 #include "pacbox_lcd.h"
31 #if defined(SIMULATOR) || !defined(IRIVER_H300_SERIES)
33 void blit_display(fb_data
* lcd_framebuffer
, unsigned char* vbuf
)
40 #if (LCD_WIDTH >= 224) && (LCD_HEIGHT >= 288)
41 /* Native resolution = 224x288 */
43 dst
=&lcd_framebuffer
[YOFS
*LCD_WIDTH
+XOFS
];
44 for (y
=0;y
<ScreenHeight
;y
++) {
45 for (x
=0;x
<ScreenWidth
;x
++) {
46 *(dst
++) = palette
[*(vbuf
++)];
50 #elif (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224)
51 /* Native resolution - rotated 90 degrees = 288x224 */
52 next_dst
=&lcd_framebuffer
[YOFS
*LCD_WIDTH
+XOFS
+ScreenHeight
-1];
53 for( y
=ScreenHeight
-1; y
>=0; y
-- ) {
55 for( x
=0; x
<ScreenWidth
; x
++ ) {
56 *dst
= palette
[*(vbuf
++)];
60 #elif (LCD_WIDTH >= 216) && (LCD_HEIGHT >= 168)
61 /* 0.75 scaling - display 3 out of 4 pixels - rotated = 216x168
62 Skipping pixel #2 out of 4 seems to give the most legible display
64 next_dst
=&lcd_framebuffer
[YOFS
*LCD_WIDTH
+XOFS
+((ScreenHeight
*3)/4)-1];
65 for (y
=ScreenHeight
-1;y
>= 0; y
--) {
68 for (x
=0;x
<ScreenWidth
;x
++) {
69 if ((x
& 3) == 1) { vbuf
++; }
71 *dst
= palette
[*(vbuf
++)];
79 #elif (LCD_WIDTH >= 168) && (LCD_HEIGHT >= 216)
80 /* 0.75 scaling - display 3 out of 4 pixels - = 168x216
81 Skipping pixel #2 out of 4 seems to give the most legible display
84 dst
=&lcd_framebuffer
[YOFS
*LCD_WIDTH
+XOFS
];
85 for (y
=0;y
<ScreenHeight
;y
++) {
87 for (x
=0;x
<ScreenWidth
;x
++) {
88 if ((x
& 3) == 1) { vbuf
++; }
90 *(dst
++) = palette
[*(vbuf
++)];
98 #elif (LCD_WIDTH >= 144) && (LCD_HEIGHT >= 112)
99 /* 0.5 scaling - display every other pixel - rotated = 144x112 */
100 next_dst
=&lcd_framebuffer
[YOFS
*LCD_WIDTH
+XOFS
+ScreenHeight
/2-1];
101 for (y
=(ScreenHeight
/2)-1;y
>= 0; y
--) {
103 for (x
=0;x
<ScreenWidth
/2;x
++) {
104 *dst
= palette
[*(vbuf
)];
110 #elif (LCD_WIDTH >= 128) && (LCD_HEIGHT >= 128)
111 /* 0.5 scaling - display every other pixel = 112x144, crop to 112x128 */
113 dst
=&lcd_framebuffer
[XOFS
];
115 /* Skip first 16 lines */
116 vbuf
+=ScreenWidth
*YCLIP
;
118 /* Show regular screen */
119 for (y
=0;y
<(ScreenHeight
/2-YCLIP
);y
++) {
120 for (x
=0;x
<ScreenWidth
/2;x
++) {
121 *(dst
++) = palette
[*(vbuf
)];
128 #else /* Greyscale LCDs */
129 #if (LCD_WIDTH >= 144) && (LCD_HEIGHT >= 112)
130 #if LCD_PIXELFORMAT == VERTICAL_PACKING
131 /* 0.5 scaling - display every other pixel = 144x112 */
132 next_dst
=&lcd_framebuffer
[YOFS
/4*LCD_WIDTH
+XOFS
+ScreenHeight
/2-1];
133 for (y
=(ScreenHeight
/2)-1;y
>= 0; y
--) {
135 for (x
=0;x
<ScreenWidth
/8;x
++) {
136 *dst
= (palette
[*(vbuf
+6)]<<6) | (palette
[*(vbuf
+4)] << 4) | (palette
[*(vbuf
+2)] << 2) | palette
[*(vbuf
)];
142 #endif /* Vertical Packing */
143 #endif /* Size >= 144x112 */
144 #endif /* Not Colour */