[Xfce4-commits] [panel-plugins/xfce4-cpugraph-plugin] 14/16: Make grid more crisp
noreply at xfce.org
noreply at xfce.org
Wed May 29 04:10:15 CEST 2019
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-cpugraph-plugin.
commit b9493a3dff5ad107932c2cbc2b1ba674fec8f5fe
Author: Andre Miranda <andreldm at xfce.org>
Date: Wed Apr 24 00:20:57 2019 -0300
Make grid more crisp
The +0.5 trick is described here:
https://cairographics.org/FAQ/#sharp_lines
---
panel-plugin/mode.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/panel-plugin/mode.c b/panel-plugin/mode.c
index c1d66ad..caadf72 100644
--- a/panel-plugin/mode.c
+++ b/panel-plugin/mode.c
@@ -157,20 +157,21 @@ void draw_graph_grid( CPUGraph *base, cairo_t *cr, gint w, gint h )
last.y = h;
gdk_cairo_set_source_rgba( cr, &base->colors[1] );
+ cairo_set_line_cap( cr, CAIRO_LINE_CAP_SQUARE );
+ cairo_set_line_width( cr, 1 );
+
for( x = 0; x * 6 < w; x++ )
{
/* draw line */
- cairo_set_line_cap( cr, CAIRO_LINE_CAP_SQUARE );
- cairo_move_to( cr, x * 6, 0 );
- cairo_line_to( cr, x * 6, h - 1 );
+ cairo_move_to( cr, x * 6 + 0.5, 0.5 );
+ cairo_line_to( cr, x * 6 + 0.5, h - 1 + 0.5 );
cairo_stroke( cr );
}
for( y = 0; y * 4 < h; y++ )
{
/* draw line */
- cairo_set_line_cap( cr, CAIRO_LINE_CAP_SQUARE );
- cairo_move_to( cr, 0, y * 4 );
- cairo_line_to( cr, w - 1, y * 4 );
+ cairo_move_to( cr, 0.5, y * 4 + 0.5 );
+ cairo_line_to( cr, w - 1 + 0.5, y * 4 + 0.5 );
cairo_stroke( cr );
}
@@ -181,9 +182,8 @@ void draw_graph_grid( CPUGraph *base, cairo_t *cr, gint w, gint h )
current.x = x;
current.y = h - usage;
/* draw line */
- cairo_set_line_cap( cr, CAIRO_LINE_CAP_SQUARE );
- cairo_move_to( cr, current.x, current.y );
- cairo_line_to( cr, last.x, last.y );
+ cairo_move_to( cr, current.x + 0.5, current.y + 0.5 );
+ cairo_line_to( cr, last.x + 0.5, last.y + 0.5 );
cairo_stroke( cr );
last = current;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list