[polari/gnome-3-16] chatView: Avoid drawing indicator line unnecessarily



commit c9a89944db77687fbbcf5fba50e1d337a9f891b2
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jul 21 04:57:44 2015 +0200

    chatView: Avoid drawing indicator line unnecessarily
    
    Check whether the line is actually visible (or covered/scrolled away)
    before drawing it.

 src/chatView.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index f88a2a1..2facb19 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -65,6 +65,15 @@ const TextView = new Lang.Class({
 
         let lineSpace = (this.get_pixels_above_lines(this) +
                          this.get_pixels_below_lines(this)) / 2;
+
+        let [hasClip, clip] = Gdk.cairo_get_clip_rectangle(cr);
+        if (!hasClip)
+            return;
+
+        if (clip.y > y - lineSpace + 1 ||
+            clip.y + clip.height < y - lineSpace)
+            return;
+
         Gdk.cairo_set_source_rgba(cr, this._dimColor);
         cr.rectangle(border, y - lineSpace,
                      this.get_allocated_width() - 2 * border, 1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]