summaryrefslogtreecommitdiff
path: root/apps/plugins/zxbox/zxvid_grey.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/zxbox/zxvid_grey.c')
-rw-r--r--apps/plugins/zxbox/zxvid_grey.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/apps/plugins/zxbox/zxvid_grey.c b/apps/plugins/zxbox/zxvid_grey.c
index de9cd97874..d713eba4b5 100644
--- a/apps/plugins/zxbox/zxvid_grey.c
+++ b/apps/plugins/zxbox/zxvid_grey.c
@@ -1,40 +1,28 @@
1#include "zxvid_com.h" 1#include "zxvid_com.h"
2#if !defined HAVE_LCD_COLOR && defined USE_GREY
3/*
4use for slightly different colors
5#define N0 0x04
6#define N1 0x34
7 2
8#define B0 0x08 3#ifdef USE_GREY
9#define B1 0x3F
10*/
11 4
12/* these ones are the same as for color targets ... may be tweak for greyscale? */
13#define N0 0x00 5#define N0 0x00
14#define N1 0xAA 6#define N1 0xC0
15 7#define B0 0x00
16#define B0 0x55
17#define B1 0xFF 8#define B1 0xFF
18static unsigned char graybuffer[LCD_HEIGHT*LCD_WIDTH] IBSS_ATTR; /* off screen buffer */
19 9
20struct rgb norm_colors[COLORNUM]={ 10static unsigned char graybuffer[LCD_HEIGHT*LCD_WIDTH] IBSS_ATTR; /* off screen buffer */
21 {0,0,0},{N0,N0,N1},{N1,N0,N0},{N1,N0,N1},
22 {N0,N1,N0},{N0,N1,N1},{N1,N1,N0},{N1,N1,N1},
23 11
24 {0x15,0x15,0x15},{B0,B0,B1},{B1,B0,B0},{B1,B0,B1}, 12static const unsigned char graylevels[16] = {
25 {B0,B1,B0},{B0,B1,B1},{B1,B1,B0},{B1,B1,B1} 13 N0, (6*N0+1*N1)/7, (5*N0+2*N1)/7, (4*N0+3*N1)/7,
14 (3*N0+4*N1)/7, (2*N0+5*N1)/7, (1*N0+6*N1)/7, N1,
15 B0, (6*B0+1*B1)/7, (5*B0+2*B1)/7, (4*B0+3*B1)/7,
16 (3*B0+4*B1)/7, (2*B0+5*B1)/7, (1*B0+6*B1)/7, B1
26}; 17};
27 18
28void init_spect_scr(void) 19void init_spect_scr(void)
29{ 20{
30 int i; 21 int i;
22 unsigned mask = settings.invert_colors ? 0xFF : 0;
23
31 for(i = 0; i < 16; i++) 24 for(i = 0; i < 16; i++)
32 sp_colors[i] = 0.3*norm_colors[i].r + 0.59*norm_colors[i].g + 0.11*norm_colors[i].b; 25 sp_colors[i] = graylevels[i] ^ mask;
33 if ( settings.invert_colors ){
34 int i;
35 for ( i = 0 ; i < 16 ; i++ )
36 sp_colors[i] = 255 - sp_colors[i];
37 }
38 26
39 sp_image = (char *) &image_array; 27 sp_image = (char *) &image_array;
40 spscr_init_mask_color(); 28 spscr_init_mask_color();
@@ -52,7 +40,7 @@ void update_screen(void)
52 int srcx, srcy=0; /* x / y coordinates in source image */ 40 int srcx, srcy=0; /* x / y coordinates in source image */
53 image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF; 41 image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF;
54 unsigned char* buf_ptr; 42 unsigned char* buf_ptr;
55 buf_ptr = (unsigned char*) &graybuffer; 43 buf_ptr = graybuffer;
56 for(y = 0; y < LCD_HEIGHT; y++) 44 for(y = 0; y < LCD_HEIGHT; y++)
57 { 45 {
58 srcx = 0; /* reset our x counter before each row... */ 46 srcx = 0; /* reset our x counter before each row... */
@@ -94,4 +82,4 @@ void update_screen(void)
94 82
95} 83}
96 84
97#endif 85#endif /* USE_GREY */