From feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 4 Jan 2008 23:42:38 +0000 Subject: 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 --- apps/plugins/zxbox/interf.c | 6 +++--- apps/plugins/zxbox/spmain.c | 14 +++++++------- apps/plugins/zxbox/zxbox.c | 32 ++++++++++++++++---------------- apps/plugins/zxbox/zxconfig.h | 9 ++++----- apps/plugins/zxbox/zxvid_4bpp.c | 2 +- apps/plugins/zxbox/zxvid_com.h | 4 ++-- apps/plugins/zxbox/zxvid_grey.c | 16 ++++++++-------- 7 files changed, 41 insertions(+), 42 deletions(-) (limited to 'apps/plugins/zxbox') 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 @@ -/* +/* * Copyright (C) 1996-1998 Szeredi Miklos * Email: mszeredi@inf.bme.hu * @@ -94,7 +94,7 @@ char *spif_get_tape_fileinfo(int *startp, int *nump) void put_msg(const char *msg) { -#ifndef USE_GRAY +#ifndef USE_GREY rb->splash (HZ/2, msg ); #else LOGF(msg); @@ -105,7 +105,7 @@ void put_msg(const char *msg) void put_tmp_msg(const char *msg) { -#ifndef USE_GRAY +#ifndef USE_GREY rb->splash (HZ/10, msg ); #else 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 @@ #include #include #include -#ifdef USE_GRAY -#include "../lib/gray.h" +#ifdef USE_GREY +#include "../lib/grey.h" #endif #include "zxbox_keyb.h" @@ -426,8 +426,8 @@ static bool zxbox_menu(void) else intkeys[i] = (unsigned) settings.keymap[i]; } -#ifdef USE_GRAY - gray_show(true); +#ifdef USE_GREY + grey_show(true); #endif return (exit); } @@ -465,8 +465,8 @@ static void run_singlemode(void) if (zxbox_menu()){ /* Save the user settings if they have changed */ if (rb->memcmp(&settings,&old_settings,sizeof(settings))!=0) { -#ifdef USE_GRAY - gray_show(false); +#ifdef USE_GREY + grey_show(false); #endif rb->splash(0, "Saving settings..."); configfile_save(GLOBALCFG, config,sizeof(config)/sizeof(*config),SETTINGS_VERSION); @@ -531,7 +531,7 @@ static void init_load(void *parameter) check_params (parameter); if(spcf_init_snapshot != NULL) { -#ifndef USE_GRAY +#ifndef USE_GREY rb->splash(HZ, "Loading snapshot '%s'", spcf_init_snapshot); #endif 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 ]; static int previous_state; -#ifdef USE_GRAY +#ifdef USE_GREY static unsigned char *gbuf; static size_t gbuf_size = 0; #endif @@ -69,17 +69,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) sp_init(); -#ifdef USE_GRAY +#ifdef USE_GREY /* get the remainder of the plugin buffer */ gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); -#ifdef USE_BUFFERED_GRAY - gray_init(rb, gbuf, gbuf_size, true, LCD_WIDTH, LCD_HEIGHT, 15, 0, NULL); +#ifdef USE_BUFFERED_GREY + grey_init(rb, gbuf, gbuf_size, true, LCD_WIDTH, LCD_HEIGHT, NULL); #else - gray_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT, 15, 0, NULL); -#endif /* USE_BUFFERED_GRAY */ - /* switch on grayscale overlay */ - gray_show(true); -#endif /* USE_GRAY */ + grey_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT, NULL); +#endif /* USE_BUFFERED_GREY */ + /* switch on greyscale overlay */ + grey_show(true); +#endif /* USE_GREY */ #if defined(HAVE_ADJUSTABLE_CPU_FREQ) @@ -102,9 +102,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->cpu_boost(false); #endif -#ifdef USE_GRAY -gray_show(false); -gray_release(); +#ifdef USE_GREY +grey_show(false); +grey_release(); #endif #if CONFIG_CODEC == SWCODEC && !defined SIMULATOR @@ -133,8 +133,8 @@ void spkb_process_events( int evenframe ) rb->cpu_boost(false); #endif exit_requested=1; -#ifdef USE_GRAY - gray_show(false); +#ifdef USE_GREY + grey_show(false); #endif return; } @@ -151,8 +151,8 @@ void spkb_process_events( int evenframe ) rb->cpu_boost(false); #endif exit_requested=1; -#ifdef USE_GRAY - gray_show(false); +#ifdef USE_GREY + grey_show(false); #endif return; } 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]; #define SETTINGS_MIN_VERSION 2 #define SETTINGS_VERSION 2 -/* undef not to use grayscale lib */ -#if !defined HAVE_LCD_COLOR && LCD_PIXELFORMAT != HORIZONTAL_PACKING -/* grayscale is far slower for now at least on ipods :( */ -#define USE_GRAY -#define USE_BUFFERED_GRAY +/* undef not to use greyscale lib */ +#if !defined HAVE_LCD_COLOR +#define USE_GREY +#define USE_BUFFERED_GREY #endif 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 @@ #include "zxvid_com.h" -#if !defined USE_GRAY && LCD_DEPTH < 4 +#if !defined USE_GREY && LCD_DEPTH < 4 /* screen routines for greyscale targets not using greyscale lib */ #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 @@ #define ZXVIDCOMMON_H #include "zxconfig.h" -#ifdef USE_GRAY -#include "../lib/gray.h" +#ifdef USE_GREY +#include "../lib/grey.h" #endif #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 @@ #include "zxvid_com.h" -#if !defined HAVE_LCD_COLOR && defined USE_GRAY +#if !defined HAVE_LCD_COLOR && defined USE_GREY /* use for slightly different colors #define N0 0x04 @@ -67,8 +67,8 @@ void update_screen(void) srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */ } -#ifdef USE_BUFFERED_GRAY - gray_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT); +#ifdef USE_BUFFERED_GREY + grey_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT); #endif if ( settings.showfps ) { @@ -77,8 +77,8 @@ void update_screen(void) if ((*rb->current_tick-start_time) > TPF ) percent = 100*video_frames/((*rb->current_tick-start_time)/TPF); rb->snprintf(str,sizeof(str),"%d %%",percent); -#if defined USE_BUFFERED_GRAY - gray_putsxy(0,0,str); +#if defined USE_BUFFERED_GREY + grey_putsxy(0,0,str); #else LOGF(str); #endif @@ -86,10 +86,10 @@ void update_screen(void) } -#if defined USE_BUFFERED_GRAY - gray_update(); +#if defined USE_BUFFERED_GREY + grey_update(); #else - gray_ub_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT); + grey_ub_gray_bitmap(graybuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT); #endif } -- cgit v1.2.3