Skip to content

Commit 0307b9c

Browse files
committed
vdisp get_splashscreen: fixed assert
1. static_assert could not have been strictly speaking used (splash_width is not constexpr), although it worked most of the time (except macports clang-mp-14) 2. the assertion was actually inverted (but the equality is included and is the case for both cases so both work)
1 parent 925c9e5 commit 0307b9c

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/video_display.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -626,14 +626,9 @@ struct video_frame *get_splashscreen()
626626
{
627627
struct video_desc desc;
628628

629-
enum {
630-
FBUF_W = 512,
631-
FBUF_H = 512,
632-
FBUF_CS = RGBA,
633-
};
634-
desc.width = FBUF_W;
635-
desc.height = FBUF_H;
636-
desc.color_spec = (codec_t) FBUF_CS;
629+
desc.width = splash_width;
630+
desc.height = splash_height;
631+
desc.color_spec = RGBA;
637632
desc.interlacing = PROGRESSIVE;
638633
desc.fps = 1;
639634
desc.tile_count = 1;
@@ -644,8 +639,7 @@ struct video_frame *get_splashscreen()
644639
memset(frame->tiles[0].data, 0, frame->tiles[0].data_len);
645640
// center the pixture; framebuffer size must be greater or equal
646641
// the splash size
647-
_Static_assert(splash_width >= FBUF_W && splash_height >= FBUF_H,
648-
"framebuffer smaller than splash size");
642+
assert(splash_width <= desc.width && splash_height <= desc.height);
649643
for (unsigned int y = 0; y < splash_height; ++y) {
650644
char *line = frame->tiles[0].data;
651645
line += vc_get_linesize(frame->tiles[0].width,
@@ -654,7 +648,7 @@ struct video_frame *get_splashscreen()
654648
line += vc_get_linesize(
655649
(frame->tiles[0].width - splash_width)/2,
656650
frame->color_spec);
657-
_Static_assert((codec_t) FBUF_CS == RGBA, "RGBA is expected");
651+
assert(desc.color_spec == RGBA);
658652
for (unsigned int x = 0; x < splash_width; ++x) {
659653
HEADER_PIXEL(data,line);
660654
line[3] = 0xFF; // alpha

0 commit comments

Comments
 (0)