[util] Allow HB_CHAFA=2/3 to enable wedges/all symbols in Chafa

pull/3730/head
Behdad Esfahbod 3 years ago
parent b4e95965c8
commit faa8cdc898
  1. 13
      util/helper-cairo-ansi.hh

@ -41,7 +41,7 @@
# define CELL_H (2 * CELL_W)
static void
chafa_print_image_rgb24 (const void *data, int width, int height, int stride)
chafa_print_image_rgb24 (const void *data, int width, int height, int stride, int level)
{
ChafaTermInfo *term_info;
ChafaSymbolMap *symbol_map;
@ -85,7 +85,8 @@ chafa_print_image_rgb24 (const void *data, int width, int height, int stride)
chafa_symbol_map_add_by_tags (symbol_map,
(ChafaSymbolTags) (CHAFA_SYMBOL_TAG_BLOCK
| CHAFA_SYMBOL_TAG_SPACE
//| CHAFA_SYMBOL_TAG_WEDGE
| (level >= 2 ? CHAFA_SYMBOL_TAG_WEDGE : 0)
| (level >= 3 ? CHAFA_SYMBOL_TAG_ALL : 0)
));
config = chafa_canvas_config_new ();
@ -204,11 +205,11 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface,
{
#ifdef HAVE_CHAFA
const char *env = getenv ("HB_CHAFA");
bool chafa = true;
int chafa_level = 1;
if (env)
chafa = atoi (env);
if (chafa)
chafa_print_image_rgb24 (data, width, height, stride);
chafa_level = atoi (env);
if (chafa_level)
chafa_print_image_rgb24 (data, width, height, stride, chafa_level);
else
#endif
ansi_print_image_rgb24 (data, width, height, stride / 4);

Loading…
Cancel
Save