Skip to content

Commit

Permalink
few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oshaboy committed Nov 4, 2023
1 parent 7eac28a commit 39a261c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions tools/chafa/character_canvas_to_conhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ gsize canvas_to_conhost(ChafaCanvas * canvas, CONHOST_LINE ** lines){
ChafaCanvasConfig * config;
ChafaCanvasMode canvas_mode;



config = chafa_canvas_peek_config(canvas);
canvas_mode = chafa_canvas_config_get_canvas_mode(config);
if (
canvas_mode == CHAFA_CANVAS_MODE_INDEXED_240 ||
canvas_mode == CHAFA_CANVAS_MODE_INDEXED_256 ||
canvas_mode == CHAFA_CANVAS_MODE_TRUECOLOR
) return (gsize) -1;

config = chafa_canvas_peek_config(canvas);
canvas_mode = chafa_canvas_config_get_canvas_mode(config);
chafa_canvas_config_get_geometry(config, &width, &height);
(*lines)=g_malloc(height*sizeof(CONHOST_LINE));
static const gchar color_lut[16] = {
Expand Down
2 changes: 1 addition & 1 deletion tools/chafa/character_canvas_to_conhost.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ gboolean safe_WriteConsoleA (HANDLE chd, const gchar *data, gsize len);
gboolean safe_WriteConsoleW (HANDLE chd, const gunichar2 *data, gsize len);
gsize canvas_to_conhost(ChafaCanvas * canvas, CONHOST_LINE ** lines);
void write_image_conhost(const CONHOST_LINE * lines, gsize s);
void destroy_lines(const CONHOST_LINE * lines, gsize s);
void destroy_lines(CONHOST_LINE * lines, gsize s);
#endif

0 comments on commit 39a261c

Please sign in to comment.