diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2012-12-28 04:17:12 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2012-12-28 04:17:12 +0000 |
commit | 37af4b575209066fff77c813efca56101c465c5d (patch) | |
tree | 6dea3aefefc9eb013d2251ed165c0f11ece08d29 | |
parent | e48435d13a4c9ee28ed0dd83bc031a28c53c1741 (diff) |
only draw updates if something actually changed
svn path=/trunk/externals/moonlib/; revision=16781
-rw-r--r-- | mknob.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -33,8 +33,11 @@ typedef struct _mknob { t_iemgui x_gui; + int x_prev_h; + int x_prev_w; int x_pos; int x_val; + int x_prev_val; int x_center; int x_thick; int x_lin0_log1; @@ -42,6 +45,7 @@ typedef struct _mknob double x_min; double x_max; int x_H; + int x_prev_H; double x_k; } t_mknob; @@ -51,6 +55,14 @@ static t_class *mknob_class; /* widget helper functions */ static void mknob_update_knob(t_mknob *x, t_glist *glist) { + /* only draw if something changed */ + if(!(x->x_val != x->x_prev_val || x->x_gui.x_h != x->x_prev_h || + x->x_gui.x_w != x->x_prev_w || x->x_H != x->x_prev_H)) + return; + x->x_prev_val = x->x_val; + x->x_prev_h = x->x_gui.x_h; + x->x_prev_w = x->x_gui.x_w; + x->x_prev_H = x->x_H; t_canvas *canvas=glist_getcanvas(glist); // float val=(x->x_val + 50.0)/100.0/MKNOB_TANGLE; float val=(x->x_val + 50.0)/100.0/x->x_H; |