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
This commit is contained in:
Jens Arnold 2008-01-04 23:42:38 +00:00
parent d3586837fa
commit feb5b15e9b
35 changed files with 2872 additions and 357 deletions

View file

@ -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);

View file

@ -42,8 +42,8 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#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

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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
}