File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -630,9 +630,14 @@ struct video_frame *get_splashscreen()
630
630
{
631
631
struct video_desc desc ;
632
632
633
- desc .width = 512 ;
634
- desc .height = 512 ;
635
- desc .color_spec = RGBA ;
633
+ enum {
634
+ FBUF_W = 512 ,
635
+ FBUF_H = 512 ,
636
+ FBUF_CS = RGBA ,
637
+ };
638
+ desc .width = FBUF_W ;
639
+ desc .height = FBUF_H ;
640
+ desc .color_spec = (codec_t ) FBUF_CS ;
636
641
desc .interlacing = PROGRESSIVE ;
637
642
desc .fps = 1 ;
638
643
desc .tile_count = 1 ;
@@ -641,6 +646,10 @@ struct video_frame *get_splashscreen()
641
646
642
647
const char * data = splash_data ;
643
648
memset (frame -> tiles [0 ].data , 0 , frame -> tiles [0 ].data_len );
649
+ // center the pixture; framebuffer size must be greater or equal
650
+ // the splash size
651
+ _Static_assert (splash_width >= FBUF_W && splash_height >= FBUF_H ,
652
+ "framebuffer smaller than splash size" );
644
653
for (unsigned int y = 0 ; y < splash_height ; ++ y ) {
645
654
char * line = frame -> tiles [0 ].data ;
646
655
line += vc_get_linesize (frame -> tiles [0 ].width ,
@@ -649,6 +658,7 @@ struct video_frame *get_splashscreen()
649
658
line += vc_get_linesize (
650
659
(frame -> tiles [0 ].width - splash_width )/2 ,
651
660
frame -> color_spec );
661
+ _Static_assert ((codec_t ) FBUF_CS == RGBA , "RGBA is expected" );
652
662
for (unsigned int x = 0 ; x < splash_width ; ++ x ) {
653
663
HEADER_PIXEL (data ,line );
654
664
line += 4 ;
You can’t perform that action at this time.
0 commit comments