Skip to content

Commit

Permalink
[sixels] lift all logic into choose_alternate_color() #2516
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jan 8, 2022
1 parent d5f0a5b commit 704f2b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/sixel.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,9 @@ get_active_set(qstate* qs, uint32_t colors){
}

// FIXME for now they all go to the most popular. this must change.
static inline unsigned
choose_alternate_color(qnode* active, uint32_t colors){
return active[colors - 1].qlink;
static inline void
choose_alternate_color(qstate* qs, unsigned z, qnode* active, uint32_t colors){
qs->qnodes[active[z].qlink].cidx = active[colors - 1].qlink;
}

// we must reduce the number of colors until we're using less than or equal
Expand Down Expand Up @@ -581,7 +581,7 @@ merge_color_table(qstate* qs, uint32_t* colors, uint32_t colorregs){
qs->qnodes[qactive[z].qlink].cidx = qactive[z].cidx;
//fprintf(stderr, "LOOKING AT %u %u\n", z, qactive[z].qlink);
if(!chosen_p(&qs->qnodes[qactive[z].qlink])){
qs->qnodes[qactive[z].qlink].cidx = choose_alternate_color(qactive, *colors);
choose_alternate_color(qs, z, qactive, *colors);
//fprintf(stderr, "NOT CHOSEN: %u %u %u %u\n", z, qactive[z].qlink, qactive[z].q.pop, qactive[z].cidx);
}
}
Expand Down

0 comments on commit 704f2b6

Please sign in to comment.