From a349e7dbda7ca685fee7d304d6da8c72fbd4a60c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 30 Nov 2019 18:27:01 +0100 Subject: [PATCH] LibVT: Always use Painter::clear_rect() instead of Painter::fill_rect() We never want to alpha blend when rendering the terminal buffer, so we can just use clear_rect() and avoid trouble. This fixes an issue with inconsistent translucency in the terminal app when setting a custom background opacity. --- Libraries/LibVT/TerminalWidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp index 027970efa3..b960123147 100644 --- a/Libraries/LibVT/TerminalWidget.cpp +++ b/Libraries/LibVT/TerminalWidget.cpp @@ -287,9 +287,9 @@ void TerminalWidget::paint_event(GPaintEvent& event) auto& line = line_for_visual_row(row); bool has_only_one_background_color = line.has_only_one_background_color(); if (m_visual_beep_timer->is_active()) - painter.fill_rect(row_rect, Color::Red); + painter.clear_rect(row_rect, Color::Red); else if (has_only_one_background_color) - painter.fill_rect(row_rect, lookup_color(line.attributes[0].background_color).with_alpha(m_opacity)); + painter.clear_rect(row_rect, lookup_color(line.attributes[0].background_color).with_alpha(m_opacity)); // The terminal insists on thinking characters and // bytes are the same thing. We want to still draw @@ -325,7 +325,7 @@ void TerminalWidget::paint_event(GPaintEvent& event) auto character_rect = glyph_rect(row, column); auto cell_rect = character_rect.inflated(0, m_line_spacing); if (!has_only_one_background_color || should_reverse_fill_for_cursor_or_selection) { - painter.fill_rect(cell_rect, lookup_color(should_reverse_fill_for_cursor_or_selection ? attribute.foreground_color : attribute.background_color).with_alpha(m_opacity)); + painter.clear_rect(cell_rect, lookup_color(should_reverse_fill_for_cursor_or_selection ? attribute.foreground_color : attribute.background_color).with_alpha(m_opacity)); } if (attribute.flags & VT::Attribute::Underline) painter.draw_line(cell_rect.bottom_left(), cell_rect.bottom_right(), lookup_color(should_reverse_fill_for_cursor_or_selection ? attribute.background_color : attribute.foreground_color));