summaryrefslogtreecommitdiff
path: root/apps/plugins/doom/i_video.c
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2006-04-03 16:13:15 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2006-04-03 16:13:15 +0000
commit50b4d12d7aac040426f4149c53dfe8ca0856eb46 (patch)
tree8414a8a2fde0d12a3c9f45885f00024e1c7074a8 /apps/plugins/doom/i_video.c
parenta343dfb935c5d4446460933b795f362db0f5216b (diff)
downloadrockbox-50b4d12d7aac040426f4149c53dfe8ca0856eb46.tar.gz
rockbox-50b4d12d7aac040426f4149c53dfe8ca0856eb46.zip
Add grayscale lib for the H100's
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9456 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/doom/i_video.c')
-rw-r--r--apps/plugins/doom/i_video.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index ea6389deab..83fcc4749c 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -16,7 +16,10 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * $Log$ 18 * $Log$
19 * Revision 1.5 2006/04/03 08:51:08 bger 19 * Revision 1.6 2006/04/03 16:13:15 kkurbjun
20 * Add grayscale lib for the H100's
21 *
22 * Revision 1.5 2006-04-03 08:51:08 bger
20 * Patch #4864 by Jonathan Gordon: text editor plugin, with some changes by me. 23 * Patch #4864 by Jonathan Gordon: text editor plugin, with some changes by me.
21 * Also correct a var clash between the rockbox's gui api and doom plugin 24 * Also correct a var clash between the rockbox's gui api and doom plugin
22 * 25 *
@@ -50,7 +53,15 @@
50#include "doomdef.h" 53#include "doomdef.h"
51 54
52#include "rockmacros.h" 55#include "rockmacros.h"
53#if defined(CPU_COLDFIRE) 56
57#ifndef HAVE_LCD_COLOR
58#include "../lib/gray.h"
59static fb_data graybuffer[LCD_HEIGHT*LCD_WIDTH]; /* off screen buffer */
60static unsigned char *gbuf;
61static unsigned int gbuf_size = 0;
62#endif
63
64#if defined(CPU_COLDFIRE)
54static char fastscreen[LCD_WIDTH*LCD_HEIGHT] IBSS_ATTR; 65static char fastscreen[LCD_WIDTH*LCD_HEIGHT] IBSS_ATTR;
55#endif 66#endif
56static fb_data palette[256] IBSS_ATTR; 67static fb_data palette[256] IBSS_ATTR;
@@ -301,7 +312,11 @@ static void I_UploadNewPalette(int pal)
301 int g = gtable[pall[1]]; 312 int g = gtable[pall[1]];
302 int b = gtable[pall[2]]; 313 int b = gtable[pall[2]];
303 pall+=3; 314 pall+=3;
315#ifndef HAVE_LCD_COLOR
316 paldata[i]=(r+g+b)/3;
317#else
304 paldata[i] = LCD_RGBPACK(r,g,b); 318 paldata[i] = LCD_RGBPACK(r,g,b);
319#endif
305 } 320 }
306 321
307 W_UnlockLumpNum(lump); 322 W_UnlockLumpNum(lump);
@@ -329,7 +344,7 @@ void I_UpdateNoBlit (void)
329 344
330void I_FinishUpdate (void) 345void I_FinishUpdate (void)
331{ 346{
332#if defined(IRIVER_H300_SERIES) && !defined(SIMULATOR) 347#if defined(LCD_H300) && !defined(SIMULATOR)
333 /* 348 /*
334 Lookup tables are no longer needed (H300 specific, decreases timedemo 349 Lookup tables are no longer needed (H300 specific, decreases timedemo
335 by about 500 tics) 350 by about 500 tics)
@@ -363,11 +378,19 @@ void I_FinishUpdate (void)
363 for (x = 0; x < LCD_WIDTH; x++) 378 for (x = 0; x < LCD_WIDTH; x++)
364 { 379 {
365 paletteIndex = d_screens[0][y*SCREENWIDTH + x]; 380 paletteIndex = d_screens[0][y*SCREENWIDTH + x];
381#ifndef HAVE_LCD_COLOR
382 graybuffer[y * LCD_WIDTH + x]=palette[paletteIndex];
383#else
366 rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex]; 384 rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex];
385#endif
367 } 386 }
368 } 387 }
388#ifndef HAVE_LCD_COLOR
389 gray_ub_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT);
390#else
369 rb->lcd_update(); 391 rb->lcd_update();
370#endif 392#endif
393#endif
371} 394}
372 395
373// 396//
@@ -401,6 +424,13 @@ void I_InitGraphics(void)
401 424
402 /* Note: The other screens are allocated as needed */ 425 /* Note: The other screens are allocated as needed */
403 426
427#ifndef HAVE_LCD_COLOR
428 gbuf=malloc(220000); // give a bunch
429 gray_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT/8, 32, NULL);
430 /* switch on grayscale overlay */
431 gray_show(true);
432#endif
433
404#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 434#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
405 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); 435 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE);
406 d_screens[0] = fastscreen; 436 d_screens[0] = fastscreen;