[sprixel_redraw] want the offset, not absolute position #2168

pull/2197/head
nick black 3 years ago
parent 6849ed9da7
commit 70997670a5
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -734,7 +734,7 @@ sprite_redraw(notcurses* nc, const ncpile* p, sprixel* s, fbuf* f, int y, int x)
// not emit it. we use sixel_maxy_pristine as a side channel to encode
// this version information.
bool noscroll = !ti->sixel_maxy_pristine;
return ti->pixel_move(s, f, noscroll);
return ti->pixel_move(s, f, noscroll, y, x);
}else{
if(!ti->pixel_draw){
return 0;

@ -1157,18 +1157,16 @@ int kitty_scrub(const ncpile* p, sprixel* s){
// returns the number of bytes written
int kitty_draw(const tinfo* ti, const ncpile* p, sprixel* s, fbuf* f,
int y, int x){
int yoff, int xoff){
(void)ti;
(void)p;
(void)y;
(void)x;
bool animated = false;
if(s->animating){ // active animation
s->animating = false;
animated = true;
}
int ret = s->glyph.used;
logdebug("Writing out %zub for %u\n", s->glyph.used, s->id);
logdebug("dumping %zub for %u at %d %d\n", s->glyph.used, s->id, yoff, xoff);
if(ret){
if(fbuf_putn(f, s->glyph.buf, s->glyph.used) < 0){
ret = -1;
@ -1182,9 +1180,12 @@ int kitty_draw(const tinfo* ti, const ncpile* p, sprixel* s, fbuf* f,
}
// returns -1 on failure, 0 on success (move bytes do not count for sprixel stats)
int kitty_move(sprixel* s, fbuf* f, unsigned noscroll){
int kitty_move(sprixel* s, fbuf* f, unsigned noscroll, int yoff, int xoff){
const int targy = s->n->absy;
const int targx = s->n->absx;
logdebug("moving %u to %d %d\n", s->id, targy, targx);
int ret = 0;
if(goto_location(ncplane_notcurses(s->n), f, s->n->absy, s->n->absx)){
if(goto_location(ncplane_notcurses(s->n), f, targy + yoff, targx + xoff)){
ret = -1;
}else if(fbuf_printf(f, "\e_Ga=p,i=%d,p=1,q=2%s\e\\", s->id,
noscroll ? ",C=1" : "") < 0){

@ -174,10 +174,10 @@ 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 kitty_rebuild_selfref(sprixel* s, int ycell, int xcell, uint8_t* auxvec);
int sixel_draw(const tinfo* ti, const struct ncpile *p, sprixel* s,
fbuf* f, int y, int x);
fbuf* f, int yoff, int xoff);
int kitty_draw(const tinfo* ti, const struct ncpile *p, sprixel* s,
fbuf* f, int y, int x);
int kitty_move(sprixel* s, fbuf* f, unsigned noscroll);
fbuf* f, int yoff, int xoff);
int kitty_move(sprixel* s, fbuf* f, unsigned noscroll, int yoff, int xoff);
int sixel_scrub(const struct ncpile* p, sprixel* s);
int kitty_scrub(const struct ncpile* p, sprixel* s);
int fbcon_scrub(const struct ncpile* p, sprixel* s);
@ -200,7 +200,7 @@ int kitty_blit_selfref(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int fbcon_blit(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int fbcon_draw(const tinfo* ti, sprixel* s, int y, int x);
int fbcon_draw(const tinfo* ti, sprixel* s, int yoff, int xoff);
void fbcon_scroll(const struct ncpile* p, tinfo* ti, int rows);
void sixel_refresh(const struct ncpile* p, sprixel* s);

@ -130,9 +130,9 @@ typedef struct tinfo {
int (*pixel_init)(const struct tinfo*, int fd); // called when support is detected
int (*pixel_draw)(const struct tinfo*, const struct ncpile* p,
struct sprixel* s, fbuf* f, int y, int x);
int (*pixel_draw_late)(const struct tinfo*, struct sprixel* s, int y, int x);
int (*pixel_draw_late)(const struct tinfo*, struct sprixel* s, int yoff, int xoff);
// execute move (erase old graphic, place at new location) if non-NULL
int (*pixel_move)(struct sprixel* s, fbuf* f, unsigned noscroll);
int (*pixel_move)(struct sprixel* s, fbuf* f, unsigned noscroll, int yoff, int xoff);
int (*pixel_scrub)(const struct ncpile* p, struct sprixel* s);
int (*pixel_shutdown)(fbuf* f); // called during context shutdown
int (*pixel_clear_all)(fbuf* f); // called during context startup

Loading…
Cancel
Save