Skip to content

Commit

Permalink
smooth pixel motion #1682
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Oct 11, 2021
1 parent 676b921 commit ccad129
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/lib/kitty.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,16 @@ int kitty_wipe(sprixel* s, int ycell, int xcell){

int kitty_commit(fbuf* f, sprixel* s, unsigned noscroll){
loginfo("Committing Kitty graphic id %u\n", s->id);
fbuf_printf(f, "\e_Ga=p,i=%u,p=1,q=2%s\e\\", s->id, noscroll ? ",C=1" : "");
int i;
if(s->pxoffx || s->pxoffy){
i = fbuf_printf(f, "\e_Ga=p,i=%u,p=1,X=%u,Y=%u%s\e\\", s->id,
s->pxoffx, s->pxoffy, noscroll ? ",C=1" : "");
}else{
i = fbuf_printf(f, "\e_Ga=p,i=%u,p=1,q=2%s\e\\", s->id, noscroll ? ",C=1" : "");
}
if(i < 0){
return -1;
}
s->invalidated = SPRIXEL_QUIESCENT;
return 0;
}
Expand Down Expand Up @@ -1074,6 +1083,8 @@ kitty_blit_core(ncplane* n, int linesize, const void* data, int leny, int lenx,
n->tam, SPRIXEL_UNSEEN) < 0){
goto error;
}
s->pxoffx = pxoffx;
s->pxoffy = pxoffy;
return 1;

error:
Expand Down
1 change: 1 addition & 0 deletions src/lib/sprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ typedef struct sprixel {
int movedfromx; // so that we can damage old cells when redrawn
// only used for kitty-based sprixels
int parse_start; // where to start parsing for cell wipes
int pxoffy, pxoffx; // X and Y parameters to display command
// only used for sixel-based sprixels
unsigned char* needs_refresh; // one per cell, whether new frame needs damage
struct sixelmap* smap; // copy of palette indices + transparency bits
Expand Down

0 comments on commit ccad129

Please sign in to comment.