render: fix bad reference in final pass

This commit is contained in:
nick black 2020-01-15 12:06:35 -05:00 committed by Nick Black
parent 209d4f41f4
commit 38b2b3d075
2 changed files with 27 additions and 8 deletions

View File

@ -287,12 +287,13 @@ paint(notcurses* nc, ncplane* p, struct crender* rvec, cell* fb){
if(cell_locked_p(targc)){ if(cell_locked_p(targc)){
cell* prevcell = &nc->lastframe[fbcellidx(absy, nc->lfdimx, absx)]; cell* prevcell = &nc->lastframe[fbcellidx(absy, nc->lfdimx, absx)];
if(cellcmp_and_dupfar(&nc->pool, prevcell, crender->p, targc)){ /*if(cell_simple_p(targc)){
/*if(cell_simple_p(prevcell)){ fprintf(stderr, "WROTE %u [%c] to %d/%d (%d/%d)\n", targc->gcluster, prevcell->gcluster, y, x, absy, absx);
fprintf(stderr, "WROTE %u [%c] to %d/%d (%d/%d)\n", prevcell->gcluster, prevcell->gcluster, y, x, absy, absx);
}else{ }else{
fprintf(stderr, "WROTE %u [%s] to %d/%d (%d/%d)\n", prevcell->gcluster, egcpool_extended_gcluster(&nc->pool, prevcell), y, x, absy, absx); fprintf(stderr, "WROTE %u [%s] to %d/%d (%d/%d)\n", targc->gcluster, extended_gcluster(crender->p, targc), y, x, absy, absx);
}*/ }
fprintf(stderr, "POOL: %p NC: %p SRC: %p\n", nc->pool.pool, nc, crender->p);*/
if(cellcmp_and_dupfar(&nc->pool, prevcell, crender->p, targc)){
crender->damaged = true; crender->damaged = true;
if(cell_double_wide_p(targc)){ if(cell_double_wide_p(targc)){
ncplane* tmpp = crender->p; ncplane* tmpp = crender->p;
@ -354,7 +355,7 @@ notcurses_render_internal(notcurses* nc, struct crender* rvec){
if(targc->gcluster == 0){ if(targc->gcluster == 0){
targc->gcluster = ' '; targc->gcluster = ' ';
} }
if(cellcmp_and_dupfar(&nc->pool, prevcell, rvec->p, targc)){ if(cellcmp_and_dupfar(&nc->pool, prevcell, rvec[fbcellidx(y, dimx, x)].p, targc)){
struct crender* crender = &rvec[fbcellidx(y, dimx, x)]; struct crender* crender = &rvec[fbcellidx(y, dimx, x)];
crender->damaged = true; crender->damaged = true;
} }

View File

@ -21,7 +21,6 @@ TEST_CASE("Multimedia") {
ncplane* ncp_ = notcurses_stdplane(nc_); ncplane* ncp_ = notcurses_stdplane(nc_);
REQUIRE(ncp_); REQUIRE(ncp_);
/*
#ifdef DISABLE_FFMPEG #ifdef DISABLE_FFMPEG
SUBCASE("LibavDisabled"){ SUBCASE("LibavDisabled"){
REQUIRE(!notcurses_canopen(nc_)); REQUIRE(!notcurses_canopen(nc_));
@ -31,6 +30,26 @@ TEST_CASE("Multimedia") {
REQUIRE(notcurses_canopen(nc_)); REQUIRE(notcurses_canopen(nc_));
} }
SUBCASE("LoadImageCreatePlane") {
int averr;
int dimy, dimx;
ncplane_dim_yx(ncp_, &dimy, &dimx);
auto ncv = ncvisual_open_plane(nc_, find_data("dsscaw-purp.png"), &averr, 0, 0, NCSCALE_STRETCH);
REQUIRE(ncv);
REQUIRE(0 == averr);
auto frame = ncvisual_decode(ncv, &averr);
REQUIRE(frame);
REQUIRE(0 == averr);
CHECK(dimy * 2 == frame->height);
CHECK(dimx == frame->width);
CHECK(0 == ncvisual_render(ncv, 0, 0, 0, 0));
CHECK(0 == notcurses_render(nc_));
frame = ncvisual_decode(ncv, &averr);
REQUIRE_EQ(nullptr, frame);
CHECK(AVERROR_EOF == averr);
ncvisual_destroy(ncv);
}
SUBCASE("LoadImage") { SUBCASE("LoadImage") {
int averr; int averr;
int dimy, dimx; int dimy, dimx;
@ -86,7 +105,6 @@ TEST_CASE("Multimedia") {
ncvisual_destroy(ncv); ncvisual_destroy(ncv);
} }
#endif #endif
*/
CHECK(!notcurses_stop(nc_)); CHECK(!notcurses_stop(nc_));
CHECK(!fclose(outfp_)); CHECK(!fclose(outfp_));