summaryrefslogtreecommitdiff
path: root/apps/plugins/zxbox
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-01-04 23:42:38 +0000
committerJens Arnold <amiconn@rockbox.org>2008-01-04 23:42:38 +0000
commitfeb5b15e9bf9292e3d4d82ea1e01ab3557fb1240 (patch)
treed854c9a6fbbb3263537071fb02df349fdfa62361 /apps/plugins/zxbox
parentd3586837fa9221a7ef104550b4c0aadc1a6ea77c (diff)
downloadrockbox-feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240.tar.gz
rockbox-feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240.zip
All-new greyscale library, replacing the old one. Features: (1) Drawing/updating is faster than the old grayscale lib at full depth. (2) Always 129 shades instead of 2..33 shades. (3) No graininess caused by frequent updates (mpegplayer, doom, ...). (4) Needs less memory than the old grayscale lib at full depth. * The tradeoff is slightly higher CPU load in the ISR (frames are calculated 'live') and an extra function in the core. * Ported all plugins which used the graylib to use the new one. * Some slight optimisations for archos and H1x0 LCD update.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15998 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/zxbox')
-rw-r--r--apps/plugins/zxbox/interf.c6
-rw-r--r--apps/plugins/zxbox/spmain.c14
-rw-r--r--apps/plugins/zxbox/zxbox.c32
-rw-r--r--apps/plugins/zxbox/zxconfig.h9
-rw-r--r--apps/plugins/zxbox/zxvid_4bpp.c2
-rw-r--r--apps/plugins/zxbox/zxvid_com.h4
-rw-r--r--apps/plugins/zxbox/zxvid_grey.c16
7 files changed, 41 insertions, 42 deletions
diff --git a/apps/plugins/zxbox/interf.c b/apps/plugins/zxbox/interf.c
index 7f37262140..10c3dfa363 100644
--- a/apps/plugins/zxbox/interf.c
+++ b/apps/plugins/zxbox/interf.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 1996-1998 Szeredi Miklos 2 * Copyright (C) 1996-1998 Szeredi Miklos
3 * Email: mszeredi@inf.bme.hu 3 * Email: mszeredi@inf.bme.hu
4 * 4 *
@@ -94,7 +94,7 @@ char *spif_get_tape_fileinfo(int *startp, int *nump)
94 94
95void put_msg(const char *msg) 95void put_msg(const char *msg)
96{ 96{
97#ifndef USE_GRAY 97#ifndef USE_GREY
98 rb->splash (HZ/2, msg ); 98 rb->splash (HZ/2, msg );
99#else 99#else
100 LOGF(msg); 100 LOGF(msg);
@@ -105,7 +105,7 @@ void put_msg(const char *msg)
105 105
106void put_tmp_msg(const char *msg) 106void put_tmp_msg(const char *msg)
107{ 107{
108#ifndef USE_GRAY 108#ifndef USE_GREY
109 rb->splash (HZ/10, msg ); 109 rb->splash (HZ/10, msg );
110#else 110#else
111 LOGF(msg); 111 LOGF(msg);
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c
index ca0fa9bc71..51344763f9 100644
--- a/apps/plugins/zxbox/spmain.c
+++ b/apps/plugins/zxbox/spmain.c
@@ -42,8 +42,8 @@
42#include <string.h> 42#include <string.h>
43#include <stdlib.h> 43#include <stdlib.h>
44#include <errno.h> 44#include <errno.h>
45#ifdef USE_GRAY 45#ifdef USE_GREY
46#include "../lib/gray.h" 46#include "../lib/grey.h"
47#endif 47#endif
48 48
49#include "zxbox_keyb.h" 49#include "zxbox_keyb.h"
@@ -426,8 +426,8 @@ static bool zxbox_menu(void)
426 else 426 else
427 intkeys[i] = (unsigned) settings.keymap[i]; 427 intkeys[i] = (unsigned) settings.keymap[i];
428 } 428 }
429#ifdef USE_GRAY 429#ifdef USE_GREY
430 gray_show(true); 430 grey_show(true);
431#endif 431#endif
432 return (exit); 432 return (exit);
433} 433}
@@ -465,8 +465,8 @@ static void run_singlemode(void)
465 if (zxbox_menu()){ 465 if (zxbox_menu()){
466 /* Save the user settings if they have changed */ 466 /* Save the user settings if they have changed */
467 if (rb->memcmp(&settings,&old_settings,sizeof(settings))!=0) { 467 if (rb->memcmp(&settings,&old_settings,sizeof(settings))!=0) {
468#ifdef USE_GRAY 468#ifdef USE_GREY
469 gray_show(false); 469 grey_show(false);
470#endif 470#endif
471 rb->splash(0, "Saving settings..."); 471 rb->splash(0, "Saving settings...");
472 configfile_save(GLOBALCFG, config,sizeof(config)/sizeof(*config),SETTINGS_VERSION); 472 configfile_save(GLOBALCFG, config,sizeof(config)/sizeof(*config),SETTINGS_VERSION);
@@ -531,7 +531,7 @@ static void init_load(void *parameter)
531 531
532 check_params (parameter); 532 check_params (parameter);
533 if(spcf_init_snapshot != NULL) { 533 if(spcf_init_snapshot != NULL) {
534#ifndef USE_GRAY 534#ifndef USE_GREY
535 rb->splash(HZ, "Loading snapshot '%s'", spcf_init_snapshot); 535 rb->splash(HZ, "Loading snapshot '%s'", spcf_init_snapshot);
536#endif 536#endif
537 537
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c
index c7e3d0a5db..ebb689ce9c 100644
--- a/apps/plugins/zxbox/zxbox.c
+++ b/apps/plugins/zxbox/zxbox.c
@@ -50,7 +50,7 @@ unsigned char image_array [ HEIGHT * WIDTH ];
50 50
51static int previous_state; 51static int previous_state;
52 52
53#ifdef USE_GRAY 53#ifdef USE_GREY
54static unsigned char *gbuf; 54static unsigned char *gbuf;
55static size_t gbuf_size = 0; 55static size_t gbuf_size = 0;
56#endif 56#endif
@@ -69,17 +69,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
69 69
70 sp_init(); 70 sp_init();
71 71
72#ifdef USE_GRAY 72#ifdef USE_GREY
73 /* get the remainder of the plugin buffer */ 73 /* get the remainder of the plugin buffer */
74 gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); 74 gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
75#ifdef USE_BUFFERED_GRAY 75#ifdef USE_BUFFERED_GREY
76 gray_init(rb, gbuf, gbuf_size, true, LCD_WIDTH, LCD_HEIGHT, 15, 0, NULL); 76 grey_init(rb, gbuf, gbuf_size, true, LCD_WIDTH, LCD_HEIGHT, NULL);
77#else 77#else
78 gray_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT, 15, 0, NULL); 78 grey_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT, NULL);
79#endif /* USE_BUFFERED_GRAY */ 79#endif /* USE_BUFFERED_GREY */
80 /* switch on grayscale overlay */ 80 /* switch on greyscale overlay */
81 gray_show(true); 81 grey_show(true);
82#endif /* USE_GRAY */ 82#endif /* USE_GREY */
83 83
84 84
85#if defined(HAVE_ADJUSTABLE_CPU_FREQ) 85#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
@@ -102,9 +102,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
102 rb->cpu_boost(false); 102 rb->cpu_boost(false);
103#endif 103#endif
104 104
105#ifdef USE_GRAY 105#ifdef USE_GREY
106gray_show(false); 106grey_show(false);
107gray_release(); 107grey_release();
108#endif 108#endif
109 109
110#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR 110#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
@@ -133,8 +133,8 @@ void spkb_process_events( int evenframe )
133 rb->cpu_boost(false); 133 rb->cpu_boost(false);
134#endif 134#endif
135 exit_requested=1; 135 exit_requested=1;
136#ifdef USE_GRAY 136#ifdef USE_GREY
137 gray_show(false); 137 grey_show(false);
138#endif 138#endif
139 return; 139 return;
140 } 140 }
@@ -151,8 +151,8 @@ void spkb_process_events( int evenframe )
151 rb->cpu_boost(false); 151 rb->cpu_boost(false);
152#endif 152#endif
153 exit_requested=1; 153 exit_requested=1;
154#ifdef USE_GRAY 154#ifdef USE_GREY
155 gray_show(false); 155 grey_show(false);
156#endif 156#endif
157 return; 157 return;
158 } 158 }
diff --git a/apps/plugins/zxbox/zxconfig.h b/apps/plugins/zxbox/zxconfig.h
index ddd91d0020..f83c091ab9 100644
--- a/apps/plugins/zxbox/zxconfig.h
+++ b/apps/plugins/zxbox/zxconfig.h
@@ -17,11 +17,10 @@ extern int intkeys[5];
17#define SETTINGS_MIN_VERSION 2 17#define SETTINGS_MIN_VERSION 2
18#define SETTINGS_VERSION 2 18#define SETTINGS_VERSION 2
19 19
20/* undef not to use grayscale lib */ 20/* undef not to use greyscale lib */
21#if !defined HAVE_LCD_COLOR && LCD_PIXELFORMAT != HORIZONTAL_PACKING 21#if !defined HAVE_LCD_COLOR
22/* grayscale is far slower for now at least on ipods :( */ 22#define USE_GREY
23#define USE_GRAY 23#define USE_BUFFERED_GREY
24#define USE_BUFFERED_GRAY
25#endif 24#endif
26 25
27 26
diff --git a/apps/plugins/zxbox/zxvid_4bpp.c b/apps/plugins/zxbox/zxvid_4bpp.c
index 4846340c4d..c05e48b8e6 100644
--- a/apps/plugins/zxbox/zxvid_4bpp.c
+++ b/apps/plugins/zxbox/zxvid_4bpp.c
@@ -1,6 +1,6 @@
1#include "zxvid_com.h" 1#include "zxvid_com.h"
2 2
3#if !defined USE_GRAY && LCD_DEPTH < 4 3#if !defined USE_GREY && LCD_DEPTH < 4
4/* screen routines for greyscale targets not using greyscale lib */ 4/* screen routines for greyscale targets not using greyscale lib */
5 5
6#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 6#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
diff --git a/apps/plugins/zxbox/zxvid_com.h b/apps/plugins/zxbox/zxvid_com.h
index 730971d6a5..2ef67c6385 100644
--- a/apps/plugins/zxbox/zxvid_com.h
+++ b/apps/plugins/zxbox/zxvid_com.h
@@ -2,8 +2,8 @@
2#define ZXVIDCOMMON_H 2#define ZXVIDCOMMON_H
3#include "zxconfig.h" 3#include "zxconfig.h"
4 4
5#ifdef USE_GRAY 5#ifdef USE_GREY
6#include "../lib/gray.h" 6#include "../lib/grey.h"
7#endif 7#endif
8 8
9#include "spscr_p.h" 9#include "spscr_p.h"
diff --git a/apps/plugins/zxbox/zxvid_grey.c b/apps/plugins/zxbox/zxvid_grey.c
index 8491e6bf18..de9cd97874 100644
--- a/apps/plugins/zxbox/zxvid_grey.c
+++ b/apps/plugins/zxbox/zxvid_grey.c
@@ -1,5 +1,5 @@
1#include "zxvid_com.h" 1#include "zxvid_com.h"
2#if !defined HAVE_LCD_COLOR && defined USE_GRAY 2#if !defined HAVE_LCD_COLOR && defined USE_GREY
3/* 3/*
4use for slightly different colors 4use for slightly different colors
5#define N0 0x04 5#define N0 0x04
@@ -67,8 +67,8 @@ void update_screen(void)
67 srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */ 67 srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */
68 } 68 }
69 69
70#ifdef USE_BUFFERED_GRAY 70#ifdef USE_BUFFERED_GREY
71 gray_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT); 71 grey_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT);
72#endif 72#endif
73 73
74 if ( settings.showfps ) { 74 if ( settings.showfps ) {
@@ -77,8 +77,8 @@ void update_screen(void)
77 if ((*rb->current_tick-start_time) > TPF ) 77 if ((*rb->current_tick-start_time) > TPF )
78 percent = 100*video_frames/((*rb->current_tick-start_time)/TPF); 78 percent = 100*video_frames/((*rb->current_tick-start_time)/TPF);
79 rb->snprintf(str,sizeof(str),"%d %%",percent); 79 rb->snprintf(str,sizeof(str),"%d %%",percent);
80#if defined USE_BUFFERED_GRAY 80#if defined USE_BUFFERED_GREY
81 gray_putsxy(0,0,str); 81 grey_putsxy(0,0,str);
82#else 82#else
83 LOGF(str); 83 LOGF(str);
84#endif 84#endif
@@ -86,10 +86,10 @@ void update_screen(void)
86 } 86 }
87 87
88 88
89#if defined USE_BUFFERED_GRAY 89#if defined USE_BUFFERED_GREY
90 gray_update(); 90 grey_update();
91#else 91#else
92 gray_ub_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT); 92 grey_ub_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT);
93#endif 93#endif
94 94
95} 95}