summaryrefslogtreecommitdiff
path: root/src/baobab-ringschart.vala
diff options
context:
space:
mode:
authorStefano Facchini <stefano.facchini@gmail.com>2014-07-06 12:29:17 +0200
committerStefano Facchini <stefano.facchini@gmail.com>2014-07-06 12:39:42 +0200
commit15475b2920e88d4da90f39e55c1da0e5b88d7b29 (patch)
treeb9b85209e4e996ed3cd2590cb99c3e2be30fa480 /src/baobab-ringschart.vala
parentd8ec52311d897662c90f64eed2014434be61a95c (diff)
downloadbaobab-15475b2920e88d4da90f39e55c1da0e5b88d7b29.tar.gz
Use an offscreen surface for chart drawing
Previously the border between angular sectors in Ringschart was obtained by a cairo_stroke() with the background color. The problem with this is that we needed to fetch the color from the theme somehow and this was not always possible (for instance the HighContrast theme does not define @theme_bg_color). Now we just draw to an offscreen surface and obtain the borders by clearing the relevant pixels. The surface is finally painted on the window.
Diffstat (limited to 'src/baobab-ringschart.vala')
-rw-r--r--src/baobab-ringschart.vala10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/baobab-ringschart.vala b/src/baobab-ringschart.vala
index 0b37f6c..22d8550 100644
--- a/src/baobab-ringschart.vala
+++ b/src/baobab-ringschart.vala
@@ -238,11 +238,8 @@ namespace Baobab {
get_allocation (out allocation);
var context = get_style_context ();
- context.save ();
- context.add_class ("ringschart-item");
var border_color = context.get_border_color (Gtk.StateFlags.NORMAL);
- var bg_color = context.get_background_color (Gtk.StateFlags.NORMAL);
var center_x = allocation.width / 2;
var center_y = allocation.height / 2;
@@ -279,9 +276,12 @@ namespace Baobab {
Gdk.cairo_set_source_rgba (cr, fill_color);
cr.fill_preserve ();
- Gdk.cairo_set_source_rgba (cr, bg_color);
+
+ cr.set_operator (Cairo.Operator.CLEAR);
cr.stroke ();
+ cr.set_operator (Cairo.Operator.OVER);
+
if (ringsitem.continued) {
Gdk.cairo_set_source_rgba (cr, border_color);
cr.set_line_width (3);
@@ -289,8 +289,6 @@ namespace Baobab {
cr.stroke ();
}
}
-
- context.restore ();
}
protected override void calculate_item_geometry (ChartItem item) {