diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-08-07 02:44:18 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-08-07 02:44:18 +0000 |
commit | ad9c9cc6516f7a80e2077ae53c930c665031886d (patch) | |
tree | 9af206b9f9c19d85eeefca150836cb5e2af45df1 /apps/plugins/doom | |
parent | e6ff242184c98237624217fbfc9a303405922bcd (diff) | |
download | rockbox-ad9c9cc6516f7a80e2077ae53c930c665031886d.tar.gz rockbox-ad9c9cc6516f7a80e2077ae53c930c665031886d.zip |
Use striped buffering for grayscale targets to make the buffer fit on iPod g3/g4. Also slightly faster (at least on H1x0) with the buffer in IRAM.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10470 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/doom')
-rw-r--r-- | apps/plugins/doom/i_video.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c index 36d2e06a5a..a4734502b5 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.21 2006/08/07 01:57:29 amiconn | 19 | * Revision 1.22 2006/08/07 02:44:18 amiconn |
20 | * Use striped buffering for grayscale targets to make the buffer fit on iPod g3/g4. Also slightly faster (at least on H1x0) with the buffer in IRAM. | ||
21 | * | ||
22 | * Revision 1.21 2006-08-07 01:57:29 amiconn | ||
20 | * Fix red iPod g3 build. | 23 | * Fix red iPod g3 build. |
21 | * | 24 | * |
22 | * Revision 1.20 2006-08-07 01:46:41 amiconn | 25 | * Revision 1.20 2006-08-07 01:46:41 amiconn |
@@ -103,7 +106,7 @@ | |||
103 | 106 | ||
104 | #ifndef HAVE_LCD_COLOR | 107 | #ifndef HAVE_LCD_COLOR |
105 | #include "../lib/gray.h" | 108 | #include "../lib/gray.h" |
106 | static unsigned char graybuffer[LCD_HEIGHT*LCD_WIDTH]; /* off screen buffer */ | 109 | static unsigned char graybuffer[8*LCD_WIDTH] IBSS_ATTR; /* off screen buffer */ |
107 | static unsigned char *gbuf; | 110 | static unsigned char *gbuf; |
108 | #define GRAYBUFSIZE (LCD_WIDTH*LCD_HEIGHT*4+200) | 111 | #define GRAYBUFSIZE (LCD_WIDTH*LCD_HEIGHT*4+200) |
109 | #endif | 112 | #endif |
@@ -193,7 +196,7 @@ inline void getkey() | |||
193 | event.type = ev_keyup; | 196 | event.type = ev_keyup; |
194 | hswitch=0; | 197 | hswitch=0; |
195 | } | 198 | } |
196 | #if CONFIG_KEYPAD == IPOD_4G_PAD | 199 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) |
197 | /* Bring up the menu */ | 200 | /* Bring up the menu */ |
198 | event.data1=KEY_ESCAPE; | 201 | event.data1=KEY_ESCAPE; |
199 | #else | 202 | #else |
@@ -457,23 +460,35 @@ void I_FinishUpdate (void) | |||
457 | unsigned char paletteIndex; | 460 | unsigned char paletteIndex; |
458 | int x, y; | 461 | int x, y; |
459 | 462 | ||
463 | #ifdef HAVE_LCD_COLOR | ||
460 | for (y = 0; y < LCD_HEIGHT; y++) | 464 | for (y = 0; y < LCD_HEIGHT; y++) |
461 | { | 465 | { |
462 | for (x = 0; x < LCD_WIDTH; x++) | 466 | for (x = 0; x < LCD_WIDTH; x++) |
463 | { | 467 | { |
464 | paletteIndex = d_screens[0][y*SCREENWIDTH + x]; | 468 | paletteIndex = d_screens[0][y*SCREENWIDTH + x]; |
465 | #ifndef HAVE_LCD_COLOR | ||
466 | graybuffer[y * LCD_WIDTH + x]=palette[paletteIndex]; | ||
467 | #else | ||
468 | rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex]; | 469 | rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex]; |
469 | #endif | ||
470 | } | 470 | } |
471 | } | 471 | } |
472 | #ifndef HAVE_LCD_COLOR | ||
473 | gray_ub_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT); | ||
474 | #else | ||
475 | rb->lcd_update(); | 472 | rb->lcd_update(); |
476 | #endif | 473 | #else /* !HAVE_LCD_COLOR */ |
474 | int yd = 0; | ||
475 | |||
476 | for (y = 0; y < LCD_HEIGHT; y++) | ||
477 | { | ||
478 | for (x = 0; x < LCD_WIDTH; x++) | ||
479 | { | ||
480 | paletteIndex = d_screens[0][y*SCREENWIDTH + x]; | ||
481 | graybuffer[yd * LCD_WIDTH + x]=palette[paletteIndex]; | ||
482 | } | ||
483 | if (++yd == 8) | ||
484 | { | ||
485 | gray_ub_gray_bitmap(graybuffer, 0, y & ~7, LCD_WIDTH, 8); | ||
486 | yd = 0; | ||
487 | } | ||
488 | } | ||
489 | if (yd > 0) | ||
490 | gray_ub_gray_bitmap(graybuffer, 0, y & ~7, LCD_WIDTH, yd); | ||
491 | #endif /* !HAVE_LCD_COLOR */ | ||
477 | #endif | 492 | #endif |
478 | } | 493 | } |
479 | 494 | ||
@@ -506,7 +521,7 @@ void I_InitGraphics(void) | |||
506 | 521 | ||
507 | #ifndef HAVE_LCD_COLOR | 522 | #ifndef HAVE_LCD_COLOR |
508 | gbuf=malloc(GRAYBUFSIZE); | 523 | gbuf=malloc(GRAYBUFSIZE); |
509 | gray_init(rb, gbuf, GRAYBUFSIZE, false, LCD_WIDTH, LCD_HEIGHT, 32, | 524 | gray_init(rb, gbuf, GRAYBUFSIZE, false, LCD_WIDTH, LCD_HEIGHT, 32, |
510 | 3<<7 /* 1.5 */, NULL); | 525 | 3<<7 /* 1.5 */, NULL); |
511 | /* switch on grayscale overlay */ | 526 | /* switch on grayscale overlay */ |
512 | gray_show(true); | 527 | gray_show(true); |