[Xfce4-commits] [panel-plugins/xfce4-cpugraph-plugin] 15/16: Fix gradient and fire color modes

noreply at xfce.org noreply at xfce.org
Wed May 29 04:10:16 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 0c77e8812ef6ac3d77d1f57b59a697dcdf1f44fa
Author: Andre Miranda <andreldm at xfce.org>
Date:   Tue May 28 23:00:40 2019 -0300

    Fix gradient and fire color modes
---
 panel-plugin/mode.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/panel-plugin/mode.c b/panel-plugin/mode.c
index caadf72..f3751f5 100644
--- a/panel-plugin/mode.c
+++ b/panel-plugin/mode.c
@@ -25,9 +25,9 @@
 #include <cairo/cairo.h>
 #include "mode.h"
 
-static guint16 _lerp( gdouble t, guint16 a, guint16 b )
+static gdouble _lerp( gdouble t, gdouble a, gdouble b )
 {
-	return (guint16) (a + t * (b - a));
+	return (gdouble) (a + t * (b - a));
 }
 
 static void mix_colors( gdouble ratio, GdkRGBA *color1, GdkRGBA *color2, cairo_t *target )
@@ -74,8 +74,9 @@ void draw_graph_normal( CPUGraph *base, cairo_t *cr, gint w, gint h )
 					(tmp / (gdouble) (usage));
 				mix_colors( t, &base->colors[1], &base->colors[2], cr );
 				/* draw point */
-				cairo_set_line_cap( cr, CAIRO_LINE_CAP_SQUARE );
+				cairo_set_line_cap( cr, CAIRO_LINE_CAP_ROUND );
 				cairo_move_to( cr, x, y );
+				cairo_close_path (cr);
 				cairo_stroke( cr );
 			}
 		}
@@ -103,8 +104,11 @@ void draw_graph_LED( CPUGraph *base, cairo_t *cr, gint w, gint h )
 				           (y / (gdouble)limit);
 				mix_colors( t, &base->colors[3], &base->colors[2], cr );
 			}
+			else
+			{
+				gdk_cairo_set_source_rgba( cr, y >= limit ? &base->colors[1] : &base->colors[2] );
+			}
 			/* draw rectangle */
-			gdk_cairo_set_source_rgba( cr, y >= limit ? &base->colors[1] : &base->colors[2] );
 			cairo_rectangle( cr, x * 3, y * 2, 2, 1 );
 			cairo_fill( cr );
 		}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list