Skip to content

Commit

Permalink
ncplane_set_*_palindex(): just use ncchannels*() #2049
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Aug 12, 2021
1 parent 6967723 commit 7108dc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.

* 2.3.14 (not yet released)
* Fixed grotesque errors in `ncplane_set_*_palindex()`.

* 2.3.13 (2021-08-04)
* Added the portable utility functions `notcurses_accountname()` and
`notcurses_hostname()`.
Expand Down
20 changes: 2 additions & 18 deletions src/lib/notcurses.c
Original file line number Diff line number Diff line change
Expand Up @@ -1378,27 +1378,11 @@ int ncplane_set_bg_alpha(ncplane *n, int alpha){
}

int ncplane_set_fg_palindex(ncplane* n, int idx){
if(idx < 0 || idx >= NCPALETTESIZE){
return -1;
}
n->channels |= NC_FGDEFAULT_MASK;
n->channels |= NC_FG_PALETTE;
ncchannels_set_fg_alpha(&n->channels, NCALPHA_OPAQUE);
n->stylemask &= 0xffff00ff;
n->stylemask |= (idx << 8u);
return 0;
return ncchannels_set_fg_palindex(&n->channels, idx);
}

int ncplane_set_bg_palindex(ncplane* n, int idx){
if(idx < 0 || idx >= NCPALETTESIZE){
return -1;
}
n->channels |= NC_BGDEFAULT_MASK;
n->channels |= NC_BG_PALETTE;
ncchannels_set_bg_alpha(&n->channels, NCALPHA_OPAQUE);
n->stylemask &= 0xffffff00;
n->stylemask |= idx;
return 0;
return ncchannels_set_bg_palindex(&n->channels, idx);
}

int ncplane_set_base_cell(ncplane* ncp, const nccell* c){
Expand Down

0 comments on commit 7108dc3

Please sign in to comment.