I'd suggest cacheing the pixel value, not the value value. It's an easy fix and I can go through and do it while I'm waiting for other bugs to surface after trying to make all the 0.44-critical changes on the pile. (these are resolving my having broken the "new build system" in my impoartation of portaudio, and also finally acting on the hip~ and inlet~ bugs.)
cheers Miller
On Fri, Nov 30, 2012 at 11:20:53PM -0500, Hans-Christoph Steiner wrote:
Lots of patches use the built-in GUI objects for displays, and often a fast stream of events is hooked straight up to the GUI object, causing the GUI object to send many pointless updates, like draw commands when the number hasn't changed, or multiple draw commands per screen refresh cycle.
I propose to only send the GUI update commands when the relevant value has changed. I think this should apply to both the main element, like the slider knob, and the label for that GUI object, since that's often used as a display. The code change is pretty simple, but I was wondering if people thought there could be any problems caused by this
Here is the needed change, for example, for the hslider knob:
index b352fb9..88681fc 100644 --- a/src/g_all_guis.h +++ b/src/g_all_guis.h @@ -185,6 +185,7 @@ typedef struct _hslider t_iemgui x_gui; int x_pos; int x_val;
- int x_prev_val; int x_center; int x_thick; int x_lin0_log1;
index 470771a..e1a3c83 100644 --- a/src/g_hslider.c +++ b/src/g_hslider.c @@ -33,7 +33,7 @@ static t_class *hslider_class; static void hslider_draw_update(t_gobj *client, t_glist *glist) { t_hslider *x = (t_hslider *)client;
- if (glist_isvisible(glist))
- if (glist_isvisible(glist) && x->x_val != x->x_prev_val) { int r = text_xpix(&x->x_gui.x_obj, glist) + (x->x_val + 50)/100; int ypos=text_ypix(&x->x_gui.x_obj, glist);
@@ -57,6 +57,7 @@ static void hslider_draw_update(t_gobj *client, t_glist *glist) x->x_thick = 0; } }
}x->x_prev_val = x->x_val;
}
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev