Skip to content
Snippets Groups Projects
Commit 60e40400 authored by deuce's avatar deuce
Browse files

The cterm_screen no longer has separate arrays for foreground and background.

Also, the vmem is an array of struct vmem_cell.
parent 715a7f83
No related branches found
No related tags found
No related merge requests found
......@@ -1842,19 +1842,6 @@ CIOLIBEXPORT struct ciolib_screen * CIOLIBCALL ciolib_savescreen(void)
free(ret);
return NULL;
}
ret->foreground = malloc(ret->text_info.screenwidth * ret->text_info.screenheight * sizeof(ret->foreground[0]));
if (ret->foreground == NULL) {
free(ret->vmem);
free(ret);
return NULL;
}
ret->background = malloc(ret->text_info.screenwidth * ret->text_info.screenheight * sizeof(ret->background[0]));
if (ret->background == NULL) {
free(ret->foreground);
free(ret->vmem);
free(ret);
return NULL;
}
if (vmode != -1) {
ret->pixels = ciolib_getpixels(0, 0, vparams[vmode].charwidth * vparams[vmode].cols - 1, vparams[vmode].charheight * vparams[vmode].rows - 1);
......@@ -1875,8 +1862,6 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_freescreen(struct ciolib_screen *scrn)
return;
ciolib_freepixels(scrn->pixels);
FREE_AND_NULL(scrn->background);
FREE_AND_NULL(scrn->foreground);
FREE_AND_NULL(scrn->vmem);
free(scrn);
}
......
......@@ -258,26 +258,24 @@ struct ciolib_pixels {
uint32_t height;
};
struct vmem_cell {
uint8_t legacy_attr;
uint8_t ch;
uint8_t font;
uint32_t fg; // RGB 00RRGGBB High bit indicates palette colour
uint32_t bg; // RGB 00RRGGBB High bit indicates palette colour
};
struct ciolib_screen {
uint32_t fg_colour;
uint32_t bg_colour;
int flags;
int fonts[5];
struct ciolib_pixels *pixels;
void *vmem;
uint32_t *foreground;
uint32_t *background;
struct vmem_cell *vmem;
struct text_info text_info;
};
struct vmem_cell {
uint8_t legacy_attr;
uint8_t ch;
uint8_t font;
uint32_t fg; // RGB 00RRGGBB High bit indicates palette colour
uint32_t bg; // RGB 00RRGGBB High bit indicates palette colour
};
#define CONIO_FIRST_FREE_FONT 43
typedef struct {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment