[baobab] Ringschart: clip subfolder tip line outside tooltip area



commit 4cfe0c408759e9e87689b8ddc8db90d250e07f9c
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Fri Jun 14 15:21:30 2013 +0200

    Ringschart: clip subfolder tip line outside tooltip area
    
    Depending on the theme, the tooltip background could be partially
    transparent, so clip the line to avoid it being visible below the
    tooltip.

 src/baobab-ringschart.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/baobab-ringschart.vala b/src/baobab-ringschart.vala
index 7887407..3d70911 100644
--- a/src/baobab-ringschart.vala
+++ b/src/baobab-ringschart.vala
@@ -186,6 +186,14 @@ namespace Baobab {
                     var sector_center_y = q_height + middle_radius * Math.sin (middle_angle);
 
                     // draw line from sector center to tooltip center
+                    cr.save ();
+
+                    // clip to avoid drawing inside tooltip area (tooltip background
+                    // could be transparent, depending on the theme)
+                    cr.rectangle (0, 0, allocation.width, allocation.height);
+                    cr.rectangle (tooltip_rect.x + tooltip_rect.width, tooltip_rect.y, -tooltip_rect.width, 
tooltip_rect.height);
+                    cr.clip ();
+
                     var bg_color = context.get_background_color (Gtk.StateFlags.NORMAL);
                     cr.set_line_width (1);
                     cr.move_to (sector_center_x, sector_center_y);
@@ -194,6 +202,8 @@ namespace Baobab {
                                 tooltip_rect.y + tooltip_rect.height / 2);
                     cr.stroke ();
 
+                    cr.restore ();
+
                     // draw a tiny circle in sector center
                     cr.arc (sector_center_x, sector_center_y, 1.0, 0, 2 * Math.PI);
                     cr.stroke ();


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