caca: updates

- added splashscreen
- fixed RGB-shifts
- redraw last frawme if resized
This commit is contained in:
Martin Pulec
2023-03-09 12:25:55 +01:00
parent 948d421b0a
commit 37876bbec8
4 changed files with 56 additions and 36 deletions

View File

@@ -56,6 +56,8 @@
#include "utils/macros.h"
#include "utils/misc.h"
#include "utils/color_out.h"
#include "video.h"
#include "video_display/splashscreen.h"
#define STRERROR_BUF_LEN 1024
@@ -304,3 +306,34 @@ uint32_t parse_uint32(const char *value_str) noexcept(false)
}
return val;
}
struct video_frame *get_splashscreen()
{
struct video_desc desc;
desc.width = 512;
desc.height = 512;
desc.color_spec = RGBA;
desc.interlacing = PROGRESSIVE;
desc.fps = 1;
desc.tile_count = 1;
struct video_frame *frame = vf_alloc_desc_data(desc);
const char *data = splash_data;
memset(frame->tiles[0].data, 0, frame->tiles[0].data_len);
for (unsigned int y = 0; y < splash_height; ++y) {
char *line = frame->tiles[0].data;
line += vc_get_linesize(frame->tiles[0].width,
frame->color_spec) *
(((frame->tiles[0].height - splash_height) / 2) + y);
line += vc_get_linesize(
(frame->tiles[0].width - splash_width)/2,
frame->color_spec);
for (unsigned int x = 0; x < splash_width; ++x) {
HEADER_PIXEL(data,line);
line += 4;
}
}
return frame;
}