4 /* screen routines for greyscale targets not using greyscale lib */
6 #if LCD_PIXELFORMAT == HORIZONTAL_PACKING
7 #define FB_WIDTH ((LCD_WIDTH+3)/4)
8 fb_data pixmask
[4] ICONST_ATTR
= {
11 #elif LCD_PIXELFORMAT == VERTICAL_PACKING
12 fb_data pixmask
[4] ICONST_ATTR
= {
13 0x03, 0x0C, 0x30, 0xC0
15 #elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
16 fb_data pixmask
[8] ICONST_ATTR
= {
17 0x0101, 0x0202, 0x0404, 0x0808, 0x1010, 0x2020, 0x4040, 0x8080
19 fb_data pixval
[4] ICONST_ATTR
= {
20 0x0000, 0x0001, 0x0100, 0x0101
24 static const unsigned char graylevels
[16] = {
25 0, 1, 1, 1, 2, 2, 3, 3,
26 0, 1, 1, 1, 2, 2, 3, 3
29 void init_spect_scr(void)
32 unsigned mask
= settings
.invert_colors
? 0 : 3;
34 for(i
= 0; i
< 16; i
++)
35 sp_colors
[i
] = graylevels
[i
] ^ mask
;
37 sp_image
= (char *) &image_array
;
38 spscr_init_mask_color();
39 spscr_init_line_pointers(HEIGHT
);
42 void update_screen(void)
48 int srcx
, srcy
=0; /* x / y coordinates in source image */
49 image
= sp_image
+ ( (Y_OFF
)*(WIDTH
) ) + X_OFF
;
51 #if LCD_PIXELFORMAT == HORIZONTAL_PACKING
52 for(y
= 0; y
< LCD_HEIGHT
; y
++)
54 frameb
= rb
->lcd_framebuffer
+ (y
) * FB_WIDTH
;
55 srcx
= 0; /* reset our x counter before each row... */
56 for(x
= 0; x
< LCD_WIDTH
; x
++)
58 mask
= ~pixmask
[x
& 3];
59 frameb
[x
>> 2] = (frameb
[x
>> 2] & mask
) | ((image
[(srcx
>>16)]&0x3) << ((3-(x
& 3 )) * 2 ));
60 srcx
+= X_STEP
; /* move through source image */
62 srcy
+= Y_STEP
; /* move through the source image... */
63 image
+= (srcy
>>16)*WIDTH
; /* and possibly to the next row. */
64 srcy
&= 0xffff; /* set up the y-coordinate between 0 and 1 */
66 #elif LCD_PIXELFORMAT == VERTICAL_PACKING
68 for(y
= 0; y
< LCD_HEIGHT
; y
++)
70 frameb
= rb
->lcd_framebuffer
+ (y
/4) * LCD_WIDTH
;
71 srcx
= 0; /* reset our x counter before each row... */
72 shift
= ((y
& 3 ) * 2 );
73 mask
= ~pixmask
[y
& 3];
74 for(x
= 0; x
< LCD_WIDTH
; x
++)
76 frameb
[x
] = (frameb
[x
] & mask
) | ((image
[(srcx
>>16)]&0x3) << shift
);
77 srcx
+= X_STEP
; /* move through source image */
79 srcy
+= Y_STEP
; /* move through the source image... */
80 image
+= (srcy
>>16)*WIDTH
; /* and possibly to the next row. */
81 srcy
&= 0xffff; /* set up the y-coordinate between 0 and 1 */
83 #elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
85 for(y
= 0; y
< LCD_HEIGHT
; y
++)
87 frameb
= rb
->lcd_framebuffer
+ (y
/8) * LCD_WIDTH
;
88 srcx
= 0; /* reset our x counter before each row... */
90 mask
= ~pixmask
[y
& 7];
91 for(x
= 0; x
< LCD_WIDTH
; x
++)
93 frameb
[x
] = (frameb
[x
] & mask
) | (pixval
[image
[(srcx
>>16)]&0x3] << shift
);
94 srcx
+= X_STEP
; /* move through source image */
96 srcy
+= Y_STEP
; /* move through the source image... */
97 image
+= (srcy
>>16)*WIDTH
; /* and possibly to the next row. */
98 srcy
&= 0xffff; /* set up the y-coordinate between 0 and 1 */
102 if ( settings
.showfps
) {
104 int TPF
= HZ
/50;/* ticks per frame */
105 if ((*rb
->current_tick
-start_time
) > TPF
)
106 percent
= 100*video_frames
/((*rb
->current_tick
-start_time
)/TPF
);
107 rb
->lcd_putsxyf(0,0,"%d %%",percent
);
114 #endif /* !USE_GREY */