[meld] gutterrendererchunk: Use built-in background drawing support
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] gutterrendererchunk: Use built-in background drawing support
- Date: Sun, 2 Oct 2016 00:12:25 +0000 (UTC)
commit af5ad58a6787c01fe8f96cae6bf61ab989af5d47
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Sep 25 10:29:42 2016 +1000
gutterrendererchunk: Use built-in background drawing support
This is good for a ~3x performance improvement when drawing chunk
backgrounds, just because we don't have to individually draw the
background for each gutter line with nothing going on.
meld/gutterrendererchunk.py | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/meld/gutterrendererchunk.py b/meld/gutterrendererchunk.py
index a8b961f..4ba672b 100644
--- a/meld/gutterrendererchunk.py
+++ b/meld/gutterrendererchunk.py
@@ -45,22 +45,12 @@ class MeldGutterRenderer(object):
def draw_chunks(
self, context, background_area, cell_area, start, end, state):
- stylecontext = self.props.view.get_style_context()
- background_set, background_rgba = (
- stylecontext.lookup_color('theme_bg_color'))
-
line = start.get_line()
chunk_index = self.linediffer.locate_chunk(self.from_pane, line)[0]
context.save()
context.set_line_width(1.0)
- context.rectangle(
- background_area.x, background_area.y,
- background_area.width, background_area.height)
- context.set_source_rgba(*background_rgba)
- context.fill()
-
if chunk_index is not None:
chunk = self.linediffer.get_chunk(
chunk_index, self.from_pane, self.to_pane)
@@ -201,6 +191,14 @@ class GutterRendererChunkAction(
if chunk and chunk[1] == line:
action = self._classify_change_actions(chunk)
pixbuf = self.action_map.get(action)
+ self.set_background(None)
+ else:
+ # TODO: Remove when fixed in upstream GTK+
+ stylecontext = self.props.view.get_style_context()
+ background_set, background_rgba = (
+ stylecontext.lookup_color('theme_bg_color'))
+ self.set_background(background_rgba)
+
if pixbuf:
self.set_pixbuf(pixbuf)
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]