mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-12 10:39:04 -04:00
fold blends into s bitfield
This commit is contained in:
parent
02d09ef47b
commit
1a69044d8a
@ -5,7 +5,7 @@ name: debian-unstable
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: debian-build
|
- name: debian-build
|
||||||
image: dankamongmen/unstable_builder:2021-01-02a
|
image: dankamongmen/unstable_builder:2021-02-01a
|
||||||
commands:
|
commands:
|
||||||
- export LANG=en_US.UTF-8
|
- export LANG=en_US.UTF-8
|
||||||
- mkdir build
|
- mkdir build
|
||||||
@ -66,7 +66,7 @@ name: ubuntu-focal
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: ubuntu-build
|
- name: ubuntu-build
|
||||||
image: dankamongmen/hirsute:2021-01-02a
|
image: dankamongmen/hirsute:2021-02-01a
|
||||||
commands:
|
commands:
|
||||||
- export LANG=es_ES.UTF-8
|
- export LANG=es_ES.UTF-8
|
||||||
- mkdir build
|
- mkdir build
|
||||||
|
@ -170,14 +170,7 @@ int cell_duplicate(ncplane* n, nccell* targ, const nccell* c){
|
|||||||
struct crender {
|
struct crender {
|
||||||
const ncplane *p; // source of glyph for this cell
|
const ncplane *p; // source of glyph for this cell
|
||||||
nccell c;
|
nccell c;
|
||||||
unsigned fgblends;
|
uint32_t hcfg; // fg channel prior to HIGHCONTRAST (need full channel)
|
||||||
unsigned bgblends;
|
|
||||||
// we'll need recalculate the foreground relative to the solved background,
|
|
||||||
// and then reapply any foreground shading from above the highcontrast
|
|
||||||
// declaration. save the foreground state when we go highcontrast.
|
|
||||||
unsigned hcfgblends; // number of foreground blends prior to HIGHCONTRAST
|
|
||||||
// FIXME can't hcfg be reduced to 24 bits and shoved in the bitfield below?
|
|
||||||
uint32_t hcfg; // foreground channel prior to HIGHCONTRAST
|
|
||||||
struct {
|
struct {
|
||||||
// If the glyph we render is from an ncvisual, and has a transparent or
|
// If the glyph we render is from an ncvisual, and has a transparent or
|
||||||
// blended background, blitter stacking is in effect. This is a complicated
|
// blended background, blitter stacking is in effect. This is a complicated
|
||||||
@ -195,6 +188,12 @@ struct crender {
|
|||||||
// if CELL_ALPHA_HIGHCONTRAST is in play, we apply the HSV flip once the
|
// if CELL_ALPHA_HIGHCONTRAST is in play, we apply the HSV flip once the
|
||||||
// background is locked in. set highcontrast to indicate this.
|
// background is locked in. set highcontrast to indicate this.
|
||||||
unsigned highcontrast: 1;
|
unsigned highcontrast: 1;
|
||||||
|
unsigned fgblends: 8;
|
||||||
|
unsigned bgblends: 8;
|
||||||
|
// we'll need recalculate the foreground relative to the solved background,
|
||||||
|
// and then reapply any foreground shading from above the highcontrast
|
||||||
|
// declaration. save the foreground state when we go highcontrast.
|
||||||
|
unsigned hcfgblends: 8; // number of foreground blends prior to HIGHCONTRAST
|
||||||
} s;
|
} s;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -291,10 +290,12 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
|
|||||||
}else{
|
}else{
|
||||||
if(cell_fg_alpha(vis) == CELL_ALPHA_HIGHCONTRAST){
|
if(cell_fg_alpha(vis) == CELL_ALPHA_HIGHCONTRAST){
|
||||||
crender->s.highcontrast = true;
|
crender->s.highcontrast = true;
|
||||||
crender->hcfgblends = crender->fgblends;
|
crender->s.hcfgblends = crender->s.fgblends;
|
||||||
crender->hcfg = cell_fchannel(targc);
|
crender->hcfg = cell_fchannel(targc);
|
||||||
}
|
}
|
||||||
cell_blend_fchannel(targc, cell_fchannel(vis), &crender->fgblends);
|
unsigned fgblends = crender->s.fgblends;
|
||||||
|
cell_blend_fchannel(targc, cell_fchannel(vis), &fgblends);
|
||||||
|
crender->s.fgblends = fgblends;
|
||||||
// crender->highcontrast can only be true if we just set it, since we're
|
// crender->highcontrast can only be true if we just set it, since we're
|
||||||
// about to set targc opaque based on crender->highcontrast (and this
|
// about to set targc opaque based on crender->highcontrast (and this
|
||||||
// entire stanza is conditional on targc not being CELL_ALPHA_OPAQUE).
|
// entire stanza is conditional on targc not being CELL_ALPHA_OPAQUE).
|
||||||
@ -320,7 +321,9 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
|
|||||||
cell_set_bg_palindex(targc, cell_bg_palindex(vis));
|
cell_set_bg_palindex(targc, cell_bg_palindex(vis));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
cell_blend_bchannel(targc, cell_bchannel(vis), &crender->bgblends);
|
unsigned bgblends = crender->s.bgblends;
|
||||||
|
cell_blend_bchannel(targc, cell_bchannel(vis), &bgblends);
|
||||||
|
crender->s.bgblends = bgblends;
|
||||||
}
|
}
|
||||||
}else{ // use the local foreground; we're stacking blittings
|
}else{ // use the local foreground; we're stacking blittings
|
||||||
if(cell_fg_default_p(vis)){
|
if(cell_fg_default_p(vis)){
|
||||||
@ -331,7 +334,9 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
|
|||||||
cell_set_bg_palindex(targc, cell_fg_palindex(vis));
|
cell_set_bg_palindex(targc, cell_fg_palindex(vis));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
cell_blend_bchannel(targc, cell_fchannel(vis), &crender->bgblends);
|
unsigned bgblends = crender->s.bgblends;
|
||||||
|
cell_blend_bchannel(targc, cell_fchannel(vis), &bgblends);
|
||||||
|
crender->s.bgblends = bgblends;
|
||||||
}
|
}
|
||||||
crender->s.blittedquads = 0;
|
crender->s.blittedquads = 0;
|
||||||
}
|
}
|
||||||
@ -409,12 +414,13 @@ lock_in_highcontrast(nccell* targc, struct crender* crender){
|
|||||||
if(crender->s.highcontrast){
|
if(crender->s.highcontrast){
|
||||||
// highcontrast weighs the original at 1/4 and the contrast at 3/4
|
// highcontrast weighs the original at 1/4 and the contrast at 3/4
|
||||||
if(!cell_fg_default_p(targc)){
|
if(!cell_fg_default_p(targc)){
|
||||||
crender->fgblends = 3;
|
unsigned fgblends = 3;
|
||||||
uint32_t fchan = cell_fchannel(targc);
|
uint32_t fchan = cell_fchannel(targc);
|
||||||
uint32_t bchan = cell_bchannel(targc);
|
uint32_t bchan = cell_bchannel(targc);
|
||||||
uint32_t hchan = channels_blend(highcontrast(bchan), fchan, &crender->fgblends);
|
uint32_t hchan = channels_blend(highcontrast(bchan), fchan, &fgblends);
|
||||||
cell_set_fchannel(targc, hchan);
|
cell_set_fchannel(targc, hchan);
|
||||||
hchan = channels_blend(hchan, crender->hcfg, &crender->hcfgblends);
|
fgblends = crender->s.hcfgblends;
|
||||||
|
hchan = channels_blend(hchan, crender->hcfg, &fgblends);
|
||||||
cell_set_fchannel(targc, hchan);
|
cell_set_fchannel(targc, hchan);
|
||||||
}else{
|
}else{
|
||||||
cell_set_fg_rgb(targc, highcontrast(cell_bchannel(targc)));
|
cell_set_fg_rgb(targc, highcontrast(cell_bchannel(targc)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user