aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-12-28 03:27:51 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-12-28 03:27:51 +0000
commit7e1757060eb4b9b22e8dfd9cd36f1e614ab2bda6 (patch)
treebf12bcc23eb243037f7c8fe451bcc8d3e126c704
parent7bcd3ced117948ec1cc16417cf8bea1b56d18d4b (diff)
only send draw updates if the diameter or value has changedHEADsvn2git-headexternals/flatgui
svn path=/trunk/externals/flatgui/; revision=16780
-rw-r--r--knob.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/knob.c b/knob.c
index fdd8a93..818aa17 100644
--- a/knob.c
+++ b/knob.c
@@ -50,8 +50,10 @@ t_symbol *iemgui_key_sym=0; /* taken from g_all_guis.c */
typedef struct _knob /* taken from Frank's modyfied g_all_guis.h */
{
t_iemgui x_gui;
+ int x_prev_h;
int x_pos;
int x_val;
+ int x_prev_val;
int x_lin0_log1;
int x_steady;
double x_min;
@@ -63,9 +65,12 @@ typedef struct _knob /* taken from Frank's modyfied g_all_guis.h */
static void knob_draw_update(t_knob *x, t_glist *glist)
{
- if (glist_isvisible(glist))
+ if (glist_isvisible(glist) &&
+ (x->x_gui.x_h != x->x_prev_h || x->x_val != x->x_prev_val))
{
/* compute dial:*/
+ x->x_prev_h = x->x_gui.x_h;
+ x->x_prev_val = x->x_val;
float radius = 0.5*(float)x->x_gui.x_h;
double angle = 7.0/36.0 + 34.0/36.0*2.0*M_PI*( (double)x->x_val*0.01/(double)x->x_gui.x_h );
int start = -80;