dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.58k stars 112 forks source link

notcurses-tetris has two weird artifacts #777

Closed dankamongmen closed 4 years ago

dankamongmen commented 4 years ago

Not sure how new this first one is; I'm seeing it on tip of 1.6.0. It doesn't happen with every line we clear, but it's not difficult to reproduce, either.

2020-07-09-024449_936x936_scrot

The other weird issue has been there since the beginning--when the first piece touches the ground, the background transmogrifies, and not in a good way. If I had to guess, it's shifting from 2x1/2x2 to 1x1 for whatever reason. This is completely reproducible.

dankamongmen commented 4 years ago

As for the background, it's definitely shifting from NCBLIT_2x1 to NCBLIT_1x1 (in effect if not in call). That suggests that I'm lacking some type of transparency in the playing area. But why only after a piece hits the bottom?

OHHHHHHHHHHHHHHHHHHH I bet this is ncplane_mergedown()'s fault, yes, that's gotta be it.

dankamongmen commented 4 years ago

Likewise, I think the artifact on the top is excess of a gradient operation -- if I comment out the ncplane_mergedown(), the entire playing area runs rampant with it.

dankamongmen commented 4 years ago

This all makes sense if we're writing foreground-transparent spaces as we fall. (1) they would be stained, and (2) they would block the underlying glyph

dankamongmen commented 4 years ago

OK, the weird color artifacts at the top arise from going tripartite wrt transparency during 1.6.0 development, that makes sense.

dankamongmen commented 4 years ago

We wouldn't be staining if we weren't filling the board with spaces, and if we weren't filling the board with spaces, we wouldn't be blurring. Figuring that out will solve both problems.

dankamongmen commented 4 years ago

and yes, locked ncplane_mergedown() as to the source of the spaces.

dankamongmen commented 4 years ago

in postpaint():

        if(targc->gcluster == 0){
          targc->gcluster = ' ';
        }

that's what's fucking us fo' sho.

dankamongmen commented 4 years ago

Yeah, comment out those two lines, and notcurses-tetris is flawless. Let's see why they were necessary in the first place...

dankamongmen commented 4 years ago

OK, I believe the change I just committed is safe, and it definitely remedies the background. The color artifacts still need be dealt with. Checking for nul and not coloring it in ncplane_stain() remedies the problem, but I'm unsure that's the right approach. Need to test it further. If we decide against it, we can do a postpass scrubbing NULs....

dankamongmen commented 4 years ago

OK, that seems sensible actually. All unit tests pass, and the demo seems unaffected. I think we're done here.