compress bootloader background even further

This commit is contained in:
Mateusz Faderewski 2023-12-10 23:35:39 +01:00
parent e0721892b1
commit e1d9a8def3
2 changed files with 11 additions and 13 deletions

View File

@ -68,24 +68,22 @@ static const vi_regs_t vi_config[] = {{
static void display_decompress_background (uint32_t *background) {
uint32_t pixel_count = ((*background++) / sizeof(uint32_t));
uint32_t pixels_painted = 0;
uint8_t *background_data = (uint8_t *) (background);
uint32_t *framebuffer = (uint32_t *) (display_framebuffer);
int pixel_count = (int) ((*background++) / 3);
int pixels_painted = 0;
while (pixels_painted < pixel_count) {
int pixel_repeat = ((background_data[0]) + 1);
uint32_t pixel_value = (
((background_data[1]) << 24) |
((background_data[2]) << 16) |
((background_data[3]) << 8) |
(background_data[4])
);
uint32_t pixel = *background++;
int pixel_repeat = (((pixel >> 24) & 0xFF) + 1);
uint32_t pixel_value = (((pixel << 8) & 0xFFFFFF00) | 0xFF);
for (int i = 0; i < pixel_repeat; i++) {
cpu_io_write(framebuffer++, pixel_value);
}
pixels_painted += pixel_repeat;
background_data += 5;
}
}

View File

@ -47,10 +47,10 @@ if __name__ == '__main__':
try:
source_asset = Image.open(asset_input)
converted_asset = source_asset.convert('RGBA').tobytes()
converted_asset = source_asset.convert('RGB').tobytes()
if (asset_compress):
converted_asset = compress(converted_asset)
converted_asset = compress(converted_asset, step_size=3)
final_asset = open(asset_output, 'wb')
final_asset.write(converted_asset)