[Xfce4-commits] <xfce4-cpugraph-plugin:master> Fix the No History mode rendering
Florian
noreply at xfce.org
Sat Apr 17 16:16:24 CEST 2010
Updating branch refs/heads/master
to 19f98ab2cff4421efebfe207d4041ca48caa5fa0 (commit)
from 117cc231611b2ef75ff0884dde5e583b84f43b15 (commit)
commit 19f98ab2cff4421efebfe207d4041ca48caa5fa0
Author: Florian <frivoal at gmail.com>
Date: Sat Feb 27 16:08:08 2010 +0900
Fix the No History mode rendering
A bug caused the No History mode to be drawn in black rather than the
selected color when choosing None as a color mode. Fix that, and do a
general clean up of the code involved in drawing the No History mode.
panel-plugin/mode.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/panel-plugin/mode.c b/panel-plugin/mode.c
index 6a9cfcb..09600e8 100644
--- a/panel-plugin/mode.c
+++ b/panel-plugin/mode.c
@@ -126,21 +126,24 @@ void drawGraphModeNoHistory( CPUGraph *base, GdkGC *fg1, GdkGC *fg2, GtkWidget *
int y;
long usage = h * base->m_History[0] / CPU_SCALE;
int tmp = 0;
- int length = usage;
+ double t;
- for( y = h; y >= h - usage; y-- )
+ if( base->m_ColorMode == 0 )
{
- if( base->m_ColorMode > 0 )
+ gdk_gc_set_rgb_fg_color( fg1, &base->colors[1] );
+ gdk_draw_rectangle( da->window, fg1, TRUE, 0, h-usage, w, usage );
+ }
+ else
+ {
+ for( y = h-1; y > h - 1 - usage; y-- )
{
- double t = (base->m_ColorMode == 1) ?
- (tmp / (double) (h)) :
- (tmp / (double) (length));
- MixAndApplyColors( t, &base->colors[1], &base->colors[2], fg2);
+ t = (base->m_ColorMode == 1) ?
+ (tmp / (double) (h)) :
+ (tmp / (double) (usage));
+ MixAndApplyColors( t, &base->colors[1], &base->colors[2], fg1 );
tmp++;
+ gdk_draw_line( da->window, fg1, 0, y, w-1, y );
}
- gdk_draw_line (da->window,
- (base->m_ColorMode > 0) ? fg2 : fg1,
- 0, y, w, y);
}
}
More information about the Xfce4-commits
mailing list