From 558a1652cf771623ac7c7c174aef8f7b148ac7ec Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 18 Jul 2021 18:11:05 -0400 Subject: [PATCH] fbcon_rebuild, necessary --- src/lib/linux.c | 12 ++++++++++-- src/lib/sprite.h | 1 + src/lib/termdesc.c | 7 ++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/lib/linux.c b/src/lib/linux.c index 9b4828779..8f4d55e94 100644 --- a/src/lib/linux.c +++ b/src/lib/linux.c @@ -18,6 +18,15 @@ int fbcon_wipe(sprixel* s, int ycell, int xcell){ return -1; } +int fbcon_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec){ + (void)s; + (void)ycell; + (void)xcell; + (void)auxvec; + logerror("Not yet implemented\n"); + return -1; +} + int fbcon_blit(struct ncplane* n, int linesize, const void* data, int leny, int lenx, const struct blitterargs* bargs){ int cols = bargs->u.pixel.spx->dimx; @@ -84,9 +93,8 @@ int fbcon_draw(const struct ncpile *p, sprixel* s, FILE* out, int y, int x){ for(int l = 0 ; l < s->pixy ; ++l){ // FIXME pixel size isn't necessarily 4B, line isn't necessarily psize*pixx size_t offset = ((l + y) * ti->pixx + x) * 4; - size_t lsize = ti->pixx * 4; + size_t lsize = s->pixx * 4; uint8_t* tl = ti->linux_fbuffer + offset; - // FIXME draw line const char* src = s->glyph + (l * s->pixx * 4); memcpy(tl, src, lsize); } diff --git a/src/lib/sprite.h b/src/lib/sprite.h index cb3efeed7..d88207000 100644 --- a/src/lib/sprite.h +++ b/src/lib/sprite.h @@ -170,6 +170,7 @@ int fbcon_wipe(sprixel* s, int ycell, int xcell); int sixel_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec); int kitty_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec); int iterm_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec); +int fbcon_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec); int kitty_rebuild_animation(sprixel* s, int ycell, int xcell, uint8_t* auxvec); int sixel_draw(const struct ncpile *p, sprixel* s, FILE* out, int y, int x); int kitty_draw(const struct ncpile *p, sprixel* s, FILE* out, int y, int x); diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index a07e7dfe8..3eaa96090 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -112,12 +112,13 @@ setup_kitty_bitmaps(tinfo* ti, int fd, int sixel_maxy_pristine){ // kitty 0.19.3 didn't have C=1, and thus needs sixel_maxy_pristine. it also // lacked animation, and thus requires the older interface. static inline void -setup_fbcon_bitmaps(tinfo* ti){ - // FIXME +setup_fbcon_bitmaps(tinfo* ti, int fd){ + ti->pixel_rebuild = fbcon_rebuild; ti->pixel_wipe = fbcon_wipe; ti->pixel_draw = fbcon_draw; ti->pixel_scrub = fbcon_scrub; set_pixel_blitter(fbcon_blit); + sprite_init(ti, fd); } static bool @@ -554,7 +555,7 @@ apply_term_heuristics(tinfo* ti, const char* termname, int fd, } if(ti->linux_fb_fd >= 0){ termname = "Linux framebuffer"; - setup_fbcon_bitmaps(ti); + setup_fbcon_bitmaps(ti, ti->linux_fb_fd); }else{ termname = "Linux console"; }