diff options
Diffstat (limited to 'apps/plugins/zxbox/zxvid_4bpp.c')
-rw-r--r-- | apps/plugins/zxbox/zxvid_4bpp.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/apps/plugins/zxbox/zxvid_4bpp.c b/apps/plugins/zxbox/zxvid_4bpp.c new file mode 100644 index 0000000000..e9943d9571 --- /dev/null +++ b/apps/plugins/zxbox/zxvid_4bpp.c | |||
@@ -0,0 +1,81 @@ | |||
1 | #include "zxvid_com.h" | ||
2 | |||
3 | #if !defined USE_GRAY && LCD_PIXELFORMAT == HORIZONTAL_PACKING && LCD_DEPTH < 4 | ||
4 | /* screen routines for greyscale targets not using greyscale lib */ | ||
5 | #define FB_WIDTH ((LCD_WIDTH+3)/4) | ||
6 | unsigned char pixmask[4] ICONST_ATTR = { | ||
7 | 0xC0, 0x30, 0x0C, 0x03 | ||
8 | }; | ||
9 | |||
10 | void init_spect_scr(void) | ||
11 | { | ||
12 | sp_colors[0] = 0;/* BLACK ? */ | ||
13 | sp_colors[1] = 1;/* BLUE ? */ | ||
14 | sp_colors[2] = 1;/* RED ? */ | ||
15 | sp_colors[3] = 1;/* MAGENTA ? */ | ||
16 | sp_colors[4] = 2;/* GREEN ? */ | ||
17 | sp_colors[5] = 2;/* CYAN ? */ | ||
18 | sp_colors[6] = 3;/* YELLOW ? */ | ||
19 | sp_colors[7] = 3;/* WHITE ? */ | ||
20 | |||
21 | /* same but 'light/bright' colors */ | ||
22 | sp_colors[8] = 1; | ||
23 | sp_colors[9] = 1; | ||
24 | sp_colors[10] = 1; | ||
25 | sp_colors[11] = 1; | ||
26 | sp_colors[12] = 2; | ||
27 | sp_colors[13] = 2; | ||
28 | sp_colors[14] = 3; | ||
29 | sp_colors[15] = 3; | ||
30 | |||
31 | if ( !settings.invert_colors ){ | ||
32 | int i; | ||
33 | for ( i = 0 ; i < 16 ; i++ ) | ||
34 | sp_colors[i] = 3 - sp_colors[i]; | ||
35 | } | ||
36 | sp_image = (char *) &image_array; | ||
37 | spscr_init_mask_color(); | ||
38 | spscr_init_line_pointers(HEIGHT); | ||
39 | |||
40 | } | ||
41 | void update_screen(void) | ||
42 | { | ||
43 | char str[80]; | ||
44 | |||
45 | fb_data *frameb; | ||
46 | int y=0; | ||
47 | int x=0; | ||
48 | unsigned char* image; | ||
49 | int srcx, srcy=0; /* x / y coordinates in source image */ | ||
50 | image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF; | ||
51 | unsigned mask; | ||
52 | |||
53 | for(y = 0; y < LCD_HEIGHT; y++) | ||
54 | { | ||
55 | frameb = rb->lcd_framebuffer + (y) * FB_WIDTH; | ||
56 | srcx = 0; /* reset our x counter before each row... */ | ||
57 | for(x = 0; x < LCD_WIDTH; x++) | ||
58 | { | ||
59 | mask = pixmask[x & 3]; | ||
60 | frameb[x >> 2] = (frameb[x >> 2] & ~mask) | ((image[(srcx>>16)]&0x3) << ((3-(x & 3 )) * 2 )); | ||
61 | srcx += X_STEP; /* move through source image */ | ||
62 | } | ||
63 | srcy += Y_STEP; /* move through the source image... */ | ||
64 | image += (srcy>>16)*WIDTH; /* and possibly to the next row. */ | ||
65 | srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */ | ||
66 | } | ||
67 | |||
68 | if ( settings.showfps ) { | ||
69 | int percent=0; | ||
70 | int TPF = HZ/50;/* ticks per frame */ | ||
71 | if ((*rb->current_tick-start_time) > TPF ) | ||
72 | percent = 100*video_frames/((*rb->current_tick-start_time)/TPF); | ||
73 | rb->snprintf(str,sizeof(str),"%d %%",percent); | ||
74 | rb->lcd_putsxy(0,0,str); | ||
75 | } | ||
76 | |||
77 | |||
78 | rb -> lcd_update(); | ||
79 | } | ||
80 | |||
81 | #endif | ||