From 7d51676aa4911048299b130becd8163e55a43cc0 Mon Sep 17 00:00:00 2001 From: Mathieu L Bouchard <matju@artengine.ca> Date: Fri, 22 Aug 2014 15:55:42 -0400 Subject: [PATCH] fix bug in graph_bounds when graph area is 0. Also don't call redraw when bounds have not changed. --- pd/src/g_graph.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index 3f960b99d..09d726fbd 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -596,18 +596,19 @@ void canvas_resortoutlets(t_canvas *x) static void graph_bounds(t_glist *x, t_floatarg x1, t_floatarg y1, t_floatarg x2, t_floatarg y2) { - x->gl_x1 = x1; - x->gl_x2 = x2; - x->gl_y1 = y1; - x->gl_y2 = y2; - if (x->gl_x2 == x->gl_x1 || - x->gl_y2 == x->gl_y1) - { + if (x1==x2 || y1==y2) { error("graph: empty bounds rectangle"); x1 = y1 = 0; x2 = y2 = 1; } - glist_redraw(x); + if (x->gl_x1!=x1 || x->gl_y1!=y1 || x->gl_x2!=x2 || x->gl_y2!=y2) { + printf("%f %f %f %f %f %f %f %f\n",x->gl_x1,x1,x->gl_y1,y1,x->gl_x2,x2,x->gl_y2,y2); + x->gl_x1 = x1; + x->gl_x2 = x2; + x->gl_y1 = y1; + x->gl_y2 = y2; + glist_redraw(x); + } } static void graph_xticks(t_glist *x, -- GitLab