Fix FS#10486 - "fuze screen not drawn correctly on backlight turn-on if playlist...
[kugel-rb/myfork.git] / apps / plugins / zxbox / zxvid_16bpp.c
blob4a05c69f970279a55b28f6eb2d869c1dec7201b0
1 #include "zxvid_com.h"
3 /* screen routines for color targets */
5 #define N0 0x00
6 #define N1 0xC0
7 #define B0 0x00
8 #define B1 0xFF
10 #define IN0 (0xFF-N0)
11 #define IN1 (0xFF-N1)
12 #define IB0 (0xFF-B0)
13 #define IB1 (0xFF-B1)
15 static const fb_data _16bpp_colors[32] = {
16 /* normal */
17 LCD_RGBPACK(N0, N0, N0), LCD_RGBPACK(N0, N0, N1),
18 LCD_RGBPACK(N1, N0, N0), LCD_RGBPACK(N1, N0, N1),
19 LCD_RGBPACK(N0, N1, N0), LCD_RGBPACK(N0, N1, N1),
20 LCD_RGBPACK(N1, N1, N0), LCD_RGBPACK(N1, N1, N1),
21 LCD_RGBPACK(B0, B0, B0), LCD_RGBPACK(B0, B0, B1),
22 LCD_RGBPACK(B1, B0, B0), LCD_RGBPACK(B1, B0, B1),
23 LCD_RGBPACK(B0, B1, B0), LCD_RGBPACK(B0, B1, B1),
24 LCD_RGBPACK(B1, B1, B0), LCD_RGBPACK(B1, B1, B1),
25 /* inverted */
26 LCD_RGBPACK(IN0, IN0, IN0), LCD_RGBPACK(IN0, IN0, IN1),
27 LCD_RGBPACK(IN1, IN0, IN0), LCD_RGBPACK(IN1, IN0, IN1),
28 LCD_RGBPACK(IN0, IN1, IN0), LCD_RGBPACK(IN0, IN1, IN1),
29 LCD_RGBPACK(IN1, IN1, IN0), LCD_RGBPACK(IN1, IN1, IN1),
30 LCD_RGBPACK(IB0, IB0, IB0), LCD_RGBPACK(IB0, IB0, IB1),
31 LCD_RGBPACK(IB1, IB0, IB0), LCD_RGBPACK(IB1, IB0, IB1),
32 LCD_RGBPACK(IB0, IB1, IB0), LCD_RGBPACK(IB0, IB1, IB1),
33 LCD_RGBPACK(IB1, IB1, IB0), LCD_RGBPACK(IB1, IB1, IB1),
36 void init_spect_scr(void)
38 int i;
39 int offset = settings.invert_colors ? 16 : 0;
41 for(i = 0; i < 16; i++)
42 sp_colors[i] = i + offset;
44 sp_image = (char *) &image_array;
45 spscr_init_mask_color();
46 spscr_init_line_pointers(HEIGHT);
50 void update_screen(void)
52 char str[80];
53 fb_data *frameb;
55 int y=0;
57 #if LCD_HEIGHT >= ZX_HEIGHT && LCD_WIDTH >= ZX_WIDTH
58 byte *scrptr;
59 scrptr = (byte *) SPNM(image);
60 frameb = rb->lcd_framebuffer;
61 for ( y = 0 ; y < HEIGHT*WIDTH; y++ ){
62 frameb[y] = _16bpp_colors[(unsigned)sp_image[y]];
65 #else
66 int x=0;
67 int srcx, srcy=0; /* x / y coordinates in source image */
68 unsigned char* image;
69 image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF;
70 frameb = rb->lcd_framebuffer;
71 for(y = 0; y < LCD_HEIGHT; y++)
73 srcx = 0; /* reset our x counter before each row... */
74 for(x = 0; x < LCD_WIDTH; x++)
76 *frameb = _16bpp_colors[image[srcx>>16]];
77 srcx += X_STEP; /* move through source image */
78 frameb++;
80 srcy += Y_STEP; /* move through the source image... */
81 image += (srcy>>16)*WIDTH; /* and possibly to the next row. */
82 srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */
85 #endif
86 if ( settings.showfps ) {
87 int percent=0;
88 int TPF = HZ/50;/* ticks per frame */
89 if ((*rb->current_tick-start_time) > TPF )
90 percent = 100*video_frames/((*rb->current_tick-start_time)/TPF);
91 rb->snprintf(str,sizeof(str),"%d %%",percent);
92 rb->lcd_putsxy(0,0,str);
94 rb -> lcd_update();