mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
enable blitterstacking unit test -- fails for now
This commit is contained in:
parent
0f5c76d070
commit
0446dc0f6d
@ -275,24 +275,6 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
|
|||||||
if(cell_wide_right_p(targc)){
|
if(cell_wide_right_p(targc)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Background color takes effect independently of whether we have a
|
|
||||||
// glyph. If we've already locked in the background, it has no effect.
|
|
||||||
// If it's transparent, it has no effect. Otherwise, update the
|
|
||||||
// background channel and balpha.
|
|
||||||
// Evaluate the background first, in case we have HIGHCONTRAST fg text.
|
|
||||||
if(cell_bg_alpha(targc) > CELL_ALPHA_OPAQUE){
|
|
||||||
const nccell* vis = &p->fb[nfbcellidx(p, y, x)];
|
|
||||||
if(cell_bg_default_p(vis)){
|
|
||||||
vis = &p->basecell;
|
|
||||||
}
|
|
||||||
if(cell_bg_palindex_p(vis)){
|
|
||||||
if(cell_bg_alpha(targc) == CELL_ALPHA_TRANSPARENT){
|
|
||||||
cell_set_bg_palindex(targc, cell_bg_palindex(vis));
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
cell_blend_bchannel(targc, cell_bchannel(vis), &crender->bgblends);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cell_fg_alpha(targc) > CELL_ALPHA_OPAQUE){
|
if(cell_fg_alpha(targc) > CELL_ALPHA_OPAQUE){
|
||||||
const nccell* vis = &p->fb[nfbcellidx(p, y, x)];
|
const nccell* vis = &p->fb[nfbcellidx(p, y, x)];
|
||||||
@ -319,6 +301,39 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Background color takes effect independently of whether we have a
|
||||||
|
// glyph. If we've already locked in the background, it has no effect.
|
||||||
|
// If it's transparent, it has no effect. Otherwise, update the
|
||||||
|
// background channel and balpha.
|
||||||
|
// Evaluate the background first, in case we have HIGHCONTRAST fg text.
|
||||||
|
if(cell_bg_alpha(targc) > CELL_ALPHA_OPAQUE){
|
||||||
|
const nccell* vis = &p->fb[nfbcellidx(p, y, x)];
|
||||||
|
// FIXME need check maps to determine whether inversion is appropriate
|
||||||
|
if(!crender->blitterstacked || !cell_blitted_p(vis)){
|
||||||
|
if(cell_bg_default_p(vis)){
|
||||||
|
vis = &p->basecell;
|
||||||
|
}
|
||||||
|
if(cell_bg_palindex_p(vis)){
|
||||||
|
if(cell_bg_alpha(targc) == CELL_ALPHA_TRANSPARENT){
|
||||||
|
cell_set_bg_palindex(targc, cell_bg_palindex(vis));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
cell_blend_bchannel(targc, cell_bchannel(vis), &crender->bgblends);
|
||||||
|
}
|
||||||
|
}else{ // use the local foreground; we're stacking blittings
|
||||||
|
if(cell_fg_default_p(vis)){
|
||||||
|
vis = &p->basecell;
|
||||||
|
}
|
||||||
|
if(cell_fg_palindex_p(vis)){
|
||||||
|
if(cell_bg_alpha(targc) == CELL_ALPHA_TRANSPARENT){
|
||||||
|
cell_set_bg_palindex(targc, cell_fg_palindex(vis));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
cell_blend_bchannel(targc, cell_fchannel(vis), &crender->bgblends);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if we never loaded any content into the cell (or obliterated it by
|
// if we never loaded any content into the cell (or obliterated it by
|
||||||
// writing in a zero), use the plane's base cell.
|
// writing in a zero), use the plane's base cell.
|
||||||
// if we have no character in this cell, we continue to look for a
|
// if we have no character in this cell, we continue to look for a
|
||||||
|
@ -35,16 +35,16 @@ TEST_CASE("Stacking") {
|
|||||||
REQUIRE(nullptr != top);
|
REQUIRE(nullptr != top);
|
||||||
CHECK(0 == ncplane_set_fg_rgb(top, 0xffffff));
|
CHECK(0 == ncplane_set_fg_rgb(top, 0xffffff));
|
||||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0xffffff));
|
CHECK(0 == ncplane_set_fg_rgb(n_, 0xffffff));
|
||||||
CHECK(1 == ncplane_putwc(top, L'\u2580'));
|
CHECK(1 == ncplane_putwc(top, L'\u2580')); // upper half block
|
||||||
CHECK(1 == ncplane_putwc(n_, L'\u2584'));
|
CHECK(1 == ncplane_putwc(n_, L'\u2584')); // lower half block
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
uint64_t channels;
|
uint64_t channels;
|
||||||
auto egc = notcurses_at_yx(nc_, 0, 0, nullptr, &channels);
|
auto egc = notcurses_at_yx(nc_, 0, 0, nullptr, &channels);
|
||||||
REQUIRE(nullptr != egc);
|
REQUIRE(nullptr != egc);
|
||||||
// ought yield space with white background
|
// ought yield space with white background
|
||||||
WARN(0 == strcmp(" ", egc));
|
CHECK(0 == strcmp(" ", egc));
|
||||||
WARN(0xffffff == channels_fg_rgb(channels));
|
CHECK(0xffffff == channels_fg_rgb(channels));
|
||||||
WARN(0xffffff == channels_bg_rgb(channels));
|
CHECK(0xffffff == channels_bg_rgb(channels));
|
||||||
ncplane_destroy(top);
|
ncplane_destroy(top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user