Rename variables sectorbuf and verbose to avoid clashes in rbutil. Cleanup exports...
[Rockbox.git] / apps / plugins / zxbox / zxvid_16bpp.c
blob336e1c2447a5066eb32bcc0edf199fc6b356c26d
1 #include "zxvid_com.h"
3 #if LCD_DEPTH > 4
4 /* screen routines for color targets */
6 /*
7 use for slightly different colors
8 #define N0 0x04
9 #define N1 0x34
11 #define B0 0x08
12 #define B1 0x3F
15 #define N0 0x00
16 #define N1 0xC0
18 #define B0 0x00
19 #define B1 0xFF
21 struct rgb norm_colors[COLORNUM]={
22 {0,0,0},{N0,N0,N1},{N1,N0,N0},{N1,N0,N1},
23 {N0,N1,N0},{N0,N1,N1},{N1,N1,N0},{N1,N1,N1},
25 {0,0,0},{B0,B0,B1},{B1,B0,B0},{B1,B0,B1},
26 {B0,B1,B0},{B0,B1,B1},{B1,B1,B0},{B1,B1,B1}
30 /* since emulator uses array of bytes for screen representation
31 * short 16b colors won't fit there */
32 short _16bpp_colors[16] IBSS_ATTR;
34 void init_spect_scr(void)
36 int i;
38 for(i = 0; i < 16; i++)
39 sp_colors[i] = i;
40 for(i = 0; i < 16; i++)
41 _16bpp_colors[i] = LCD_RGBPACK(norm_colors[i].r,norm_colors[i].g,norm_colors[i].b);
42 if ( settings.invert_colors ){
43 for ( i = 0 ; i < 16 ; i++ )
44 _16bpp_colors[i] = 0xFFFFFF - _16bpp_colors[i];
46 sp_image = (char *) &image_array;
47 spscr_init_mask_color();
48 spscr_init_line_pointers(HEIGHT);
52 void update_screen(void)
54 char str[80];
55 fb_data *frameb;
57 int y=0;
59 #if LCD_HEIGHT >= ZX_HEIGHT && LCD_WIDTH >= ZX_WIDTH
60 byte *scrptr;
61 scrptr = (byte *) SPNM(image);
62 frameb = rb->lcd_framebuffer;
63 for ( y = 0 ; y < HEIGHT*WIDTH; y++ ){
64 frameb[y] = _16bpp_colors[(unsigned)sp_image[y]];
67 #else
68 int x=0;
69 int srcx, srcy=0; /* x / y coordinates in source image */
70 unsigned char* image;
71 image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF;
72 frameb = rb->lcd_framebuffer;
73 for(y = 0; y < LCD_HEIGHT; y++)
75 srcx = 0; /* reset our x counter before each row... */
76 for(x = 0; x < LCD_WIDTH; x++)
78 *frameb = _16bpp_colors[image[srcx>>16]];
79 srcx += X_STEP; /* move through source image */
80 frameb++;
82 srcy += Y_STEP; /* move through the source image... */
83 image += (srcy>>16)*WIDTH; /* and possibly to the next row. */
84 srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */
87 #endif
88 if ( settings.showfps ) {
89 int percent=0;
90 int TPF = HZ/50;/* ticks per frame */
91 if ((*rb->current_tick-start_time) > TPF )
92 percent = 100*video_frames/((*rb->current_tick-start_time)/TPF);
93 rb->snprintf(str,sizeof(str),"%d %%",percent);
94 rb->lcd_putsxy(0,0,str);
96 rb -> lcd_update();
100 #endif /* HAVE_LCD_COLOR */