diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-03-12 17:05:09 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-03-12 17:05:09 +0000 |
commit | 3a716d2b9035a136a0bfa405dd20c2a1b47dde07 (patch) | |
tree | b4cf8a2f771ee16afc1f74e3f1188b041d5e76d0 /gtk2_ardour/canvas-simplerect.c | |
parent | 84af9f18ebd755a10f1b902d41a9730639467dbb (diff) |
add GPROFILE scons option; fix spectacular CPU usage sawtooth caused by constant redraw of entire rects when their bounds change
git-svn-id: svn://localhost/ardour2/trunk@1576 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/canvas-simplerect.c')
-rw-r--r-- | gtk2_ardour/canvas-simplerect.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/gtk2_ardour/canvas-simplerect.c b/gtk2_ardour/canvas-simplerect.c index d59096e68b..288289183f 100644 --- a/gtk2_ardour/canvas-simplerect.c +++ b/gtk2_ardour/canvas-simplerect.c @@ -264,11 +264,17 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item) double x1, x2, y1, y2; double old_x1, old_x2, old_y1, old_y2; double a, b, c, d; - - old_x1 = item->x1; - old_y1 = item->y1; - old_x2 = item->x2; - old_y2 = item->y2; + ArtIRect intersection, old, new; + + old.x0 = old_x1 = item->x1; + old.y0 = old_y1 = item->y1; + old.x1 = old_x2 = item->x2; + old.y1 = old_y2 = item->y2; + + new.x0 = x1; + new.y0 = y1; + new.x1 = x2; + new.y1 = y2; gnome_canvas_simplerect_bounds (item, &x1, &y1, &x2, &y2); gnome_canvas_item_i2w (item, &x1, &y1); @@ -288,6 +294,8 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item) /* now queue redraws for changed areas */ + art_irect_intersect (&intersection, &old, &new); +#if 0 a = MIN(item->x1, old_x1); b = MAX(item->x1, old_x1); @@ -304,7 +312,15 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item) d = MAX(d,item->y2); d = MAX(d, old_y2); + fprintf (stderr, "%p REDRAW %g,%g %g,%g\n", simplerect, a, c, b + 0.5, d + 0.5); gnome_canvas_request_redraw (item->canvas, a, c, b + 0.5, d + 0.5); +#else + gnome_canvas_request_redraw (item->canvas, + intersection.x0, + intersection.y0, + intersection.x1, + intersection.y1); +#endif } /* @@ -509,7 +525,7 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, if (parent_class->render) { (*parent_class->render) (item, buf); } - + if (buf->is_bg) { #ifdef HARLEQUIN_DEBUGGING |