Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clear window line by line, skipping untouched lines #72035

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,14 +1155,25 @@ static bool draw_window( Font_Ptr &font, const catacurses::window &w, const poin
WindowHeight / scaling_factor );
}

clear_window_area( w );
cata_cursesport::WINDOW *const win = w.get<cata_cursesport::WINDOW>();

// TODO: Get this from UTF system to make sure it is exactly the kind of space we need
static const std::string space_string = " ";

bool update = false;
for( int j = 0; j < win->height; j++ ) {
if( !win->line[j].touched ) {
continue;
}

// Although it would be simpler to clear the whole window at
// once, the code sometimes creates overlapping windows. By
// only clearing those lines that are touched, we avoid
// clearing lines that were already drawn in a previous
// window but are untouched in this one.
geometry->rect( renderer, point( win->pos.x * fontwidth, ( win->pos.y + j ) * fontheight ),
win->width * fontwidth, fontheight,
color_as_sdl( catacurses::black ) );
update = true;
win->line[j].touched = false;
for( int i = 0; i < win->width; i++ ) {
Expand Down
Loading