From a0664dbbf0dee6b8335b3c215364d608e472fbfd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Oct 2016 17:48:19 +0530 Subject: [PATCH] Optimize calculating dirty region when we know the entire screen is dirty --- kitty/render.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kitty/render.py b/kitty/render.py index 2fe8c8464..70d4cf0bb 100644 --- a/kitty/render.py +++ b/kitty/render.py @@ -170,7 +170,7 @@ class Renderer(QObject): else: dirty_cell_ranges = {l: tuple(merge_ranges(r)) for l, r in dirty_cell_ranges.items() if l not in dirty_lines} - self.paint(dirty_lines, dirty_cell_ranges) + self.paint(dirty_lines, dirty_cell_ranges, screen_dirtied) self.update_required.emit() def calculate_dirty_region(self, dirty_lines, dirty_cell_ranges): @@ -184,7 +184,7 @@ class Renderer(QObject): ans += QRect(self.cell_positions[cnum], y, self.cell_width, self.cell_height) return ans - def paint(self, dirty_lines, dirty_cell_ranges): + def paint(self, dirty_lines, dirty_cell_ranges, screen_dirtied): self.current_bgcol = self.common_bg_color() bg = self.default_bg if self.current_bgcol & 0xff: @@ -195,7 +195,7 @@ class Renderer(QObject): self.cursor_painted = False self.old_cursorx, self.old_cursory = self.last_painted_cursor_at self.cursor_moved = self.old_cursorx != self.cursorx or self.old_cursory != self.cursory - region = self.calculate_dirty_region(dirty_lines, dirty_cell_ranges) + region = QRegion(self.bufpix.rect()) if screen_dirtied else self.calculate_dirty_region(dirty_lines, dirty_cell_ranges) if self.cursor_moved: r = QRect(self.cell_positions[self.old_cursorx], self.line_positions[self.old_cursory], self.cell_width, self.cell_height) if region.contains(r):